I am currently trying to build a small real-time renderer of NBody simulations. These simulation consists basically of two types of particles : Stars and Black Holes.
For the moment, I simply want to render the stars as typical additive transparent point sprites (gl_one, gl_one) while I would like the black holes to be opaque.
Now here’s the thing : I can’t use the same shaders for the black holes and the stars. On the long run, I would like to have some texture rendering on the black holes to create a distortion effect around them, so I need to render them separately from the other stars.
Here’s my problem : If I render the stars first, then the blackholes, no matter the blending I try, the black holes will appear on top of the stars no matter their depth (z-test is enabled). If I render the blackholes first, then the stars, the black holes are transparent.
In both cases, I have tried a mix of blending flags, the problem being that the star particles “cannot discriminate” if what’s behind them is a star (and should be purely added) or a blackhole (should be occluded).
If there any way of mixing opaque and transparent particles in render like this ?
Thank you in advance,