Hello, I am having an issue with particles always rendering behind a plane. The plane is being used as a background and it’s position is at like z -3000. I am spawning the particles from an emitter at z around -5ish and they always appear behind the plane. I have a few other meshes in the scene at z -40 ish and the particles are rendering infront of them fine. The plane is scaled up to take up the whole background, although even without the scaling the particles seem the render behind the planes. Here is an image of the particles for reference.
As always, the PG repro would be extremely helpful to provide answers.
Sorry for the delay, Here is a close copy of the project in the plpayground.
maybe @PatrickRyan ?
@justbake, I could be wrong about my understanding of what you are trying to do, but it appears you always want your particle system to render on top of everything else in your scene. I didn’t dig very deep into your code, but I can surmise from what I see in the experience that you are creating the particle emitter at the position of the “firefly” you are clicking on so that the particle system scales with the proximity to the camera.
In that case, the approach I would take would be to set up a second camera in the scene in the same position as your main camera and add this one to scene.activeCameras
. I believe the last one added will render on top, but I could have that backwards. Then you simply need to add a layerMask
to your particle system and the camera that will render only the particles. In this way, your second camera will only see the particle system and render on top of the elements being rendered by the main scene camera.
This technique is very similar to the reticle on a shooter example on the documentation page Layer Masks and Multi-Cam Textures | Babylon.js Documentation. Hope this helps but feel free to ping back with questions.