godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.17k stars 98 forks source link

Allow for baking of Volumetric Fog #7292

Open JD-The-65th opened 1 year ago

JD-The-65th commented 1 year ago

Describe the project you are working on

A VR physics game similar to Bonelab, with a futuristic Aesthetic

Describe the problem or limitation you are having in your project

Currently, there is no way to use Volumetric Fog using the Mobile Renderer. I was hoping that there would be a baked method, but I don't see anything.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Currently, there is no way to bake Volumetric Fog so that it can be used in projects that target less powerful hardware (like a Quest 2)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

For the front end stuff, Either a BakedFogVolume node can be added, or it could possibly be a Toggle in the LightmapGI for VolumetricFog nodes.

For the back end stuff, it can be achieved with 3D textures and Raymarching shaders, as shown in this unity asset.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It could possibly be achieved by making a custom shader, but it'd be way more complicated than having a built in tool.

Is there a reason why this should be core and not an add-on in the asset library?

This could integrate deeper with already preexisting baking tools, and I haven't seen any Baking addons made for Godot (at a first glance)

Calinou commented 1 year ago

This is not technically feasible due to how Godot's volumetric fog works. What's the most expensive in its implementation anyway is not processing the volumetric fog's volumes, but rendering it. Godot's volumetric fog also has a heavy reliance on compute shaders, which are poorly supported on mobile devices due to driver issues and low performance.

There is already a workaround mentioned in the documentation for volumetric fog in Mobile/Compatibility: https://docs.godotengine.org/en/stable/tutorials/3d/volumetric_fog.html#faking-volumetric-fog-using-quads It is not usable in every scenario you'd use volumetric fog for, but with some creativity, you can do a lot of things with it. Remember that fillrate is at a premium in VR though (especially on Quest 2), so don't use that technique with fog sprites that are close to the camera.