-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Vulkan: SDFGI reflections appear to jitter when the camera rotates slowly #74633
Comments
This is due to limited precision from the algorithm used to calculate reflections (for performance reasons). I think the SDFGI rework will address this in some way, but I'm not sure how. |
SDFGI is flickering like wild on this particular mesh, for whatever reason. The whole interior is jittering with camera movement. Thought it might be helpful to attach the most severe case I've seen. |
As I see it, this bug means reflections are unusable in a project where the player has control of the camera. I dug in and got some explanation from devs and ai. Simplified Explanation: Now, the issue you're facing with the jittery reflections is likely due to the precision of this normal buffer. "Precision" refers to the detail level that the buffer can handle—think of it as the difference between drawing with a fine pen versus a chunky marker. When the precision is low, the engine can't accurately track the exact directions of surfaces, leading to errors in reflections, especially when the camera moves or rotates. One proposed solution is to use "octahedron mapping" for the normals instead of the current method. Octahedron mapping is a way of storing and processing normal vectors that can reduce errors and improve the precision without needing more memory. It basically allows for a more detailed representation of how surfaces are oriented by wrapping them around an octahedron shape. However, switching to octahedron mapping isn't straightforward because the normal buffer's data is directly available to users—who might be using this data for their own custom shaders or effects. Changing the format of this buffer would affect everyone who relies on the current system, so it's not a simple switch. Couldn't user shaders simply recalculate the normal under octahedron mapping? Yes, it is theoretically possible for a shader to recalculate the normal under octahedron mapping on the fly, although this would be an advanced technique and would involve additional computation that could impact performance, especially on less powerful hardware. Here's how you could think about implementing this in a shader:
While this process can potentially reduce the artifacts caused by low-precision normals, it requires that the shader do quite a bit of extra math. Shaders operate on the GPU and are run per-pixel for fragments or per-vertex for vertices, so this could add up to a significant amount of extra calculations, especially for complex scenes or high-resolution outputs. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Okay, time to end this conversation. It's going nowhere. Also worth noting, calling Godot devs "goons" is a violation of our code of conduct and is far below the expectations we have for people engaging in the community. Please be kinder in the future. |
Following up on this. I did a quick test using octahedral encoded normals to see if it improves the situation in the MRP and it does not. Accordingly, the source of the jitter is not low-precision normals, it is something else that needs to be investigated. |
This issue and #84746 pose the biggest hurdles to VoxelGI's viability in production in my tests. Everything else is rather small but these are the show-stoppers for many use cases. |
Godot version
4.0 Stable
System information
Windows 11, Nvidia RTX4070ti, AMD Ryzen7700x
Issue description
SDFGI reflections will visibly jitter with camera rotation, especially on materials with a metallic property of 1 and roughness property below 0.5. Will still occur on non-metallic materials.
This is visible at runtime as well as in the editor. It is not visible when panning/moving the camera laterally.
Steps to reproduce
Apply a reflective material to any object and observe the effect while the camera is being moved to "look around" with the mouse.
Alternatively, load MPR and observe reflective cubes while moving camera around.
Minimal reproduction project
SDFGI Reflection Jitter.zip
The text was updated successfully, but these errors were encountered: