Skip to content

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.

@github-actions
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.

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