godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.16k stars 21.2k forks source link

Vulkan: SDFGI has artifacts on off-axis geometry due to bias being too low #62671

Open WickedInsignia opened 2 years ago

WickedInsignia commented 2 years ago

Godot version

4.0 Alpha 11

System information

Windows 10, GTX1080, i7 6700

Issue description

Geometry that is not flat on the X, Y or Z axes will create noticeable lighting artefacts and sudden unrealistic shifts in lighting. This occurs with geometry that is modeled with polygons at any angle other than flat in X, Y, or Z in global space, and any objects that are rotated to become off-axis.

This is reduced but not resolved by reducing Cascades count and increasing Min Cell Size. These adjustments simply reduce the frequency but they still persist on a large scale. VoxelGI can not be used since it has its own (arguably more severe) problems with off-axis geometry.

On-axis geometry: SDFGI_AxisArtifactsBug01

Off-axis geometry. Notice the extreme bright spots, sharp tonal shifts and strongly occluded corners: SDFGI_AxisArtifactsBug02 SDFGI_AxisArtifactsBug03

Steps to reproduce

Minimal reproduction project

SDFGI_OffAxisArtifactsBug.zip

Calinou commented 2 years ago

Like with VoxelGI, you need to increase the normal bias and probe bias values if you have large spans of off-axis geometry. That said, artifacting becomes less noticeable as you add complex textures to your materials.

Allowing the rotation of the entire SDFGI grid could help in those cases, but this depends on how your level is designed. (For reference, this is already possible with VoxelGI by rotating the node.)

If this kind of artifact is absolutely unacceptable, then consider using lightmaps or faking GI with secondary light sources instead (that is, lights with high range, low energy, no shadows and Specular set to 0).

WickedInsignia commented 1 year ago

Unfortunately normal bias doesn’t really help, it just shifts the same problem into other areas. Pushing probe bias to the point that the issue is acceptable nullifies the value of GI almost completely. This is a fundamental issue with SDFGI, changing bias doesn’t solve it.

Complex textures can help, but dark probes inside of geometry will “radiate” strong darkness across the normal map of PBR materials, effectively mooting the point of using complex materials to disguise it. This kind of boxy geo is one thing but SDFGI absolutely will not play nice with a sphere or large curved surface.