How 3D vector gets transformed to a 4D vector?
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?
When you do that the shader will automatically convert your float3 to a float4 by setting w = 1.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement