-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDFGI propagating light to other scenes and reflections (also not updating until movement) #81028
Comments
Looks like the SDFGI should be reset when changing scenes in the editor, I guess it's not happening at the moment. Usually people reset their SDFGI environments manually when they change their scenes inside their game, usually by disabling it and then enabling it a frame or so later (for example using As for the update, see #54892. You can also use Editor Settings to enable Update Continuosly. However, because the issue is pretty easy to work around, this hasn't been done yet. In editor, you could also create a tool script to do this manually. For example, in you Edit 2 better base example, you could do something like this to clear SDFGI when changing scenes: func _ready():
var world = get_node("world/WorldEnvironment") as WorldEnvironment
await get_tree().process_frame
world.environment.sdfgi_enabled = true
await get_tree().create_timer(waitTime).timeout
var checkScene :String= "res://" + newScene + ".tscn"
world.environment.sdfgi_enabled = false
if FileAccess.file_exists(checkScene):
get_tree().change_scene_to_file(checkScene) You can see some random color glitches while toggling SDFGI off and on, they should be fixed by #80889 The glitches can look something like this: |
Thank you, the script you sent works well at resetting the scene. Nice to see that there are some workarounds and fixes for it currently. I also did not realize that SDFGI could not do dynamic objects / lights. Is there an estimation of when that feature will come about? |
There have been plans for a big SDFGI refactoring for a while, so hopefully it happens at some point. Also, SDFGI does support dynamic lights, just not dynamic objects like meshes, occluders etc. See https://docs.godotengine.org/en/latest/tutorials/3d/global_illumination/using_sdfgi.html
If you want more flexibility, you can try alternative GI solutions like VoxelGI, which supports dynamic objects although it needs to be pre-baked and there is performance cost. |
This is expected. SDFGI supports dynamic lights, but not dynamic occluders. A rewrite of SDFGI is planned at some point in the future, but not for 4.2. |
So if I understand correctly SDFGI currently does some dynamics, but if I want to do dynamic emissive material lights I would need to use VoxelGI. I will have to do some tests, because I will heavily need to use dynamic emissive lights in my project. I am still familiarizing myself with all of this, The only comparison I have is to UE5 (which I do not know if it can do dynamic emissive in that but I think so) For now though I will test VoxelGI and see what results I can get from it. Thank you both for the clarification and help. |
Note that dynamic objects in VoxelGI are slow, so I don't recommend using dynamic objects in VoxelGI until this is fixed: #55359 Until then, I recommend not using a dynamic object system and just parenting some OmniLights or SpotLights to your emissive objects. It's not the same, but with some tweaking, you can get it to look close enough (and with better performance and less noise to boot). |
I wondered if I would need to do that to get the performance. Thank you for the information. |
As someone using SDFGI, it's not immediately apparent that on a full scene swap you need to do this. Is there any consideration for a clearer function for this (i.e. not disabling, then enabling a frame later), some documentation on this requirement (it's not obvious why you'd need to reset the SDFGI if you're loading a clean new scene with it's own SDFGI on the WorldEnvironment), or some other third solution (i.e. automatically processing the disabled/enabled when you scene swap)? |
|
Godot version
v4.1.1.stable.official [bd6af8e]
System information
Godot v4.1.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Ti Laptop GPU (NVIDIA; 31.0.15.3713) - 12th Gen Intel(R) Core(TM) i9-12900H (20 Threads)
Issue description
I was expecting the SDFGI to update constantly in the scene, but it only does when moving the 3d camera around.
It also will send emission light to other scenes and reflections. It will stay in the reflections until that instance is checked again.
I posted a long video of it here, but the short video below is the main thing:
https://pixeldrain.com/u/9bVF7xPy
I have been testing with various elements to get good emission materials that light up the scene. At first I could not get it to work so added some spotlight and volume fog to fake it. (Those are still in the ship scene just not visible) But with an emission material at high enough energy and sdfgi and glow on it does mostly what I expect, but also sends the emission light to other scene tabs. Only in the viewer not when running it as the game though.
Steps to reproduce
Short video of the steps:
https://github.com/godotengine/godot/assets/43964088/cd6dc2ed-56b6-4d84-9bb7-ad036a621c08
(you may want to move the 3d camera around in each scene to get the full effect)
goto the lightemit scene
then the lighttest scene
then the test scene
from there you will see the red on the plane and the red reflected in the ship
the red in the reflection will stay even when moving the 3d camera around
for that to go away goto the ship scene and then back to the test scene
Minimal reproduction project
Here is the scene I have been working with in the video:
https://pixeldrain.com/u/gBmokbbz
Edit 1 simpler example scene:
After some further testing here is a basic scene, (not using the spaceship model I made):
sdfgi test2.zip
I will record another video of it tomorrow if need be but it follows the same principle:
with each step move the 3d view some:
to clear load "reflect"
You will see the cube reflected in the sphere and the glow as well.
Edit 2 better base example:
I added a camera to show off the blow out effect.
I also added a script to change scene between the 2 test scene, and it also shows the reflection running the game too.
Here is the video and project file for it:
sdfgi test3.zip
2023-08-27.08-13-20.mp4
The text was updated successfully, but these errors were encountered: