How do I handle transparency
Actually, let me narrow down the question to this, as I think there are enough resources on everything else:
Since the best way to handle transparency is apparently to have a separate pass after the geometry rendering and deferred pass, how do you suggest I prevent iterating over every bit of geometry in the world, especially when they're linked to the opaque geometry with things such as skeletal animation (ie, a head visor on a soldier, etc)
I don't really understand the question. Why do you need to iterate over every geometry in the world? Are you talking about the objects that show up in reflections (i.e. planar reflections)? Or do you mean making sure that objects/materials that are transparent and part of an opaque mesh need to be reskinned?
I mean that when you render, you render opaque objects for a deferred pass before transparent ones for a forward pass. If 5% of your models are entirely transparent, and 5% are partially transparent (half opaque materials, half transparent materials), is there a way to draw the transparent objects without iterating through 100% of your models. The only way I can think of is keeping an array of all transparent geometry separate from the opaque ones, but that sounds like a bad idea.I don't really understand the question. Why do you need to iterate over every geometry in the world? Are you talking about the objects that show up in reflections (i.e. planar reflections)? Or do you mean making sure that objects/materials that are transparent and part of an opaque mesh need to be reskinned?
it is not a bad idea at all, it is how most implementations work.
you simply keep an array (or any data structure you think is better) for each render type. one for opaque, one for transparent, one for a custom fancy rendering effect (skin ?)
it is both simple to implement and effecient to travers
Like Yourself said, it's actually very common to have separate rendering lists. In CryEngine, we have separate rendering lists that the renderer processes in a specific order. When we want to draw something we add it to the respective list (general/opaque, transparent, etc). You can also batch shaders and textures this way if you know they won't change between draws.
What I normally do is quite similar and separate my draw calls from my models. For each model, I go over every material, and submit a draw item to my renderer. The draw contains information like which material to use, what mesh, the start vertex and element size to draw, etc. The renderer just sorts these items by material attributes (transparent, blend states, etc) before rendering and then draws them. If your model has a transparent part and an opaque part, then that would be two draw items submitted to the renderer and drawn at the appropriate times.
The only way I can think of is keeping an array of all transparent geometry separate from the opaque ones
bingo, optimization via data oriented design.
The only way I can think of is keeping an array of all transparent geometry separate from the opaque onesbingo, optimization via data oriented design.
But what's the way this is done usually, especially in regard to BOTH transparency sorting and skeletal animation, especially considering the geometry is shared? Is there a document or presentation of ways of object management for geometry? I'm aiming for maximum data locality so I need to find out a way to do this.
Also is transparency sorted by poly, submesh, or object? The first seems almost impossible to do safely. The second seems to be difficult to manage (especially since I'm using VAOs rather than manual vertices), and the last seems difficult (what about different mesh sizes, and multiple transparent objects per object?)