[DX9] Sorting Renderables

Started by
1 comment, last by RealMarkP 14 years, 5 months ago
I just jumped back into my engine code after a few months hiatus. I started working on a sorting mechanism to optimize out unnecessary swapping of states. Now, I'm using Cg as my effects framework and I'm wondering if anyone has experience sorting a scene that uses Cg. For example, this is my sorting order: 1. Sort by Render Target. 2. Sort by Transparency. 3. Sort by Effect Technique. 4. Sort by Textures. Questions: - How would technique passes play into this sorting mechanism? - In a typical engine, would there be only one effect with many techniques? - Is sorting by techniques enough? Thanks.
------------Anything prior to 9am should be illegal.
Advertisement
Your sort seems pretty logical. Except you'd sort by effect, and then technique. I'm not entirely familiar with the effects pipeline so can't really help out much there.

There's a pretty sweet sorting technique described here: http://realtimecollisiondetection.net/blog/?p=86 If was ever back in the renderer writing business i'd definitely use it.
Quote:Original post by bzroom
Your sort seems pretty logical. Except you'd sort by effect, and then technique. I'm not entirely familiar with the effects pipeline so can't really help out much there.

Ok great, I added in sorting by Technique after the Effect. But I'm still having a hard time trying to wrap my head around sorting objects that use multitexturing. Any advice on this subject?

EDIT: Once textures are created in VRAM, wouldn't the act of setting a texture variable in an effect be relatively trivial? Or does it do the same processing as you would with SetTexture().

Quote:There's a pretty sweet sorting technique described here: http://realtimecollisiondetection.net/blog/?p=86 If was ever back in the renderer writing business i'd definitely use it.

Good find! I have his collision detection book. His approach seems similar to that of mine.
------------Anything prior to 9am should be illegal.

This topic is closed to new replies.

Advertisement