godotengine / godot-proposals

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

Allow setting volumetric fog anisotropy on a per-volume basis #6603

Open atirut-w opened 1 year ago

atirut-w commented 1 year ago

Describe the project you are working on

N/A

Describe the problem or limitation you are having in your project

As of 4.0, the aniso value for volumetric fogs are globally set and applies to both global and local(fog volume). This prevents combining multiple types of fog like, for example, global atmospheric fog(high anisotropy) and smoke effects(low anisotropy).

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

This will allow games to use realistic smoke or other kind of local volumetric fog without sacrificing global fog or vice versa.

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

Add anisotropy output to fog shaders and expose it for fog materials.

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

Rendering is core

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

See above

Calinou commented 1 year ago

I'm not sure if we still have bytes available to store this information in the per-froxel data (the frustum-aligned voxels generated by FogVolumes). The anisotropy level would require just 1 byte to store (as the data can be interpolated), but still.

clayjohn commented 1 year ago

When adding fog volumes I considered storing anisotropy on a per-volume basis but decided against it in the end as most engines just used a global parameter.

My opinion is that we should add it if there is enough demand for it (we can cram it in with density which doesn't need the full 32 bits).