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

fix meshes being visible false, fix noise banding on planes #39

Draft
wants to merge 1 commit into
base: v2-debug
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/denoise/pass/DenoiserComposePass.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/denoise/shader/denoiser_compose_functions.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/denoise/shader/poisson_denoise.frag
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Author

Choose a reason for hiding this comment

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

I saw this was added but the inputs[0].a isn't guaranteed defined at this point and I was too lazy to figure out why. So I just removed this change for now.

float r = flatness * radius;

for (int i = 0; i < 8; i++) {
{
Expand Down
2 changes: 1 addition & 1 deletion src/gbuffer/GBufferPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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
}
}