So one question I'm asking is the best way to sort the rendering. Rendering front to back is no longer an issue because of the magical pre-z pass and deferred lighting, so that priority is last. I am deciding between priority sorting by complete mesh or by material.
My 2 basic options in mind are:
- make a list of everything in the scene that uses the same material. This includes all the different parts of the models (such as the characters clothes is the same material as the bed, so they are rendered at the same time) and does not try to render the entire mesh at once, that would be second priority.
for type of material (variable set) for each mesh for each mesh attribute render the attributes that match the material variables } }I know there is a substancial speed penalty for constantly switching shader variables so this option is attractive.
- render each mesh as a whole. This is how it is done in the DX SDK samples, but I have a feeling it is for clarity and not efficiency.
for each mesh for each attribute change shader material variables } }
I know there is also a speed penalty for constantly switching between drawing different types of meshes. I have a feeling the first option is faster but I'm just making sure.
Thanks in advance.