Volumetric Lighting / Fog Implementation

Hi. I’ve been working on a volumetric fog implementation and now I want to share it.


It works with particles with light influence and a texture with noise to create a dithering effect, reducing visual artifacts.
This implementation emits the particles with a function instead of using the ParticleEmitter property “Rate” to bypass particle rate limits to make the volumetric fog look the best.
This volumetric fog is highly performant in decent devices.


Because of how light influence works with ParticleEmitters, the lights are sampled directly from Roblox’s voxel grid, making the volumetric fog look smooth.

This can be an issue sometimes when using ShadowMap or Future lightning technologies because of inaccuracy with lights and shadows.

Example (look how there is illuminated fog in the shadow):


Volumetric Fog Setup

Now, I’ll explain how to setup this volumetric fog implementation in your game:

  • First, you need to get the model
  • The model is a folder named “VolumetricFog” with a “Camera” part and a “Settings” instance inside
  • You need to put the “VolumetricFog” folder in Workspace

After doing that, you can now playtest your game and it should work.


You can change the volumetric fog settings to make it look different.
The settings are inside the “Settings” instance as attributes.

attributes

This is an explanation of what every option does:

  • CameraSize: The size of the camera part

  • Enabled: Enables the volumetric fog. This setting can be modified in realtime

  • LightInfluence: How much light influence the fog has

  • ParticleMaxSize: The maximum size a particle can have

  • ParticleRate: How much particles are emitted per second

  • ParticleTransparency: The transparency value of the particles (Note: Transparency values very close to 1 can cause visual artifacts)

  • ParticlesFacingCamera: Makes the particles to face the camera

  • TextureQuality: The texture quality of the particles. Lower quality = more visual artifacts. This setting can be modified in realtime (Note: 1 = low quality, 2 = medium quality, and 3 = high quality. If using a number that isn’t 1, 2, or 3, medium quality will be used)

  • Tint: The tint of the fog (Note: Use dark colors or the fog will look very bright)

  • ZFar: How much distance (in studs) the fog will reach (Note: More distance will require more particle rate and more particle max size to make the fog look good)


When implementing this, the most common issue that can happen to your environment is that the lightning may seem too bright, so you might need to make some changes to your game’s lightning or to the volumetric fog settings to solve this.


Volumetric Fog Comparisons




I will work on updates later. I want to make it look better with more performance, maybe optimizating the code, but I don’t have enough time (I’m lazy).


You can get the model here:
Volumetric Fog 1.0.0.rbxm (7.7 KB)

You can test it here:

31 Likes

It’s actually super neat. Checked out the code and seems pretty performant imo for handling volumetric lighting. Good job on it! (hoping my salad-powered laptop can handle the lighting)

Yeah, no it wasn’t made for me
Without:

With:

3 Likes

looks cool ima test… ok wow it cool but lag i wild put a script to disable it when the plrs graphis get turend down below 8.

2 Likes

Uhmmm, looks like both are the same image.

1 Like

youre ggraphis setting can chage how robloox reders partacles so chek youre seetting i found the effect only works if it is 8 or abouve

those look like the same picture

This is what it actually looks like.
Keep in mind, this takes a lot of GPU usage as there’s a lot of images on the screen at once
around 70% usage on my GTX 1080

VERY cool tho

With:

Without:

2 Likes

Volumika but it doesn’t costs 50 dollars, very cool resource.

6 Likes

Whoopsies, seems like copy-paste didn’t work correctly. Will fix that

this is very cool! how is the performance on games with this engine though.

1 Like

You can check my pictures and take a look at my FPS…

are you using integrated graphics?

I’m using the normal graphics level (level 10)

Here’s a great blog post on the implementation(I assume)

1 Like

It is highly performant on decent devices, running at +60 fps with max graphics, but it can vary depending on the game and how it is optimized.

1 Like

This is super sick. I used this to make a showcase and it turned out really nice, 100% recommend

9 Likes

This is all due to the fact that Roblox optimizes Particle Emitters for you, but if you tried to make a volumetric light using BillboardGui, you would have to optimize its work yourself; I have not yet seen such developments on the forum. I would really like to compare your volumetric mist and VOLUMICA.

1 Like

you have the same specs as me and run at the same fps

how did you make the aurora?


combination of beams and layering. here’s the rbxm if you want to see how i did it
aurora.rbxm (6.1 KB)

2 Likes

Thanks! But mine still looks way worse compared to urs idk why