ParticleSystem and alphaIndex


I’ve been playing around with ParticleSystem and transparency in babylon and found some weird behavior.
It is stated in the docs (Transparency and How Meshes Are Rendered - Babylon.js Documentation) that ParticleSystem is rendered after all the alpha-blended meshes. But in reality if I render a semi-transparent mesh (with visibility 0.99 for example), I notice that it covers my particles independent of what alphaIndex I set to it.

Here is the condensed example based on the other one I found in the playground:

You can see that sphere covers the particle system even if particles are in front of it.
I understand that making particles respect sphere surface may be tricky because of the zbuffer stuff, but for my purposes it would suffice to render the scene the other way - i.e. to have particles rendered on top of the sphere (including the ones that are inside).

Is it possible? I am currently looking at SPS which seems to be promising, but is there any way to do that with the simple ParticleSystem?

Thank you in advance!

Hi and welcome aboard!

Use the renderingGroupId property to render the particle system after the meshes:

The doc is wrong in this regard, I’m going to update it.

Hi, thanks!

I’ve been thinking about using renderingGroupId. But I also want to render some other opaque meshes on top of the particle system, so I wanted to keep objects on the same layers to use the depth buffer.

Then I realized I can use scene.setRenderingAutoClearDepthStencil(2, false); in order to preserve depth buffer between layers. So I implemented my idea in the new playground version and it works just as I need it to:

Thank you for the help