godotengine / godot

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

SDFGI doesn't update Mesh instances correctly in the editor #75334

Open albinaask opened 1 year ago

albinaask commented 1 year ago

Godot version

4.0.1

System information

Windows 11, Vulkan, whatever graphics is included in intel i5-8265U

Issue description

The SDFGI cascades aren't updating correctly when properties of Mesh instances are updated, i.e visibility, position etc. See video:

https://user-images.githubusercontent.com/11806563/227746411-15c2141c-78f7-496e-b71b-e7c3adedd24f.mp4

The user is looking into a mirror material at other objects

Steps to reproduce

  1. Open godot 4.0
  2. Move temp.tres from scene.zip to project folder
  3. Open scene in editor
  4. Position camera looking into the reflective node with the other nodes behind the camera.
  5. View bug as in video.
  6. Cry.
  7. Fix bug.
  8. Live a long and prosperous life.

Minimal reproduction project

scene.zip

Calinou commented 1 year ago

SDFGI doesn't support dynamic objects yet. This would need to be added, and you'd have to make objects dynamic for it to work on those objects.

For static objects in the editor, the SDFGI data could be invalidated when a change is made in the editor after a certain amount of time with no changes has passed (debouncing). This would require https://github.com/godotengine/godot-proposals/issues/7741 to be implemented first.

Full invalidation could also be performed automatically after a long operation in the editor, such as a 3D scene being reimported, VoxelGI bake or LightmapGI bake. https://github.com/godotengine/godot/pull/86267 makes computing cascades much faster, so it should be more affordable to do so in the future.

albinaask commented 1 year ago

An alternative is to just have a button to update the data or do an update on scene save.

HydrogenC commented 10 months ago

SDFGI doesn't support dynamic objects yet. This would need to be added, and you'd have to make objects dynamic for it to work on those objects.

Thanks for your explaining. Is there currently a plan on this, for example, planned for 4.x?

Calinou commented 10 months ago

Thanks for your explaining. Is there currently a plan on this, for example, planned for 4.x?

A SDFGI rework is planned in the long term. That said, this can already be fixed by invalidating SDFGI data after a certain amount of time has passed as I mentioned.

Also, marking objects as dynamic just to fix this issue would be a bad way to resolve the issue on a performance standpoint (dynamic GI is much more expensive than static GI).