Sign in to follow this  
jorgander

texture, shader, vbo, sorting optimizations

Recommended Posts

this thread mentions more or less what i'm asking, but not exactly, and i would like to ask it in a more general sense. how should draw operations be sorted relative to materials/textures, pixel/vertex shaders, vertex buffer pointers, etc.? i currently have my stuff set to sort first on materials, then by vbo (i don't have any shaders). after reading around, i am thinking of changing it to sort first on vbo, or if it's possible given scene geometry, have one vbo per material (instead of one vbo per mesh, etc.). i read in an nvidia paper (can't find the link) that switching vbo pointers is expensive, but i'm not sure if this is only nvidia-specific. disregarding higher-level ideas such as transparency, is there a rule of thumb to follow here? and, does it differ between video card brands enough to be of a concern?

Share this post


Link to post
Share on other sites
I believe that it is pretty expensive to switch vbo's with the nvidia-specific extension of vbo's. However, I think the ARB extension tried to make it as lightweight as possible. Though it's still expensive, it's not that bad.

The difference of brands isn't the main concern. You should be concerned simply if the current video card supports rendering this mesh chunk or not. If it doesn't, try to render it with a more lightweight effect. This kind of detection can be done preprocessing so that all you have to say is to render this chunk with these materials and shaders.

In terms of sorting, I'm still working that out myself (that thread isn't very old :)). I'm inclined to group by shaders/materials/textures/vbo's. Chances are each chunk will have it's own vbo, and you will have to switch those anyway. As for the others, it just seems the most logical. Like I said though, I'm still figuring that part out myself.

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