I have two questions
first this
Is there a way to get the volumetric light scattering past a mesh or maybe disable the mesh from its calculation or something? I believe I’m not wording this right.
second…
when im using the volumetric light post process an odd rectangle can be seen under the sphere is this a bug or am I doing something wrong?
this is a playground: https://playground.babylonjs.com/#0BW9US
you can disable fog at lines 6, 7 and 249 to see the white volumetric light.
while I’m here I’d like to ask, is it possible to disable fog on certain meshes?
I don’t think so, as it is the interaction with the mesh that generates the effect (if the mesh is outside the screen, no effect is produced).
That’s because you use some negative components for sunLight.groundColor
(Math.cos(time)
can be negative).
You can use mesh.onBeforeRenderObservable
/ mesh.onAfterRenderObservable
to disable fog before rendering a mesh / re-enable it after it is rendered.
thanks for replying. Having fixing negative values in the groundColor didn’t fix the little rectangle but it did fix my problem of the ground color not matching the fog. I honestly had no idea why it wasn’t matching neither did I know I was getting negative values for color.
and for that last question I found mesh.applyFog is one better to use dynamically than the other or should I keep using the applyFog?
Indeed, mesh.applyFog
is better, didn’t know this property existed!
1 Like