Jump to content
  • Advertisement
Sign in to follow this  
zinking

[SOVLED] HLSL coordinate tansforms

This topic is 3413 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

say: Out.pos = mul( Position, g_mWorldViewProjection); so what is the corresponding coordinate in view space (UV?) pos.xy ? pos.xy / pos.w ? or should I do some transforms? float2 uv = sign( Out.pos ); uv = (float2(uv.x, -uv.y) + 1.0) * 0.5; and I wnat know when to /.w and when not? [Edited by - zinking on May 17, 2009 12:56:54 AM]

Share this post


Link to post
Share on other sites
Advertisement
float2 uv = (float2(Position.x, -Position.y) + float2( 1.0f, 1.0f ) ) * 0.5f;

that's the answer, I've solved that.

Share this post


Link to post
Share on other sites
A UV is not a "coordinate in view space"
It is a texture coordinate.

It does not have a set range either, like you are using in your calculation.
It does however map (0,0 to 1,1) to texture addresses.
There are different modes to map these coordinates.

Your choices if words are confusing.

Do you mean, "How do I programatically create my own texture coordinates, in a clamped addressing mode, given the vertex positions of a triangle?" or do you mean "What are the screenspace coordinates of a vertex given in world space?"

The latter would depend on your projection transform and viewport.

I don't follow what you are transforming and to where...

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!