Skip to content

ProjectorLightNode: Fix back-projection.#31473

Merged
Mugen87 merged 2 commits into
mrdoob:devfrom
Mugen87:dev3
Jul 22, 2025
Merged

ProjectorLightNode: Fix back-projection.#31473
Mugen87 merged 2 commits into
mrdoob:devfrom
Mugen87:dev3

Conversation

@Mugen87

@Mugen87 Mugen87 commented Jul 22, 2025

Copy link
Copy Markdown
Collaborator

Fixed #31461.

Description

The PR prevents back-projection when using ProjectorLight. This bug was present in the initial code from #24589 and unfortunately ported to the node system.

The idea is to the check the w coordinate of spotLightCoord since this variable represents the fragment's position in the light's clip space. The sign of w determines whether a fragment is in front or behind the light.

Comment thread src/nodes/lighting/ProjectorLightNode.js
Comment thread src/nodes/lighting/ProjectorLightNode.js
@Mugen87 Mugen87 added this to the r179 milestone Jul 22, 2025
@github-actions

github-actions Bot commented Jul 22, 2025

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.92
78.83
337.92
78.83
+0 B
+0 B
WebGPU 560.13
155.06
560.22
155.11
+89 B
+50 B
WebGPU Nodes 559.06
154.84
559.15
154.89
+89 B
+50 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.19
113.49
469.19
113.49
+0 B
+0 B
WebGPU 635.3
171.98
635.39
172.03
+89 B
+45 B
WebGPU Nodes 589.95
161.23
590.04
161.27
+89 B
+44 B

@Mugen87 Mugen87 merged commit a880e76 into mrdoob:dev Jul 22, 2025
9 checks passed
@ycw

ycw commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

Thanks.

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.

WebGPURenderer: ProjectorLight unintentionally emits light from its back side

2 participants