Skip to content

SpotLightShadow: Introduce aspect property #31020

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 6 commits into from
Apr 28, 2025

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Apr 28, 2025

@sunag sunag marked this pull request as ready for review April 28, 2025 16:40
@sunag sunag added this to the r177 milestone Apr 28, 2025
Copy link

github-actions bot commented Apr 28, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.33
78.33
336.33
78.33
+0 B
+0 B
WebGPU 547.81
151.88
547.81
151.89
+4 B
+1 B
WebGPU Nodes 547.16
151.73
547.16
151.73
+4 B
+1 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.78
112.28
465.78
112.28
+0 B
+0 B
WebGPU 622.66
168.44
622.7
168.46
+30 B
+11 B
WebGPU Nodes 577.54
157.71
577.57
157.72
+30 B
+14 B

@WestLangley
Copy link
Collaborator

I think the aspect should be automatic: set to 1 if there is no texture, and equal to the texture's aspect otherwise. There is no need for a separate aspect property.

@sunag
Copy link
Collaborator Author

sunag commented Apr 28, 2025

I think the aspect should be automatic: set to 1 if there is no texture, and equal to the texture's aspect otherwise. There is no need for a separate aspect property.

I think it could be useful for rectangular lighting.

@WestLangley
Copy link
Collaborator

I think it could be useful for rectangular lighting.

I do not think that is necessary.

@WestLangley
Copy link
Collaborator

Also, I think a rectangular projection is a bit too complex to ask a user to implement themselves in TSL, and it should be a built-in feature like "focus" and "penumbra".

Support for "cookies" would also be a reasonable built-in feature for a spotlight.

@sunag
Copy link
Collaborator Author

sunag commented Apr 28, 2025

Support for "cookies" would also be a reasonable built-in feature for a spotlight.

What would be support for cookies?

@WestLangley
Copy link
Collaborator

What would be support for cookies?

Here is a good explanation: https://docs.unity3d.com/Manual/Cookies-introduction.html.

@WestLangley
Copy link
Collaborator

TSL is great. However, I do not see it as the best solution for the "projector light" use case. Users should not have to code this particular feature themselves, IMHO.

@sunag
Copy link
Collaborator Author

sunag commented Apr 28, 2025

Here is a good explanation: https://docs.unity3d.com/Manual/Cookies-introduction.html.

It seems like the article is talking about shadow baking like this and light.map features, but maybe there's something more there?

The idea of ​​a projector is interesting especially if we integrate it with a light.colorNode.

@sunag
Copy link
Collaborator Author

sunag commented Apr 28, 2025

I'm going to merge this PR and will work on creating a ProjectorLight that supports procedural shader, it seems like a good opportunity.

@sunag sunag merged commit 8ee79cf into mrdoob:dev Apr 28, 2025
12 checks passed
@sunag sunag deleted the dev-improve-spotlight branch April 28, 2025 18:14
@WestLangley
Copy link
Collaborator

Cookies can have an alpha channel, which can be used to attenuate the intensity.

Here is another example: https://developer.playcanvas.com/tutorials/light-cookies/

I'm going to merge this PR and will work on creating a ProjectorLight

A projector light that projects a movie would be good. It should just work, without the user have to write TSL to make it work.

RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* TSL: Fix convert `.set*()` value to node-object

* SpotLightShadow: Introduce `aspect`

* improve custom aspect example

* cleanup

* Update webgpu_lights_spotlight.html

* Update webgpu_lights_spotlight.html
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* TSL: Fix convert `.set*()` value to node-object

* SpotLightShadow: Introduce `aspect`

* improve custom aspect example

* cleanup

* Update webgpu_lights_spotlight.html

* Update webgpu_lights_spotlight.html
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