Jump to content
  • Advertisement
Sign in to follow this  
ryt

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

This topic is 3348 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!