Sign in to follow this  
DirectXGuru

WorldViewProjection in HLSL

Recommended Posts

Can anybody tell me why we multiply the view and projection matrix in shader file and then multiply to transform the vertices.If we do the same in fixed function pipeline strange thing happens.I want to know the reason. thanks and regards.

Share this post


Link to post
Share on other sites
In the fixed function pipeline you have to set the world, view and the projection matrix to the 3d api. Then the API will make the mulitplication for you.

If you use a vertexshader you have to do this multiplication in the shaderfile, because if you don't the vertex will not be transformed into screen space.

greets Buddy

Share this post


Link to post
Share on other sites
You perform the multiplications in the shader because the shader is replacing that part of what was previous the fixed-function pipeline (the vertex transformation stage).

Since you cannot control the transformation in fixed-function (other than to specify the value of the matrices), I gather you are pre-transforming the vertices before you send them to the fixed-function pipeline? In this case you get "strange things" to happen because the fixed-function vertex transformation stage will go and multiply your already-pretransformed vertices again, bring them into some very odd coordinate space that is NOT what the rest of the pipeline will be expecting.

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