Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am currently in the process of re-writing my 3d engine, and I am looking at improving the renderer.

I have read that organizing objects into a "render queue" and sorting is the best method.

The question is: How would you go about implementing a Render Queue?

Are there any resources that explain how you would go about implementing one or any examples that I could look at to understand further?


My current understanding is:

  1. Make a list of visible items within the frustrum
  2. Sort them (somehow)
  3. Render them
share|improve this question

closed as too broad by DMGregory, Josh Petrie Jun 12 at 17:42

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.

    
Why would you need to sort 3D objects? It's already the job of the depth buffer, no need to do that (except if you have transparent objects). –  Alexandre Desbiens Jun 11 at 18:07
1  
To minimize on state changes –  Nick Jun 11 at 18:08
    
Your current understanding is correct. The "somehow" part is the part that depends on your specific needs; if you are sorting to minimize state changes, for example, sort on the state that you have found to be costly to change. –  Josh Petrie Jun 12 at 17:43
    
Another thing that I wanted to know was, for this to work well do you need to have some kind of manager for shaders, textures, models etc of which you pass an index that corresponds to an asset as one of the render queue "parameters" or just pass the object? –  Nick Jun 12 at 17:46