Skip to content

ProjectorLightNode: Fix back-projection. #31473

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

Merged
merged 2 commits into from
Jul 22, 2025
Merged

ProjectorLightNode: Fix back-projection. #31473

merged 2 commits into from
Jul 22, 2025

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Jul 22, 2025

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.

@Mugen87 Mugen87 added this to the r179 milestone Jul 22, 2025
Copy link

github-actions bot commented Jul 22, 2025

📦 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
Copy link
Contributor

ycw commented Jul 30, 2025

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