Godot Volumetrics Plugin

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?

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.

  • Analytic fog :- An oldy but a goody, this blends a solid colour onto the scene based on depth, and sometimes height. It's easy to calculate, but usually doesn't interact with lights in the scene.

  • Billboard sprites :- Semi-transparent sprites that always face the viewer can do a good job of simulating fire, clouds and smoke. The illusion can break however if viewed from multiple angles, or intersects any geometry, revealing the true nature of the billboard sprites.

  • Screen space postprocessing :- Using what's on screen, this technique is pretty versatile and allows you to render a variety of volumetric effects. However, as the name implies, the effect is limited by what's visible.

  • Voxel based volumetric fog :- The technique implemented here.

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 volumetric_fog

volumetric_fog_inspector

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.

  • Start:- The closest point to where volumes appear.
  • End :- The farthest point to where volumes appear.
  • Tile Size :- The size of each tile in the 3D textures used to render the effect. A smaller number allows finer detail, but can severely reduce performance.
  • Samples :- The number of layers used to render the volumes. A larger number allows more detail along the depth of the scene, but can reduce performance.
  • Distribution :- How much the volume layers get packed close to the Start distance. A value of zero means equal distribution, while a value of one distributes the layers closer to the viewer, giving more detail close up than farther away.
  • Temporal Blending :- How much the effect blends with the previous frame. A higher value can smooth the effect more, but is more susceptible to ghosting artifacts. Setting it to zero disables blending altogether.
  • Volumetric Shadows :- Enabling this allows volumes in view to cast shadows on themselves (Not on geometry though).
  • Shadow Atlas Size :- How much resolution is used to render the shadows of lights. Does not affect Volumetric Shadows.
  • Ambient Light Color :- The color of the ambient light applied to volumes.
  • Ambient Light Energy :- How much the ambient light is applied to volumes.
  • Cull Mask :- This determines what lights get processed in the effect. Lights whose layers don't match up with this will not show up in the fog.

Volume Proxy volume_proxy

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.

  • Material :- Determines the apparent properties of the volume.
  • Bounds Mode :- The shape of volume's borders
    • Global :- No borders at all. Only one VolumeProxy can be global at a time.
    • Local Box :- The border's shaped like a cuboid.
    • Local Sphere :- The border's shaped like an ellipsoid.
  • Extents :- The region in which the volume is rendered (with a local bounds mode).
  • Bounds Fade :- How faded the bounds of the volume is.

Volumetric Material volumetric_material

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.

  • Scatter Color :- The color of the volume.
  • Density :- How thick the volume is.
  • Scatter Texture :- A texture applied to the volume's color.
  • Absorption Color :- The color appears as light get's absorbed by the volume. Visible when used in conjunction with Volumetric Shadows.
  • Anisotropy :- How light is scattered through the volume. Positive values tend to scatter light towards the viewer, while negative scatters light away from the viewer.
  • Emission Enabled :- Whether to use emission in the volume.
  • Emission Color :- The color of the emission in the volume.
  • Emission Strength :- How strong the emission is.
  • Emission Texture :- A texture applied to the volume's emission.
  • Uvw Scale :- The scale factor of the uvw texture coordinates.
  • Uvw Offset :- The offset of the uvw texture coordinates.

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.

  • You look around with the mouse and move with the arrow keys.
  • To see your mouse again, press the Esc key.
  • You can also hide the GUI with G.
  • To exit the demo, you press Shift+Esc.

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

  • Orthographic camera projection is not supported.
  • The support of transparent materials is limited, as only some of the material properties are supported. The ones that are supported are: Material Override, Material in CSGPrimitives, and Materials in MeshInstances(Not to be confused with the material inside meshes).
  • It doesn't show up in reflection probes.
  • It doesn't get lit by indirect light sources (GIProbes and BakedLights).

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. 😄

Owner
Roujel Williams
I like to work on games, 3D graphics and simulations. They are just so fascinating. 💻💻
Roujel Williams
Comments
  • plugin broken on 3.2.2

    plugin broken on 3.2.2

    tried on a custom build of the 3.2.3.rc but it didn't work. tried the demo project using 3.2.2 64x off the website but this doesn't work either. the scripts produce errors in the editor and in game.

    res://addons/silicon.vfx.volumetrics/volumetric_server.gd:199 - Invalid get index 'camera' (on base: 'Node (volumetric_renderer.gd)').

    this pops up every frame in the editor. which makes it hard to copy the other errors, other than by hand. the other errors include defining already existing variables, assigning nil values to integers, "nonexistant func 'add_light' in base 'node'".

  • Volume doesn't render when under viewport node

    Volume doesn't render when under viewport node

    When fog is placed under a viewport node it will not render using that viewport, and repeatedly outputs the following error:

    res://addons/silicon.vfx.volumetrics/renderer/volumetric_renderer.gd:304 - Invalid get index '24' (on base: 'Dictionary').
    

    The index in the error changes periodically.

    The 3D scene: Screenshot (2)

    The 3D scene instanced under a viewport node: Screenshot (3)

    I've made a minimal reproduction project at https://github.com/benjarmstrong/volumetricsviewport

    Tested on Godot 3.2.1-stable on Windows 10

  • Can't generate new VolumeProxy Material on Godot 3.2.4 (beta 4)

    Can't generate new VolumeProxy Material on Godot 3.2.4 (beta 4)

    Perhaps this will fix itself for the official release so just a heads up for a potential problem. I had to revert to 3.2.3 to generate new VolumeProxy Materials.

  • Can I use this plugin to load a volumetric 3D texture ?

    Can I use this plugin to load a volumetric 3D texture ?

    Hi, I've seen your previous plugin: https://github.com/SIsilicon/Volume-Renderer

    And in it, you load a 2D texture, tile it, and use multiple slices as a 3D texture. But that was before Texture3D in Godot so that was crafty !

    Now, I am looking to port a project of mine which allows the visualization of scientific 3D volumetric datasets (mainly microscopy images for now) into Godot. I made it in Unity, but hell Unity is a pain, and I just can't stand the whole .Net universe ! I'd rather write code in C++ and GDscript ! For a quick look at what it did (that was a while ago and I'm trying to revive it) https://www.youtube.com/watch?v=oS-imSO0qFY

    To do that I used a Ray Marching shader in Unity, but I have to admit, I shamelessly reused someone's shader without understanding it. 2 years later, I am trying to learn to write such a shader from scratch in Godot, and well I am banging my head quite a bit ... I can get as far as Signed Distance function, but even then I have trouble setting the Ray Origin ... But I digress !!!

    So, is there a way to use this plugin to load a 3D texture ? If so, what format should it be in ? RAW ? PNG slices ? Tiled PNG (that one won't work for me, I mean the datasets I have are a bit massive)

    Thanks a lot !

    PS: in your opinion, does Godot have the performances required for a VR volumetric renderer ?

  • Volumetrics overlay not working in editor viewport (3.2.1-stable)

    Volumetrics overlay not working in editor viewport (3.2.1-stable)

    I have encountered a problem when using a non-default name_casing in project settings. What is strange only editor viewport is affected, after starting any scene the volumetrics work.

    This might be a problem with Godot itself, but for anyone who experiences this, the temp solution is to change name_casing to default "PascalCase" under ProjectSettings, and restart Godot.

    These errors are echoed before running any scene:

    ERROR: Node not found: LightScatter. At: scene\main\node.cpp:1381 ERROR: ViewportTexture: Path to node is invalid. At: scene\main\viewport.cpp:69 ERROR: Node not found: LightTransmit. At: scene\main\node.cpp:1381 ERROR: ViewportTexture: Path to node is invalid. At: scene\main\viewport.cpp:69 ERROR: Node not found: . At: scene\main\node.cpp:1381 ERROR: ViewportTexture: Path to node is invalid. At: scene\main\viewport.cpp:69

  • Moving VolumeProxy node in scene tree breaks the fog created by that volume

    Moving VolumeProxy node in scene tree breaks the fog created by that volume

    If, after creating the VolumetricFog node and VolumeProxy, the VolumeProxy gets moved in the scene tree hierarchy, the fog created by VolumeProxy dissapears.

Feb 10, 2022
Cf-cli-find-app-plugin - CF CLI plugin to find applications containing a search string

Overview This cf cli plugin allows users to search for application names that co

Jan 3, 2022
Twitter-plugin - Falco Plugin for Twitter Stream

Twitter Plugin This repository contains the twittter plugin for Falco, which fol

Mar 17, 2022
A Go library for connecting to HandlerSocket (github.com/ahiguti/HandlerSocket-Plugin-for-MySQL)

handlersocket-go Go library for connecting to HandlerSocket Mysql plugin. See github.com/ahiguti/HandlerSocket-Plugin-for-MySQL/ Installation $ go get

Jan 19, 2021
Yet another SIP003 plugin for shadowsocks, based on Xray-core

Yet another SIP003 plugin for shadowsocks, based on Xray-core Build go build Usage See command line args for advanced usages.

Jan 8, 2023
DipDup plugin for selective metadata indexing

DipDup metadata indexer DipDup service for indexing contract and token metadata. Based on TzKT indexer. For start synchronization of DipDup state TzKT

Nov 25, 2022
Tool for monitoring network devices (mainly using SNMP) - monitoring check plugin
Tool for monitoring network devices (mainly using SNMP) - monitoring check plugin

Thola Description A tool for monitoring network devices written in Go. It features a check mode which complies with the monitoring plugins development

Dec 29, 2022
Protoc plugin to generate contract tests for gRPC in Go

Deal - Go Introduction WE DO NOT SUPPORT THE SERVER SIDE YET This plugin allows us to write Consumer-Driver Contracts tests! Usage example Proto servi

Sep 3, 2022
This plugin allows you to start a local server with hot reloading with Esbuild

esbuild-dev-server This plugin allows you to start a local server with hot reloading with Esbuild Installation npm npm i esbuild-dev-server -D yarn y

Nov 4, 2022
A Caddy v2 plugin to track requests in Pirsch analytics

caddy-pirsch-plugin A Caddy v2 plugin to track requests in Pirsch Analytics. Usage pirsch [<matcher>] { client_id <pirsch-client-id> client_se

Sep 15, 2022
Yet another SIP003 plugin for shadowsocks, based on v2ray

Yet another SIP003 plugin for shadowsocks, based on v2ray Build go build Alternatively, you can grab the latest nightly from Circle CI by logging into

Oct 20, 2021
Naive LEGO helper for SberCloud DNS to be used with the EXEC plugin

Naive LEGO helper for SberCloud DNS Very basic, no any checks performed To be used with the exec plugin as described here Environment variables SBC_AC

Nov 3, 2021
Coredns plugin for relaying .local domains

CoreDNS Local_Query This is a plugin for coredns that was developed to allow for the use of naked hosts in place of .local domains i.e example.local b

Nov 4, 2021
Developing a Traefik plugin using golang

Developing a Traefik plugin Traefik plugins are developed using the Go language. A Traefik middleware plugin is just a Go package that provides an htt

Nov 21, 2021
A plugin of protoc that for using a service of Protocol Buffers as http.Handler definition

protoc-gen-gohttp protoc-gen-gohttp is a plugin of protoc that for using a service of Protocol Buffers as http.Handler definition. The generated inter

Dec 9, 2021
Matterbridge mattermost plugin

mattermost-plugin Matterbridge mattermost plugin WIP Configuration You have to create a matterbridge.toml configuration file before running make. Beca

Dec 11, 2022
Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.
Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.

Powered by Matterbridge, MatterAMXX is a plugin for AMXX that allows simple bridging between your game servers, Mattermost, IRC, XMPP, Gitter, Slack, Discord, Telegram, and more.

Dec 27, 2022
Matterbridge API plugin for Reddit Community Chat

Mattereddit 2 Mattereddit is a Matterbridge API plugin allowing you to connect Reddit group chats to the various chat services supported by Matterbrid

Sep 13, 2022
🤖 Automatically scrape PortableApps.com (or official release page) and convert into Edgeless plugin package

Edgeless 自动插件机器人 2 简介 该项目是为了使用 Golang 重新实现 Edgeless 自动插件机器人 特性 (WIP) 完全兼容 Edgeless 自动插件机器人,包括 Tasks,以实现无缝迁移 更快的构建速度 更好的代码结构 更高的拓展性 工作进度 截止至 2021/11/28

Sep 12, 2022