Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

lly20000

A transform problem ????

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

Now I was pick a point and I know this point U and V coordinate but I don''t know how to transform this U and V coordinate to my World coordinate that is X Y Z coordinate ??????????????????

Share this post


Link to post
Share on other sites
Advertisement
You have to know which direction the surface is facing - primarily Z, Y, or X either with flags or working out the normals of each surface.

to convert from UV to world space:
(surface facing primarily along the Z axis)
(assuming that surfacePosX/Y/Z is in the centre of the surface (hence '-surfaceHeight/2 or - surfaceWidth/2'))
(also assuming that the texture width and height is 1.0f)

pointU = 0.3f;
pointV = 0.4f;

pointX = (surfaceWidth * pointU ) + (surfacePosX-(surfaceWidth/2));
pointY = (surfaceHeight * pointV ) + (surfacePosY-(surfaceHeight/2));
pointZ = surfacePosZ; // no need to do anything with this

(surface facing primarily along the Y axis)

pointU = 0.3f;
pointV = 0.4f;

pointX = (surfaceWidth * pointU ) + (surfacePosX-(surfaceWidth/2));
pointY = surfacePosY;
pointZ = (surfaceHeight * pointV ) + (surfacePosZ-(surfaceHeight/2));

(surface facing primarily along the X axis)

pointU = 0.3f;
pointV = 0.4f;

pointX = surfacePosX;(
pointY = (surfaceHeight * pointV ) + (surfacePosY-(surfaceHeight/2));
pointZ = (surfaceWidth * pointU ) + (surfacePosZ-(surfaceWidth/2));

Hope that makes sense, it doesn't to me :S

[edited by - -indirectx- on March 19, 2004 8:24:21 AM]

Share this post


Link to post
Share on other sites

  • 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!