Sign in to follow this  
Shael

Ubershader/Scene Sorting

Recommended Posts

Shael    286
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!

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