Sign in to follow this  
mlt

Vertex program : POSITION

Recommended Posts

The input struct to a vertex program often look like this:
struct vertex_input
{
  float4 position : POSITION; 
  float4 normal   : NORMAL; 
};

But I have also stumbled across vertex programs where 'position' is just a float3 vector. If we assume that the data from the application does not change but we only change the position from float4 to float3 then what happens? I am pretty sure that the data from the application only contains 3 elements per vertex so I also wonder why position is sometimes defined as a float4.

Share this post


Link to post
Share on other sites
Quote:
But I have also stumbled across vertex programs where 'position' is just a float3 vector. If we assume that the data from the application does not change but we only change the position from float4 to float3 then what happens?


It depends on what you are doing in the shader.
I'm guessing the vertex gets multiplied by a 4x4 matrix so if you make the vertex into a float3, then multiplying no longer becomes possible.
The Cg compiler would spit out some error message.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this