Skip to content
Advertisement

three.js transparent maps issue

I’m creating loads of particles (80.000 to be exact) and I have set a transparent map, though, not all particles are transparent.

I’m using a transparent PNG image: particle.png (it’s barely visible but it’s there alright) as the material map, though it shows a black background as seen here:

particles

If you look closely, some particles blend together well (no overlapping black edges) though some do not. Could it be because there are so many overlapping transparent objects or shouldn’t this be an issue?

Here’s the snippet responsible for the generation of my particles:

JavaScript

Why do some of the particles have a black background?

Advertisement

Answer

Those particles with black corners are rendered before anything behind them. So GL doesn’t know yet there is something behind to blend. In order to make it look right you have to render these particles in the order of their z coordinates from back to front.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement