Lets say I have a car model with both solid and transparent parts (car body and a windshield you can see-through). And lets make it even trickier - I also want to render a driver inside the car (a different, changable model). Now multiply it by 100 cars.
What's the best approach to render this type of scene?
I know that all the transparent parts should be drawn last, ordered by distance from camera (in case you can see-through multiple windshields) and without writing to depth buffer (so they won't block solid stuff). But how can I make it somewhat generic and not very specific hard-coded stuff for this scenario?
Lets say I added metadata to all models and their parts, and I somehow magically know which parts are transparent.
This means that I still need to
- Do at least 2 rendering phases, one for solids and one for transparent.
- Sort the transparent stuff by distance from camera and disable depth writing.
Is this really the right way to do it? I feel like MonoGame design doesn't really encourage it, as it treat model and meshes as a whole. Is there maybe a more simple way to do it which I'm missing?
PS. please don't try to give solutions for my specific car-driver example, it was just to explain the problem. Assume my scene have hundreds of different models with complete transparent / non-transparent insanity. Assume the worse possible case.