Jump to content
  • Advertisement
Sign in to follow this  
DirectXGuru

WorldViewProjection in HLSL

This topic is 4332 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

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
Advertisement
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
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!