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] Fix to non-clustered omni shadow rendering #4972

Merged
merged 1 commit into from
Jan 12, 2023
Merged
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
4 changes: 3 additions & 1 deletion examples/src/examples/graphics/lights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ class LightsExample {
// @ts-ignore
pc.TextureHandler,
// @ts-ignore
pc.ContainerHandler
pc.ContainerHandler,
// @ts-ignore
pc.CubemapHandler
];

const app = new pc.AppBase(canvas);
Expand Down
8 changes: 7 additions & 1 deletion src/platform/graphics/webgl/webgl-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,10 @@ class WebglGraphicsDevice extends GraphicsDevice {
}
// #endif

continue; // Because unset constants shouldn't raise random errors
Debug.errorOnce(`Shader [${shader.label}] requires texture sampler [${samplerName}] which has not been set, while rendering [${DebugGraphics.toString()}]`);

// skip this draw call to avoid incorrect rendering / webgl errors
return;
}

if (samplerValue instanceof Texture) {
Expand Down Expand Up @@ -1920,6 +1923,9 @@ class WebglGraphicsDevice extends GraphicsDevice {
// Call the function to commit the uniform value
if (scopeId.value !== null) {
this.commitFunction[uniform.dataType](uniform, scopeId.value);
} else {
// commented out till engine issue #4971 is sorted out
// Debug.warnOnce(`Shader [${shader.label}] requires uniform [${uniform.scopeId.name}] which has not been set, while rendering [${DebugGraphics.toString()}]`);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/scene/renderer/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,9 @@ class Renderer {

// update shadow / cookie atlas allocation for the visible lights. Update it after the ligthts were culled,
// but before shadow maps were culling, as it might force some 'update once' shadows to cull.
this.updateLightTextureAtlas(comp);
if (this.scene.clusteredLightingEnabled) {
this.updateLightTextureAtlas(comp);
}

// cull shadow casters for all lights
this.cullShadowmaps(comp);
Expand Down
4 changes: 3 additions & 1 deletion src/scene/renderer/shadow-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ class ShadowRenderer {
light.shadowUpdateMode = SHADOWUPDATE_NONE;
}

this.renderer._shadowMapUpdates += light.numShadowFaces;
if (needs) {
this.renderer._shadowMapUpdates += light.numShadowFaces;
}

return needs;
}
Expand Down