Volumetric Light Scattering Turning ClearColor Black

Hello Guys,

I have a project that I’m using the VolumetricLightScatteringPostProcess in, its a client project so i cannot share a playground unfortunately, the issue is i have several products but one of them im using the vls in it all of them has a transparent background and is looking good, except for this particular model that im using vls on its turning the entire scene black, i want it to be transparent how can i fix it ?

const vls = new VolumetricLightScatteringPostProcess(
        "vls",
        { postProcessRatio: 1.0, passRatio: 0.5 },
        this.camera,
        lightMesh,
        100,
        Texture.BILINEAR_SAMPLINGMODE,
        this.engine,
        false
      );
      vls.invert = false;
      vls.weight = 1;
      vls.exposure = 2;
      vls.width = 100;
      vls.useCustomMeshPosition = true;
      vls.setCustomMeshPosition(new Vector3(0, 0, 0));
      vls.decay = 0.9;

this is the vls part of the code

Best Regards.

Try to look at the console of the browser, in case there’s an error there. You could also try to use Spector and compare the bad rendering with a good one and see if you can pinpoint some differences.

But without a repro, I’m afraid it’s hard to find the problem if no one has encountered it before…

There is no errors everything is rendering fine but the background is turning black instead of being transparent i saw a similar issue on the forum in the following link

https://forum.babylonjs.com/t/how-to-set-alpha-to-volumetric-lightscattering-post-process/7576?u=karim_salam

The code is a really simple one its just the scene the camera the model and this vls

Let me clarify the problem is that the vls is turning the clearcolor full black instead of transparent

Does the fix work for you?

I tried these but it didnt work i dont know if its because you are using a background image instead of a color or transparent

Okay it worked turns out i needed to use the shaders you added too i didn’t add them before to my code after adding them with the following two all worked and the transparent background is done thanks for your help

vls._volumetricLightScatteringRTT.onBeforeRenderObservable.clear();
vls._volumetricLightScatteringRTT.onAfterRenderObservable.clear();

1 Like