Sign in to follow this  
MTclip

to do world transforms in vertex shaders or not

Recommended Posts

I don't think I have ever seen a vertex shader that does not do the world transfrom in it. As far as I know, when you use the vertex shader you are pushing that vertex though the whole pipeline and if you do not do the transfrom on it, then it will never get transformed at any other stage. So if plan to transfrom the vertex the do it in your shader.

Share this post


Link to post
Share on other sites
Quote:
Original post by Drastick
As far as I know, when you use the vertex shader you are pushing that vertex though the whole pipeline and if you do not do the transfrom on it, then it will never get transformed at any other stage. So if plan to transfrom the vertex the do it in your shader.


This is more or less correct. When you use a vertex shader, you are replacing the fixed function transformation pipeline. This means that if you want any transformations to take place, YOU have to do it in the vertex shader.

Share this post


Link to post
Share on other sites
I think MTclip might be referring to concatenating the world and object matrices before sending it to the vertex shader.

Wouldn't you think that the driver or hardware would cache this type of calculation between the API calls that set such constants in the shader hardware?

If not, would it be faster doing it once on the CPU, versus once per vertex on the GPU?

I've never tested such a thing, but would be interested to find out what others think about it.

Share this post


Link to post
Share on other sites
Its better not to send too many constants to VS. if you send all world, view and projection matrices to shader and do the math there you will have a performance penalty. also GPU has more power for vector calculations(matrices are the same) doing the concatenation in cpu and sending the result to VS is much better .
hope that helped

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