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

Nodes: Add DenoiseNode. #28879

Merged
merged 2 commits into from
Jul 15, 2024
Merged

Nodes: Add DenoiseNode. #28879

merged 2 commits into from
Jul 15, 2024

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 15, 2024

Related issue: -

Description

This PR adds DenoiseNode which is a port of PoissonDenoiseShader. It can be used to improve the result of AO by smoothing out the noisy appearance of the default occlusion.

I'll integrate it in the AO demo with a configurable GUI when #28863 is done. GTAOPass must return the raw AO so DenoiseNode can be chained after it (but before the blend).

For comparison:

With Denoise:

image

Without Denoise:

image

const sampleNormal = ( uv ) => this.normalNode.uv( uv );
const sampleNoise = ( uv ) => this.noiseNode.uv( uv );

const getViewPosition = tslFn( ( [ screenPosition, depth ] ) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the second pass where getViewPosition() is used. Now the time seems right to add a utility function somewhere as previously discussed in #28844.

Copy link

github-actions bot commented Jul 15, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.7 kB (111.1 kB) 460.7 kB (111.1 kB) +0 B

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Jul 15, 2024

Sidenote: When creating an instance of DenoiseNode, it is the responsibility of the caller to provide a noise texture. Otherwise I would have to add SimplexNoise to the core which seems inappropriate. When integrating DenoiseNode in webgpu_postprocessing_ao I'll add a generateNoise() function.

@Mugen87 Mugen87 added this to the r167 milestone Jul 15, 2024
@Mugen87 Mugen87 merged commit f62bb8d into mrdoob:dev Jul 15, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant