diff --git a/src/denoise/pass/DenoiserComposePass.js b/src/denoise/pass/DenoiserComposePass.js index df1f49e..2fb2a43 100644 --- a/src/denoise/pass/DenoiserComposePass.js +++ b/src/denoise/pass/DenoiserComposePass.js @@ -70,7 +70,7 @@ export class DenoiserComposePass extends Pass { vec3 viewNormal = (vec4(mat.normal, 0.) * cameraMatrixWorld).xyz; - float viewZ = -getViewZ(depth); + float viewZ = getViewZ(depth); // view-space position of the current texel vec3 viewPos = getViewPosition(viewZ); diff --git a/src/denoise/shader/denoiser_compose_functions.glsl b/src/denoise/shader/denoiser_compose_functions.glsl index 5002479..af43a83 100644 --- a/src/denoise/shader/denoiser_compose_functions.glsl +++ b/src/denoise/shader/denoiser_compose_functions.glsl @@ -15,7 +15,7 @@ vec3 getViewPosition(float viewZ) { vec4 clipPosition = vec4((vec3(vUv, viewZ) - 0.5) * 2.0, 1.0); clipPosition *= clipW; vec3 p = (projectionMatrixInverse * clipPosition).xyz; - p.z = -viewZ; + p.z = viewZ; return p; } diff --git a/src/denoise/shader/poisson_denoise.frag b/src/denoise/shader/poisson_denoise.frag index 1a86778..71a4d0d 100644 --- a/src/denoise/shader/poisson_denoise.frag +++ b/src/denoise/shader/poisson_denoise.frag @@ -166,7 +166,7 @@ void main() { float roughnessRadius = mix(mat.roughness * mat.roughness, 1., specularPhi); - float r = flatness * radius * exp(-max(inputs[0].a, inputs[1].a) * 0.01); + float r = flatness * radius; for (int i = 0; i < 8; i++) { { diff --git a/src/gbuffer/GBufferPass.js b/src/gbuffer/GBufferPass.js index 7320658..ab9e373 100644 --- a/src/gbuffer/GBufferPass.js +++ b/src/gbuffer/GBufferPass.js @@ -93,6 +93,7 @@ export class GBufferPass extends Pass { for (const c of this.visibleMeshes) { const [originalMaterial] = this.cachedMaterials.get(c) + c.visible = true c.material = originalMaterial } } @@ -114,7 +115,6 @@ export class GBufferPass extends Pass { // reset state this.lastCameraPosition.copy(this._camera.position) this.lastCameraQuaternion.copy(this._camera.quaternion) - this._scene.background = background } }