Use fog at certain part of the world?

Using Environment - Babylon.js Documentation produces the fog effect on the whole world.

Is there any way to apply the fog effect only at certain positions/areas ?

1 Like

That would be volumetric fog and would need a custom shader.

You can have a look here: Tomb Raider Nostalgia - Babylonjs

It’s a simple volumetric-like fog effect that can serve as a basis for yours.

Source code is:


I see. I pretty much know nothing about shaders except their names :frowning:

So forgive my ignorance but don’t I need a vertex shader to accompany the fragment one you linked ?

For example , would it be difficult to test it using ?

And if not, could you point me to the right direction please ?


Hey @HappyDev

You might want to check out the brand new Node Material Editor! It’s a fantastic new tool that we’ve just added to Babylon that allows you to create shaders without writing code! It’s entirely node based and super fun and easy to use.

Here’s the tool:

And be sure to check out our YouTube channel for lots of videos on how to use it!

Here are a few videos you may want to check out as you learn about it!


Those vids are very good. And the design style, of the title page, makes them look great.

Also @Pryme8 was working with volumetric fog not long ago. I bet he has updates.

:eagle: : )

Can you change scene.fogStart etal. in realitime?
It’s not quite the same effect but you could maybe grade scene.fog in/out in different areas. Might work best with an isometric camera

That I do, I made it way way way better and more performant. But the sad news is you are gonna hafta wait for when Im done with it to get another look at it.