I’m working on an animation where I’m trying to add a ParticleSystem. The particles work fine, however they seem to ignore lights and fog settings in the scene.
Is there any way to have the particles react to lights and fog?
I don’t know much about the particle systems, but I just changed the fog mode in one of the particle system demos from the docs, and interestingly it appears that, when I zoom out, the ground plane vanishes into the fog while the particles do not. @sebavan, is this expected? And, if so, is there a way to change the particle material to one that will be light and/or fog sensitive? I checked the ParticleSystem page in the docs, but the only mention I found of materials was in imageProcessingConfiguration, which I didn’t think was related (though I might be mistaken ).
Lights are not supported by design in the particles and I agree fog could be nice
If you want a normal material might be better to think about solid particle system and such has all particles are quads so the result won t be that interesting visually.
In fact it is not a bug: the vertex shader is fixed for particles, you can’t modify it, what you are editing in the NME is the particle fragment shader. The Fog block has a vertex counter part that is missing when creating the particle shader, hence the crash.
Instead, you can implement the fog yourself in the particle shader, it’s not very complicated (I have implemented the EXP fog mode): https://playground.babylonjs.com/#0K3AQ2#618
Note that I’m using a particle texture (cloud.png) with an alpha channel and I set the blend mode to STANDARD, else you won’t get the effect you want (try changing the blend mode to something else and the texture by another one without an alpha channel like flare.png).
In this case could we remove the fog block from the selection list in NME in particle mode @Evgeni_Popov ? (to prevent the confusion as I was so happy to see it there )