From 739e1dfe7e406ca3ef18a9aa92fa34bc3506d114 Mon Sep 17 00:00:00 2001 From: Lucas Crane Date: Tue, 14 Jan 2020 13:37:55 -0500 Subject: [PATCH] Tweak reprojection amount & decrease bounces to 2 (#58) * tweak reprojection amount * lower numUniformSamples and maxReprojectedSamples * increase numUniformSamples from 3 to 4 for scenes with more GI Co-authored-by: Noah Lyons --- scenes/webgl-comparison/main.js | 1 + src/RayTracingRenderer.js | 2 +- src/renderer/RenderingPipeline.js | 7 +++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scenes/webgl-comparison/main.js b/scenes/webgl-comparison/main.js index 5b810ee..9e94710 100644 --- a/scenes/webgl-comparison/main.js +++ b/scenes/webgl-comparison/main.js @@ -154,6 +154,7 @@ function initRenderer(renderer) { renderer.toneMapping = THREE.ACESFilmicToneMapping; renderer.toneMappingExposure = 1.5; renderer.renderWhenOffFocus = false; + renderer.bounces = 3; } function unloadRenderer(renderer) { diff --git a/src/RayTracingRenderer.js b/src/RayTracingRenderer.js index 626e98a..24fa396 100644 --- a/src/RayTracingRenderer.js +++ b/src/RayTracingRenderer.js @@ -31,7 +31,7 @@ export function RayTracingRenderer(params = {}) { let pixelRatio = 1; const module = { - bounces: 3, + bounces: 2, domElement: canvas, maxHardwareUsage: false, needsUpdate: true, diff --git a/src/renderer/RenderingPipeline.js b/src/renderer/RenderingPipeline.js index 572fddd..1b8ba35 100644 --- a/src/renderer/RenderingPipeline.js +++ b/src/renderer/RenderingPipeline.js @@ -18,11 +18,10 @@ export function makeRenderingPipeline({ bounces, // number of global illumination bounces }) { - const reprojectDecay = 0.975; - const maxReprojectedSamples = Math.round(reprojectDecay / (1 - reprojectDecay)); + const maxReprojectedSamples = 20; // how many samples to render with uniform noise before switching to stratified noise - const numUniformSamples = 6; + const numUniformSamples = 4; // how many partitions of stratified noise should be created // higher number results in faster convergence over time, but with lower quality initial samples @@ -231,7 +230,7 @@ export function makeRenderingPipeline({ reprojectBuffer.bind(); gl.viewport(0, 0, previewWidth, previewHeight); reprojectPass.draw({ - blendAmount: reprojectDecay, + blendAmount: 1.0, light: hdrBuffer.attachments[rayTracePass.outputLocs.light], position: hdrBuffer.attachments[rayTracePass.outputLocs.position], textureScale: previewScale,