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

WebGLRenderer: Fix shadow update when object is culled. #26293

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

OndrejSpanel
Copy link
Contributor

Related issue: #26292

Description

Update of the skeleton needs to be called whenever the object or its shadow are rendered. The update is optimized to be done only once per frame already, one just needs to be careful to have the rendered frame index updated at the right moment.

I have an updated bones-browser.html demonstrating the issue, however I am not sure if (and how) I should include it in this PR.

@github-actions
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
642.8 kB (159.4 kB) 642.8 kB (159.4 kB) -2 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
436.1 kB (105.6 kB) 436.1 kB (105.6 kB) -2 B

@Mugen87 Mugen87 added this to the r154 milestone Jun 20, 2023
@Mugen87 Mugen87 merged commit 0fc8d3d into mrdoob:dev Jun 20, 2023
@Mugen87 Mugen87 changed the title Fix shadow update when object is culled WebGLRenderer: Fix shadow update when object is culled. Jun 20, 2023
@@ -1093,6 +1093,9 @@ class WebGLRenderer {

const shadowsArray = currentRenderState.state.shadowsArray;

// muse be done before shadowMap.render, so that the number is the the same for shadows and real objects
this.info.render.frame ++;
Copy link
Collaborator

@Mugen87 Mugen87 Jun 20, 2023

Choose a reason for hiding this comment

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

I think this was an important fix since it potentially produced general frame late effects when rendering the shadow map (because WebGLShadowMap.render() relied on an outdated frame value).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants