Skip to main content
GameDev.net gamedev.net
🔒 Locked

Ubershader/Scene Sorting

Started by Shael Feb 8, 2010 at 8:19 PM 0 replies 650+ views
Original Post
Shael
Shael
I'm having a little bit of a design dilemma in regards to setting up a ubershader and sorting my scene. Currently I have a SceneGraph which contains Renderable nodes. Each frame any renderable nodes have their virtual AddPasses() function called. Its purpose is to fill in a structure containing all information to perform a single rendering pass. It basically contains a Mesh and Material pointer and some other info for rendering the object. These Passes are then stored in render queues (opaque, transparent, gui, etc) and sorted before rendering. Sorting for opaque at the moment is done based on Shader, Technique, Mesh, and Texture. Now with that said, I'm trying to efficiently setup a ubershader and a Light Pre-Pass renderer. The problem I'm facing is that meshes can be static or skinned/animated, or the mesh could be user defined and therefore require a different technique or shader pass to render each type and because I'm doing Light Pre-Pass I have certain passes that all techniques need to have. I'm trying to work out if I should now only sort by Technique (and maybe texture?) and then put all render pass objects into a hashmap, based on Technique and then that way for each Technique I can perform the passes it requires. This would minmise changing technique and cut down BeginPass/EndPass calls. The other idea was to maybe have one UberTechnique and then have a heap of different passes in there to do different things, including the ones for LPP. But then I'd need a way of specifying what shader passes are required for each render pass object. Sorry for the big post but I figured I'd best give more info than less. What are your thoughts on the topic? Thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.