Skip to content

Re-add optional OIDN denoise as an external executable. - #82832

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
bruvzg:oidn_external_exe
Oct 11, 2023
Merged

akien-mga merged 1 commit into
godotengine:masterfrom
bruvzg:oidn_external_exe

Conversation

@bruvzg

@bruvzg bruvzg commented Oct 5, 2023

Copy link
Copy Markdown
Member

Implements godotengine/godot-proposals#7640

Alternative variant #82831 (load dynamic library directly).

Pros: can use executables for the different architecture (there's no ARM64 prebuild version for macOS in official releases).
Cons: oidnDenoise is a sample implementation and command line arguments might change in feature releases, temporary images are written/read to disk.

@jcostello

Copy link
Copy Markdown
Contributor

How can I test this?

@bruvzg
bruvzg marked this pull request as ready for review October 6, 2023 13:39
@bruvzg
bruvzg requested review from a team as code owners October 6, 2023 13:39
Comment thread doc/classes/EditorSettings.xml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The path to the directory containing the OIDN denoise executable.
The path to the directory containing the Open Image Denoise (OIDN) executable, used optionally for denoising lightmaps. It can be downloaded from [url=https://www.openimagedenoise.org/downloads.html]openimagedenoise.org[/url].

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we might need some sort of special interface for all tools like this, like a dedicated "External tool manager" next to template manager. Which present the categorized list of all external tools, checks the current status of the tool (using both user configured location and normal PATH lookup) and maybe provide a button to download and automatically configure each tool.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great. The UX currently is really subpar, especially with Blender that throws a warning in new projects because it's enabled by default but the path isn't configured by default.

Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
@bruvzg
bruvzg force-pushed the oidn_external_exe branch from a0a7df0 to e5e53d2 Compare October 11, 2023 11:35
Comment thread doc/classes/ProjectSettings.xml Outdated
Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
@bruvzg
bruvzg force-pushed the oidn_external_exe branch from e5e53d2 to 4ebe621 Compare October 11, 2023 11:42
Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
@bruvzg
bruvzg force-pushed the oidn_external_exe branch from 4ebe621 to c238ffb Compare October 11, 2023 15:20

@akien-mga akien-mga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully on Linux with the Global Illumination demo.

Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
Comment thread doc/classes/EditorSettings.xml Outdated
Comment thread modules/lightmapper_rd/lightmapper_rd.cpp Outdated
Comment thread doc/classes/ProjectSettings.xml Outdated

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected. GPU acceleration is working correctly on NVIDIA with CUDA libraries installed on the system (confirmed by using watch -n1 nvidia-smi while baking lightmaps).

Testing project: test_lightmap_preview_bake_4.x.zip

No denoiser

Screenshot_20231011_173457

JNLM

Screenshot_20231011_173055

OIDN

There are more seams visible with OIDN, but the normal information in this scene is kind of broken due to regressions in the OBJ importer I need to bisect (these aren't new in 4.2).

Screenshot_20231011_173428

@akien-mga akien-mga modified the milestones: 4.x, 4.2 Oct 11, 2023

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention: LightmapGI's denoiser_strength documentation should note that it only has an effect when using the JNLM denoiser, not OIDN.

@bruvzg
bruvzg force-pushed the oidn_external_exe branch from c238ffb to 899e56d Compare October 11, 2023 16:52
@bruvzg

bruvzg commented Oct 11, 2023

Copy link
Copy Markdown
Member Author

Moved the check to the beginning of the bake function and changed the path to oidn_denoise_path.

@akien-mga
akien-mga merged commit efc0b08 into godotengine:master Oct 11, 2023
@akien-mga

Copy link
Copy Markdown
Member

Thanks!

@atafra

atafra commented Oct 13, 2023

Copy link
Copy Markdown

I wouldn't recommend using oidnDenoise for this. It was never meant to be used in production, it's just an example app. Also, you would need to keep writing and loading images from disk, which often would be much slower than actually denoising the image on the GPU. I think dynamically loading the library would make a lot more sense, both in terms of robustness and performance.

@Calinou

Calinou commented Oct 13, 2023

Copy link
Copy Markdown
Member

I think dynamically loading the library would make a lot more sense, both in terms of robustness and performance.

See #82831. This is indeed a better approach, but we need precompiled releases with ARM64 macOS libraries to be available for this approach to be viable.

@atafra

atafra commented Oct 13, 2023

Copy link
Copy Markdown

ARM64 macOS builds are planned to be added starting with the next OIDN release.

@bruvzg
bruvzg deleted the oidn_external_exe branch October 26, 2023 19:22
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Re-add optional OIDN denoise as an external executable.
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Re-add optional OIDN denoise as an external executable.
wangshucheng pushed a commit to wangshucheng/godot that referenced this pull request Aug 27, 2026
Re-add optional OIDN denoise as an external executable.
Shane-Gadsby pushed a commit to Shane-Gadsby/godotwebgpu that referenced this pull request Sep 21, 2026
Re-add optional OIDN denoise as an external executable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants