Jump to content
  • Advertisement
Sign in to follow this  
ryt

How 3D vector gets transformed to a 4D vector?

This topic is 3267 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'm looking at directx tutorial 5 (directx 10), they manualy create a cube with D3DXVECTOR3, and in input layout there is also "POSITION" with R32G32B32 (no A32), but in effect file (for vertex shader) they use float4 for POSITION0 (for input), how this can work?

Share this post


Link to post
Share on other sites
Advertisement
When you do that the shader will automatically convert your float3 to a float4 by setting w = 1.

Share this post


Link to post
Share on other sites
vector4 represent 3d vector in homogeneous coordinates

let V=(X,Y,Z,W)

convert it into vector3 will give (X/W,Y/W,Z/W)

homogeneous coordinates permit represent projection and translation in 4x4 matrix

Have a look in wikipedia :

http://en.wikipedia.org/wiki/Homogeneous_coordinates

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!