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

Add OIDN Denoiser. #663

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fbd547c
Before changing shader
DennisSmolek Jul 23, 2024
ce96244
adding params
DennisSmolek Jul 23, 2024
a4518be
Base working
DennisSmolek Jul 24, 2024
a3aff4d
Removed odd imports and old args format for AlbedoNormalPass
DennisSmolek Jul 24, 2024
0d80c5e
Move class external
DennisSmolek Jul 24, 2024
f4bb58a
Simplify Example
DennisSmolek Jul 24, 2024
fdcf7fc
Colors correct
DennisSmolek Jul 24, 2024
e581ea2
Material Pool added
DennisSmolek Jul 25, 2024
963bbdf
Fix weightsURL Recursion
DennisSmolek Jul 25, 2024
8617646
Added reset to materialPool
DennisSmolek Jul 25, 2024
38d1c4e
Wire up albedo pass dispose
DennisSmolek Jul 25, 2024
80efd02
Denoiser example added, Index example simplified
DennisSmolek Jul 25, 2024
b5c3f78
Colors looking correct
DennisSmolek Jul 26, 2024
a4b7d54
Remove odd imports
DennisSmolek Jul 26, 2024
3150245
Use build in materials for color conversion, fix denoiser blocking fa…
gkjohnson Jul 26, 2024
de9d9de
Variable rename, remove unneeded premultiply alpha flag
gkjohnson Jul 26, 2024
03c24fa
Examples updated and added denoising progress
DennisSmolek Jul 26, 2024
5ca50d7
Reverted Index HTML
DennisSmolek Jul 26, 2024
9e43cd4
Revert using terminal
DennisSmolek Jul 26, 2024
2cf2297
Merge commit '9e43cd4f85e17edec505ad522c1588cf6f59851f' into oidn-mat…
gkjohnson Jul 27, 2024
faa1790
remove extra conflict
gkjohnson Jul 27, 2024
ef9f341
Add support for partial transparency, fix background in normal pass
gkjohnson Jul 27, 2024
f1c8ec5
Merge pull request #1 from gkjohnson/oidn-material-updates
DennisSmolek Jul 27, 2024
547b819
Update color copy
gkjohnson Jul 27, 2024
5f539c7
Merge commit 'f1c8ec561575f800fb191414f42151dbe25187f4' into oidn-imp…
gkjohnson Jul 27, 2024
2d5aa6f
Merge pull request #2 from gkjohnson/oidn-improved-normals-albedo
DennisSmolek Jul 28, 2024
25cfd75
upstream denoiser upgraded added abort
DennisSmolek Jul 28, 2024
ada9283
Wired in abort. Syntax update
DennisSmolek Jul 28, 2024
7a9b0dd
Add SplitMaterial
DennisSmolek Jul 29, 2024
a7a5035
OIDNDenoiser: Some cleanup
gkjohnson Jul 29, 2024
41805f1
Adjust handling of events
gkjohnson Jul 29, 2024
bd9d187
adjust denoiser example
gkjohnson Jul 29, 2024
7a0ada6
Fix denoise example split point, texture reference
gkjohnson Jul 29, 2024
921b6dd
Fix incorrect else block
gkjohnson Jul 29, 2024
7ba61c0
Remove need for denoise split material by using scissor
gkjohnson Jul 29, 2024
4470623
Remove unused file
gkjohnson Jul 29, 2024
ff6da1f
Update materialBall.js
gkjohnson Jul 30, 2024
6a15ba5
Reset the scissor state in denoiser.html
gkjohnson Jul 31, 2024
be030e7
Only render the noisy pass as a split frame to avoid pop in on denois…
gkjohnson Jul 31, 2024
a759562
Fix scissor blanking, minor cleanup, updates
DennisSmolek Jul 31, 2024
adf3487
Merge branch 'main' of https://github.com/DennisSmolek/three-gpu-path…
DennisSmolek Jul 31, 2024
e0b4282
Fix post-merge
DennisSmolek Jul 31, 2024
c3ccc71
Linear Flow
DennisSmolek Jul 31, 2024
b8b4e29
Removed unused import
DennisSmolek Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
628 changes: 319 additions & 309 deletions example/index.html

Large diffs are not rendered by default.

82 changes: 80 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ const params = {
floorRoughness: 0.2,
floorMetalness: 0.2,

// Denoiser
maxSamples: 6,
limitlessSamples: false,
enableDenoiser: false,
useAux: true,
cleanAux: true,
renderAux: '',
denoiserQuality: 'fast',
denoiserDebugging: false,

DennisSmolek marked this conversation as resolved.
Show resolved Hide resolved
...getScaledSettings(),

};
Expand Down Expand Up @@ -269,11 +279,70 @@ function onParamsChange() {

}

// Denoiser
if ( params.limitlessSamples ) pathTracer.maxSamples = Number.POSITIVE_INFINITY;
else pathTracer.maxSamples = params.maxSamples;
const renderScaleController = findController( 'renderScale' );
const oldEnableState = pathTracer.enableDenoiser;
pathTracer.enableDenoiser = params.enableDenoiser;
pathTracer.renderAux = params.renderAux;
pathTracer.denoiserDebugging = params.denoiserDebugging;
if ( oldEnableState !== params.enableDenoiser ) {

// force the renderscale to be 1 when using the denoiser
pathTracer.renderScale = 1;
params.renderScale = 1;
// set and disable the renderScale gui
if ( renderScaleController ) {

renderScaleController.disable();
renderScaleController.setValue( 1 );

}
DennisSmolek marked this conversation as resolved.
Show resolved Hide resolved

} else {

if ( renderScaleController ) renderScaleController.enable();

}

pathTracer.updateMaterials();
pathTracer.updateEnvironment();

}

function hardDenoiserParamsChange() {

// When these params change it causes the denoiser to have to rebuild. So I split them out
if ( params.enableDenoiser ) {

pathTracer.useAux = params.useAux;
pathTracer.denoiserQuality = params.denoiserQuality;
pathTracer.cleanAux = params.cleanAux;


}

}

function findController( property ) {

if ( ! gui ) return null;

let targetController = null;
// get the controller by property
// biome-ignore lint/complexity/noForEach: <explanation>
gui.controllersRecursive().forEach( controller => {

if ( controller.property === property ) targetController = controller;

} );
return targetController;

}



function onHashChange() {

let hashModel = '';
Expand Down Expand Up @@ -316,7 +385,6 @@ function onResize() {
orthoCamera.top = orthoHeight / 2;
orthoCamera.bottom = orthoHeight / - 2;
orthoCamera.updateProjectionMatrix();

pathTracer.updateCamera();

}
Expand All @@ -340,6 +408,8 @@ function buildGui() {
const pathTracingFolder = gui.addFolder( 'Path Tracer' );
pathTracingFolder.add( params, 'enable' );
pathTracingFolder.add( params, 'pause' );
pathTracingFolder.add( params, 'maxSamples', 1, 300, 1 ).onChange( onParamsChange ).name( 'Max Samples' );
pathTracingFolder.add( params, 'limitlessSamples' ).onChange( onParamsChange ).name( 'Limitless Samples' );
pathTracingFolder.add( params, 'multipleImportanceSampling' ).onChange( onParamsChange );
pathTracingFolder.add( params, 'acesToneMapping' ).onChange( v => {

Expand All @@ -365,6 +435,15 @@ function buildGui() {
} );
pathTracingFolder.open();

const denoisingFolder = gui.addFolder( 'Denoising' );
denoisingFolder.add( params, 'enableDenoiser' ).name( 'OIDN' ).onChange( onParamsChange );
denoisingFolder.add( params, 'denoiserQuality', [ 'fast', 'balanced' ] ).onChange( hardDenoiserParamsChange ).name( 'Quality' );
denoisingFolder.add( params, 'useAux' ).onChange( hardDenoiserParamsChange ).name( 'Use Aux Inputs' );
denoisingFolder.add( params, 'cleanAux' ).onChange( hardDenoiserParamsChange ).name( 'Aux Inputs 100% Clean' );
denoisingFolder.add( params, 'renderAux', { 'Denoised': '', 'Albedo': 'albedo', 'Normal': 'normal' } ).name( 'Render Output' ).onChange( onParamsChange );
denoisingFolder.add( params, 'denoiserDebugging' ).name( 'Debugging' ).onChange( onParamsChange );
denoisingFolder.open();

const environmentFolder = gui.addFolder( 'environment' );
environmentFolder.add( params, 'envMap', envMaps ).name( 'map' ).onChange( updateEnvMap );
environmentFolder.add( params, 'environmentIntensity', 0.0, 10.0 ).onChange( onParamsChange ).name( 'intensity' );
Expand Down Expand Up @@ -436,7 +515,6 @@ function updateCameraProjection( cameraProjection ) {

controls.object = activeCamera;
controls.update();

pathTracer.setCamera( activeCamera );

}
Expand Down
Loading