godotengine / godot

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

GIProbe does not function properly when used on Gridmaps. #60240

Open EzraT opened 2 years ago

EzraT commented 2 years ago

Godot version

v3.5.beta3.official

System information

GLES3 - All supported operating systems/GPU's.

Issue description

This is a compilation of my findings from some other issue's discussing problems with GridMaps and GIProbe lighting. I thought it'd be a good idea to make a separate issue detailing this information, for clarity, as its scattered in the 2 different issues.

Sources: #18056, #18836

As explained here, there is a very clear difference to how GIProbe looks on regular MeshInstances and on GridMaps.

My hunch is that for whatever reason, perhaps because of a bug or an oversight, GIProbe is not applying the proper Bias value on GridMaps, which I explain further here.

The GIProbe lighting in the scene with just MeshInstances starts to look exactly the same as the one with GridMaps, when you turn the Bias in GIProbe down to 0. It's as if the Bias on GridMaps is always 0, regardless of what is actually set in the GIProbe.

I hope this can be fixed because its quite a bummer GIProbe currently does not work with GridMaps.

Steps to reproduce

  1. Download the MRP and compare the 2 different scenes provided.
  2. In the scene that demonstrates only MeshInstances, select the GIProbe node and turn down the Bias value to 0.

Minimal reproduction project

Minimal Reproduction Project

Calinou commented 2 years ago

As I understand it, the GIProbe bias and normal bias properties are only used in the shader, not in C++ code during baking. Therefore, you can change those properties in GIProbeData without having to bake the GIProbe again to see the results.

The uniforms are set here: https://github.com/godotengine/godot/blob/b6968ab0602bfe72c71d4efcafe608f9cac36252/drivers/gles3/rasterizer_scene_gles3.cpp#L1861-L1862

PS: Does the same issue occur with the Normal Bias property? Try setting Bias to 0.0 and Normal Bias to 1.0, then compare a MeshInstance and a GridMap.

EzraT commented 2 years ago

Its the same story for Normal Bias. In the scene with the GridMap, both Bias and Normal Bias appear to do nothing, while in the scene with the MeshInstances they both function like you would expect it to.