Here is a boiled-down version of my code:
I want to render godrays on a circular mesh (because the default square looks silly as a sun)
Every functioning way I’ve seen to do this uses a texture, but I don’t want to go out of my way for that nor load extra resources.
There seems to be a qualitative difference between a custom-created mesh and the default one generated by VolumetricLightScatteringPostProcess, but I can’t figure it out.
How can I get these to render properly? I’d really like nice light shafting.
i think, you must use a texture for the postprocessing because you have to override the default material of the source mesh. here is example of what you want right? i know you said you’ve already seen, but just putting here for discussion
fwiw, there is also this, which is using geometry and no postprocessing
.GitHub - evolution-gaming/BabylonJS-Godrays: Fast, spectacular, configurable and lightweight god rays plugin for BabylonJS
You should set the emissive color:
this works great! is there any way I can have the mesh be invisible though? I’m trying to add effects to a skybox so I can’t really have visible geometry
You can make the mesh invisible like this:
But it won’t change the output (as you can see in the PG): the volumetric effect is based on the mesh being rendered in an off-screen RTT and being composited with the scene in a specific way.
(notice that the sun is not rendered in this screenshot)