Try this:
https://www.babylonjs-playground.com/#BRFSGD#1
I have set a picture in the canvas zone instead of a plain color to better see how it goes.
I have performed one minor change in each shader used by the effect: volumetricLightScatteringPassPixelShader
and volumetricLightScatteringPixelShader
. I have done it in an ugly way for the PG, I just updated the code in the Effect.ShaderStore
object.
In godrays.onActivateObservable
(line 58), you should set a clear color corresponding to the object emitting the god rays (that’s why I put (1,1,0)
which is the emissive color you used for your cylinder).
I also had to access VolumetricLightScatteringPostProcess._volumetricLightScatteringRTT
but as it is not exposed I simply used godrays._volumetricLightScatteringRTT
. The onBeforeRenderObservable
/ onAfterRenderObservable
observables clear the buffer to black by default, so I needed to remove them.