-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Use OpenImageDenoise via the command line to benefit from GPU-based LightmapGI denoising #7640
Comments
Isn't it better to load oidn's dynamic library using dlopen/LoadLibrary instead of using it from command line? in this way data buffers can be pass directly to it so OpenEXR issue will be solved. |
Dynamic linking only solves part of the problem here, as we still need to compile and link the OIDN library on the same system the Godot executable was built (due to Linux binary compatibility issues). Also, we want the Godot editor to be distributable as a single binary with no dependencies on other files. This allows you to run it directly from a ZIP archive that hasn't been extracted, for instance. (People frequently do that, even if you don't necessarily do it yourself 🙂) That said, godotengine/godot#81659 has been progressing a lot so it should provide a pretty good fallback if you don't want to set up OIDN. |
I mean something like how Godot works with blender or fbx files:
Current CLI application in distribution of OIDN linked to dynamic libraries in its lib directory and not static ones so we need build it anyway. |
Implemented in godotengine/godot#81659. |
To clarify, godotengine/godot#81659 doesn't implement OIDN CLI but provides an alternative GPU-based denoiser that is pretty effective (while being much faster than our current implementation). It also doesn't require installing any additional software to work (not even a CUDA/HIP/Sycl setup as the OIDN CLI requires). We consider this to be a satisfactory solution, but we may explore adding support for OIDN CLI if there is a strong need for it. |
Should this be reopened, then? |
No, as we don't expect this proposal to be relevant in the near future (as I said in my comment). |
Sorry for the confusion that I caused here, got lost in the abbreviations 😅 We can reopen it to track that we still want to offer OIDN via an external executable. |
Implemented by godotengine/godot#82832. |
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Godot currently supports denoising lightmaps using OpenImageDenoise (OIDN), but this is slow for 3 reasons:
Describe the feature / enhancement and how it helps to overcome the problem or limitation
There are many advantages to using OIDN via the command line:
Performance results on Linux:
Denoising a 4K lightmap goes from a several seconds operation to a near-instant one. Even if your GPU is 10 times slower in compute than a RTX 4090, it'll still handily beat the i9-13900K in this test.
System VRAM utilization doesn't exceed 5.3 GB with the 4K lightmap denoise, so it looks like 8 GB GPUs should handle this fine (perhaps 6 GB for smaller lightmaps – remember that the editor will be running at the same time).
There are some caveats though:
This proposal effectively supersedes godotengine/godot#47344, as OIDN would become an external program called by Godot, similar to FBX2glTF (for
.fbx
import) and Blender (for.blend
import).It's also been mentioned that we could use an algorithm such as this one or this one as a fallback to OIDN when the CLI binary isn't installed. This can be implemented as a Vulkan compute shader to provide universal GPU acceleration.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
oidnDenoise
) is configured in the Editor Settings and the binary is indeed present, write lightmaps to a temporary location instead of writing them in the project folder.If this enhancement will not be used often, can it be worked around with a few lines of script?
This can be worked around by disabling Use Denoiser in LightmapGI and calling the above command line, but it must be done manually every time after baking lightmaps. Using watchexec can improve this somewhat, but you still need to start it every time you open the project in the editor.
If you do this, the lightmap texture will also be imported twice by the Godot editor (once in its non-denoised form, once in its denoised form). This further slows down the lightmap baking process, especially if VRAM compression is enabled on the lightmap texture. Writing the non-denoised lightmap to a temporary location prevents this issue, but it can't be done from the Godot editor itself.
Is there a reason why this should be core and not an add-on in the asset library?
This can't be worked around with an add-on efficiently (see above).
The text was updated successfully, but these errors were encountered: