Home

Awesome

Godot Volumetrics Plugin

Donate

volumetrics plugin

Hello fellow Godot user. This plugin will enable to create well lit volumetric fog in the game engine. GLES 3 only.

What is it exactly?

<a name="volumetric-techniques"></a>volumetric_techniques

Well as you may know, there are many different ways of achieving volumetric effects; each one has their one advantages and disadvantages. Here is a list of some of these techniques.

This technique, based on frostbite's implementation, uses a bunch of frustum-aligned 3D textures to hold the participating media in clip-space. This media is then used to calculate lights in 3D space in a more unified manner. Local fog can easily be blended with each other, global fog, and to an extent in this case, transparent objects.

Installation

Whether it's downloaded from the asset library, or directly from the GitHub repo, you must retrieve the silicon.vfx.volumetrics folder inside the addons folder, and put it into your addons folder. If you don't have one, make one. After that, you go into your Project Settings to enable the addon, and you'll be good to go.

Note: you may have some errors involving some nodes not being found; don't worry. Those errors mean nothing and your project will work as usual.

How to use

Volumetric Fog <img src="addons/silicon.vfx.volumetrics/volumetric_fog.svg" alt="volumetric_fog" style="zoom:200%;" />

<img src="doc_images/volumetric_fog_inspector.png" alt="volumetric_fog_inspector" style="zoom:80%;" />

To start adding volumetric fog to your scene, you need to first add a VolumetricFog node to your scene (One per viewport). This node holds the properties responsible for how volumes in the scene get rendered.

Volume Proxy <img src="addons/silicon.vfx.volumetrics/volume_proxy.svg" alt="volume_proxy" style="zoom: 200%;" />

volume_proxy_inspector

After you've added the node mentioned above, the VolumeProxy node should now work for you and can be added to the scene. It has two properties.

Volumetric Material <img src="addons/silicon.vfx.volumetrics/material/volumetric_material.svg" alt="volumetric_material" style="zoom:200%;" />

volumetric_material_inspector

VolumeProxys use a VolumetricMaterial to change the way they appear. They are pretty basic right now, but should do for most practical situations. They have the following properties.

3D Texture Creator

3d texture creator

The plugin comes with a 3D Texture Creator so that you can easily give a little life to your fog volumes. More specifically, you can generate 3D noise textures. You can find this tool under Project -> Tools -> Create 3D Texture....

3d texture location

After setting up the texture (Each label has a tooltip for you), press the Create Texture button to save the texture to a location. If you're not overriding an existing texture, then you'll have to close and open the engine window to refresh the file manager. Then select the texture and setup the slices (you get the numbers from the texture creator). If the texture is being created for the first time, then it would be imported as a regular texture. You would need to manually reimport it as a Texture3D and restart the editor. And just like that, you should now have a 3D texture to use in your fog. :)

Demo

volumetrics demo

The project comes with a demo to see what can be done with the plugin. Each setting on the top right has a tooltip to tell you about what they do.

Here is a link to a video of the demo. https://youtu.be/5R1YU8vNa48

Other stuff

By default, all lights added to the scene affect volumes at the same strength, but you can adjust this strength for each individual light. Each one should now have a Volumetric Energy parameter. This can be used to strengthen or weaken the volumetric effect the light has, without changing the energy the light contributes to real geometry. If you want to do it by script then you must set it as a meta value.

set_meta("volumetric", energy_you_wanna_set_as)

Speaking of geometry, transparent geometries do not blend with volumetrics by default. You need to enable Apply Volumetrics to do that*. Like Volumetric Energy, this too is set as a meta value.

set_meta("apply_volumetrics", wanna_apply_it)

*Friendly tip, the volumes are displayed in the last render layer (Layer 20), and their render priorities are -16 and -17.

Limitations

Credits and Special Thanks

As stated at the start, this project is based on frostbite's approach to volumetric fog, but I also based my code off of how blender implemented it in their Eevee engine. Lastly, I was inspired to start this project in the first place by danilw's Volumetric Light demo. Go check it out. :smile: