Skip to content
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

Implement caching in SDFGI to avoid stuttering when the camera is moving #3024

Open
Tracked by #55327
mrjustaguy opened this issue Jul 21, 2021 · 5 comments · May be fixed by godotengine/godot#86267
Open
Tracked by #55327

Implement caching in SDFGI to avoid stuttering when the camera is moving #3024

mrjustaguy opened this issue Jul 21, 2021 · 5 comments · May be fixed by godotengine/godot#86267

Comments

@mrjustaguy
Copy link

Describe the project you are working on

a Somewhat Open-World style map

Describe the problem or limitation you are having in your project

SDFGI Cascade switching is very slow, and weaker hardware cannot do it real time.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Allow for SDF Cascades to be cached. There are several different ways this could be done, and multiple of those at the same time..

  1. Compute them all for a given area offline (Beats the point of SDFGI's main selling point a little, but on the other hand would beat having to place multiple VoxelGI nodes around the scene, and could still compute when you're outside of the premade caches)
  2. Compute the next possible cascade transitions into cache while the GPU is idling (This would work great in instances where you Know the targeted Framerate, and how much time the GPU is not doing anything, and when you aren't quickly moving through cascades, which even on weaker hardware shouldn't be too bad at least for 4 cascades, as for example a GTX 650 needs 66ms to do the whole cascade switching thing at 4 cascades, which is about 1/60th of a second per full cascade, if it can do like a quarter of a cascade per frame at 60FPS, it would mean the player could move seamlessly between cascades every couple of seconds even on such a weak GPU)
  3. Compute several cascade transitions away, which is a real-time blend of the first two, that would while idle be working on computing several cascades away while the GPU is idling (This would work best in instances where the player is moving a little for a short period of time, and then moving several cascades worth within frames of time, and then again not moving much for a short period of time)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

for 1) it'd be something like Voxel GI to set the areas, and then bake... for the rest... it's fairly self explanatory, and needs more technical knowhow to get a good diagram of what's going on.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

SDFGI is core

@Calinou
Copy link
Member

Calinou commented Jul 21, 2021

SDFGI is planned to get a rework after 4.0 is released, but I don't know if caching is part of the plan. There are various caveats associated with caching that would make it less general-purpose, so finding other ways to speed up SDFGI should be investigated first.

@mrjustaguy
Copy link
Author

the number 1 priority with speeding up SDFGI is speeding up Cascade jumping in some way, as it is the slowdowns caused by that that can give a bad experience, aside from that it runs fairly well even on a decade low end system (30-60 fps range on lower settings on a decade old 50 series, or a comparable mid range modern APU)

@Calinou Calinou changed the title Implement SDF Caching Implement caching in SDFGI to avoid slowdowns when the camera is moving Jul 22, 2021
@Calinou Calinou changed the title Implement caching in SDFGI to avoid slowdowns when the camera is moving Implement caching in SDFGI to avoid stuttering when the camera is moving Jul 22, 2021
@Calinou Calinou added this to the 4.x milestone Aug 8, 2021
@OctagonalHexy
Copy link

If the rework of SDFGI/VoxelGI is combining the two like is mentioned in #6352 then use case 1 may already be fulfilled by VoxelGI.

As far as uses 2 and 3 I think that if your idea of using extra frame time to cache lower cascades before their visible is awesome!

I do wonder how A something like that might interact with other systems that can make use of spare frame time when its available.
Maybe the max_fps setting could have A min_fps counterpart?

@Capewearer
Copy link

Could this issue be closed, since SDFGI gets replaced with HDDAGI?

@Calinou
Copy link
Member

Calinou commented Apr 10, 2024

Could this issue be closed, since SDFGI gets replaced with HDDAGI?

godotengine/godot#86267 hasn't been merged yet, but this proposal can be closed once it's merged.

@Calinou Calinou linked a pull request Apr 10, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants