-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
Add penumbra angle to spotLight #5078
Conversation
Add an additional option to `THREE.SpotLight` called `penumbraAngle`. This angle will be added to the angle of the spotlight to create a "falloff" cone. The area within both cones is lit as normal. The area outside of the falloff code is not lit. The area between the inner and falloff cones is smoothly faded away as it approaches the edge of the falloff cone.
@@ -69,6 +69,8 @@ THREE.UniformsLib = { | |||
"spotLightDirection" : { type: "fv", value: [] }, | |||
"spotLightDistance" : { type: "fv1", value: [] }, | |||
"spotLightAngleCos" : { type: "fv1", value: [] }, | |||
"spotLightOuterAngleCos" : { type: "fv1", value: [] }, | |||
"spotLightAngleCosDiff" : { type: "fv1", value: [] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the difference can be computed in the shader, instead. This may be more efficient, but it seems strange to me to pass in redundant information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to actually benchmark the performance difference, but at first glance it seemed pretty significant
How do Also, you should probably target the |
<_< I always forget to target |
Yes, |
That is what I expected -- which means that they do not work fine together. Perhaps a different parameterization would be appropriate. I would be glad to suggest something if I had an idea. : - ) Also, This issue must have been addressed somewhere before, no? |
To me, they produce the expected result. For a value like 10, there is no difference, as the edge was never visible: For a value such as 4, it performs as expected, the edge is affected by the falloff from the penumbra, and then is darkened by the exponent.
Shadows aren't affected by this.
I wish... |
I like what you are trying to do. I am just concerned about the parameter combinations, and maybe your modeling approach. The If you would be willing to add DAT.GUI sliders to your example showing how parameters |
@WestLangley Re-opened at #5080 |
Add an additional option to
THREE.SpotLight
calledpenumbraAngle
.This angle will be added to the angle of the spotlight to create a
"falloff" cone. The area within both cones is lit as normal. The area
outside of the falloff code is not lit. The area between the inner and
falloff cones is smoothly faded away as it approaches the edge of the
falloff cone.
Before:
After (10 degree penumbra):