Jump to content
  • Advertisement
Sign in to follow this  
iota1410

using transformed data

This topic is 4969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to use data that I receive which comes in in screen space (i.e. x=100, y=150 not x = -1.0, y = 2.0). But I want to use it in the following format so that it works with my vertex shader. Since this data is already tranformed int screen space, how can I get it to work. struct CUSTOMVERTEX { FLOAT x, y, z; // The transformed, 3D position for the vertex }; #define VERTEX (D3DFVF_XYZ) D3DFVF_XYZRHW does not work due to the need of my vertex shader. D3DDECLUSAGE_POSITIONT does not allow multiple streams, which I need for my application. Using the data as is, it does not show up on the screen. Please help. [Edited by - iota1410 on November 11, 2004 10:05:09 AM]

Share this post


Link to post
Share on other sites
Advertisement
In the shader it is your responsibility to transform the data. If it is already in screen space simply don't transform it, that is don't multiply it by the projection and view mats.

Share this post


Link to post
Share on other sites
You'd have to transform the coords into homogenous clip space since that's what the shader outputs. The projection is applied after the vertex shader.

Share this post


Link to post
Share on other sites
Sorry, I was a little unclear. I didn't mean it is projected, rather the viewport transform is applied. You can find all the information in the SDK, under Viewports and Clipping I believe.

Share this post


Link to post
Share on other sites
I am folloing the sample you suggested and i receive an error:
Direct3D9: (ERROR) :Viewport outside the render target surface

I use the following code:


D3DVIEWPORT9 viewData = { 0, 0, 640, 480, 0.0f, 1.0f };
HRESULT hr;
hr = g_pd3dDevice->SetViewport(&viewData);
if(FAILED(hr))
return hr;

What am I missing? I call this during my init calls.


[Edited by - iota1410 on November 11, 2004 7:17:26 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by turnpast
In the shader it is your responsibility to transform the data. If it is already in screen space simply don't transform it, that is don't multiply it by the projection and view mats.


I followed your advice, but with no result. My shader basically just passes the information through, yet still nothing shows up on the screen.

[Edited by - iota1410 on November 11, 2004 10:45:29 AM]

Share this post


Link to post
Share on other sites
Any help here would be greatly appreciated. If I am asking wrong, or what I want is not possable, please let me know. Im theory what I ask seems very simple. I just want to be able to present my data to the screen. I receive my data in screen space coordinates. I do not want to use the XYZRHW format due to shader limitations, so how can I present the picture.

If any code snippets will help please let me know.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think you must tranform your coordinates to the zone (-1, -1)-(1,1) and not output them in the rect (0,0)-(640,480).

Share this post


Link to post
Share on other sites
How can I convert from screen coordinates to untransformed coordinates? (640,480) = (1,-1)
or am I looking at this complety wrong.

[Edited by - iota1410 on November 11, 2004 2:20:50 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!