Skip to content

fix(EffectGroup): use the EffectComposer's camera and scene - #397

Merged
kvvasuu merged 1 commit into
pmndrs:masterfrom
itisrmk:cursor/fix-effectgroup-camera-3302
Oct 20, 2026
Merged

kvvasuu merged 1 commit into
pmndrs:masterfrom
itisrmk:cursor/fix-effectgroup-camera-3302

Conversation

@itisrmk

@itisrmk itisrmk commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What

EffectGroup creates its EffectPass once and keeps it across rebuilds. EffectPass only reads the camera's near/far (and hands mainCamera/mainScene to its effects) when it's set up, so when the EffectComposer's camera or scene changes, the composer's own passes get the new camera but the group's pass keeps the old one. Depth-based effects inside an <EffectGroup> then keep using stale cameraNear/cameraFar.

This is the same kind of problem #396 fixed for N8AO.

How

EffectGroup now reads scene from EffectComposerContext alongside camera, and a layout effect assigns pass.mainCamera and pass.mainScene whenever the pass, camera, or scene changes. The pass itself isn't rebuilt.

Tests

Added a test in src/tests/EffectGroup.test.tsx that renders a group under one camera, switches the composer to a camera with different near/far, and checks that the same pass now carries the new values. Lint, typecheck, tests, and build pass locally.

Co-authored-by: Rahul Kashyap <itisrmk@users.noreply.github.com>
@itisrmk

itisrmk commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Hi! Could a maintainer approve the CI workflows for this PR when you have a moment? Thanks.

@kvvasuu

kvvasuu commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

@itisrmk Thanks. I鈥檒l review in a few hours.

@kvvasuu
kvvasuu merged commit 92853cb into pmndrs:master Oct 20, 2026
1 check passed
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.

3 participants