Fog Weirdness (not blotting meshes out, just masking its material)

Hi There,

Wondering if I’m not doing this right, but I’ve got some fog in my VR scene:

        //FOG (extremely cool, don't think it really helps with rendering)
        scene.fogMode = BABYLON.Scene.FOGMODE_LINEAR;
        //day fog
        // scene.fogColor = new BABYLON.Color3(0.9, 0.9, 0.85);
        //night fog
        //scene.fogColor = new BABYLON.Color3(0,0,0);
        scene.fogDensity = 1; //.01
        scene.fogStart = 20.0;
        scene.fogEnd = 60.0;

But what I’m seeing is this:

Rather than things “fading into darkness” as it does in the babylonjs example, it just blots out the color of the material.

Advice thoughts opinions?

Hi saitogroup,

I think GPU fog is material dependent and won’t apply to certain things like the clear color: for example, if you zoom out of and away from the skybox on the fog demo Playground, you should see the skybox itself get affected by fog while the clear color remains untouched. I’m guessing something similar is happening here, but it’s hard to be sure without a running instance to examine. Hope this helps, and best of luck!


This is exactly that :slight_smile:

In your case just make scene.clearColor being the same color as the fog for simplicity.


works now; it’s very cool

it completely changed the experience bc it’s a vr hunting game and now you don’t know what’s around the next corner

do glowy lights in fog look cool?

1 Like