Skip to main content
gamedev.net
🔒 Locked

Render queue sorting

Started by stupid_programmer Dec 9, 2008 at 3:36 PM 3 replies 3.1k views
Original Post
stupid_programmer
stupid_programmer
I understand the basic idea that you sort the renderables based on things like shaders, sampler state settings, textures, etc. What I'm curious about is how you actually implement the system. Do you have a list of predefined materials that the game will have and no more can be added at runtime? Then based on the entity type you assign it a id to each of those materials then sort all of the objects into lists of those types and then render each list? Maybe I am a stupid programmer but just reading ideas on how something should work doesn't always click with me. Seeing it in action and being able to step through the code while reading the theory makes it much easier for me to grasp the concept.
legalize
legalize
Yes, you could use a material ID that you associate with each distinct material and sort based on that. The ID itself isn't what matters. What matters is that all the geometry associated with that ID is drawn together so that you can batch the geometry without having to reset the material each time.
stupid_programmer
stupid_programmer
Kind of what I was thinking was to create state blocks with the various settings needed for each of the render types my game has (only like four or five) when the program is created. Then swap each state block for the group of objects to be rendered.

What I'm also curious about is if people are sorting on render states, shaders, and even textures how many internal lists are people generating each frame? I realize the time taken to make these lists is faster then all the time it takes to switch render settings but there must be a lot of internal render lists.

Topic Locked

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

Sign in to reply to this topic.