Skip to content
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

SpotLightMap v3 #21944

Merged
merged 19 commits into from
Aug 24, 2022
Merged

SpotLightMap v3 #21944

merged 19 commits into from
Aug 24, 2022

Conversation

mbredif
Copy link
Contributor

@mbredif mbredif commented Jun 2, 2021

rebase of #20290

@mbredif mbredif force-pushed the spotLightMap3 branch 2 times, most recently from 679ed5c to 3f79a4f Compare June 2, 2021 19:49
@Mugen87 Mugen87 mentioned this pull request Jun 2, 2021
Copy link
Collaborator

@Mugen87 Mugen87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR seems to work fine! I've just simplified webgl_lights_spotlight a bit.

However, I do not vote to change webgl_shadowmap_viewer. IMO, the additional light with its camera helper make the visuals crowded. @mrdoob Please double check^^.

@mbredif
Copy link
Contributor Author

mbredif commented Jun 4, 2021

I agree that examples should be simplified (removing the video from webgl_lights_spotlight and leaving webgl_shadowmap_viewer untouched). They were there only to show/test the PR.

@mrdoob
Copy link
Owner

mrdoob commented Jun 4, 2021

However, I do not vote to change webgl_shadowmap_viewer. IMO, the additional light with its camera helper make the visuals crowded. @mrdoob Please double check^^.

Agreed 👍

@mrdoob mrdoob added this to the r130 milestone Jun 4, 2021
@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 6, 2021

Okay, reverted the changes to webgl_shadowmap_viewer.

@mrdoob mrdoob modified the milestones: r130, r131 Jun 30, 2021
@mrdoob mrdoob modified the milestones: r131, r132 Jul 28, 2021
@mrdoob mrdoob modified the milestones: r132, r133 Aug 26, 2021
@mrdoob mrdoob modified the milestones: r133, r134 Sep 30, 2021
@mrdoob mrdoob modified the milestones: r134, r135 Oct 28, 2021
@mrdoob mrdoob modified the milestones: r135, r136 Nov 26, 2021
@crubier
Copy link

crubier commented Dec 19, 2021

Let's get this done, I'm dreaming of this 🙏 😭 Are there any blockers at the moment ? Can I help in any way ?

@mrdoob mrdoob modified the milestones: r136, r137 Dec 24, 2021
@mrdoob mrdoob modified the milestones: r137, r138 Jan 26, 2022
@mrdoob mrdoob modified the milestones: r138, r139 Feb 23, 2022
@inear
Copy link

inear commented Mar 21, 2022

Is this PR under consideration to be included in the future, or is the milestones automatically increased? Would love this feature :) Wish I could help, but would just mess things up.


#if defined(USE_SHADOWMAP) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directLight.visible && receiveShadow is better than all( bvec2( directLight.visible, receiveShadow ) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, I am just following the same pattern as the other tests in this file.

@mrdoob mrdoob merged commit abe1dff into mrdoob:dev Aug 24, 2022
@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2022

Thanks! Sorry that it took... 4 years... 🫣

@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2022

After playing a bit with it, I find it strange that penumbra doesn't interact with it...

Screen Shot 2022-08-24 at 9 28 41 AM

Also, if you set penumbra to 0 you can see the spotlight and the map on top:

Screen Shot 2022-08-24 at 9 30 38 AM

Makes me wonder if SpotLight is the right place for this... Maybe we should create RectLight/RectangularLight?

@mbredif
Copy link
Contributor Author

mbredif commented Aug 24, 2022

That is a matter of taste

  • mix( directLight.color, spotLight.color * spotColor.rgb, spotColor.a ) is how it is implemented : the spot texture alpha mixes the cone of penumbra and the rgb values of the texture.

  • directLight.color * spotLight.color * spotColor.rgb is maybe the kind of modulation you have in mind (alpha is unused), however that modulation does not allow to deactivate entirely the penumbra (which can now be done with a texture with alpha=1)

image

@mrdoob
Copy link
Owner

mrdoob commented Aug 24, 2022

That looks much better!

@WestLangley What do you think?

@WestLangley
Copy link
Collaborator

directLight.color * spotLight.color * spotColor.rgb is maybe the kind of modulation you have in mind

Do you mean

directLight.color = spotLight.color * spotColor.rgb

@mbredif mbredif mentioned this pull request Aug 25, 2022
@mbredif
Copy link
Contributor Author

mbredif commented Aug 25, 2022

I gave a try in #24539 to enable the use of spotlight textures with and without the cone of light effect. Let's switch the discussion there :)

abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* SpotLightMap

* Update webgl_lights_spotlight.html

Simplify spot light example.

* Update WebGLProgram.js

* Update lights_fragment_begin.glsl.js

* Update WebGLLights.js

* Update SpotLight.html

* Update SpotLight.html

* Update SpotLight.js

* Update shadowmap_vertex.glsl.js

* Update SpotLight.js

* Update lights_fragment_begin.glsl.js

* Update SpotLight.html

* Update SpotLight.html

* Update shadowmap_vertex.glsl.js

* Update shadowmap_vertex.glsl.js

* Update WebGLLights.js

* Update WebGLLights.js

* Update shadowmap_vertex.glsl.js

* Update WebGLLights.js

Co-authored-by: Michael Herzog <[email protected]>
Co-authored-by: mrdoob <[email protected]>
snagy pushed a commit to snagy/three.js-1 that referenced this pull request Sep 21, 2022
* SpotLightMap

* Update webgl_lights_spotlight.html

Simplify spot light example.

* Update WebGLProgram.js

* Update lights_fragment_begin.glsl.js

* Update WebGLLights.js

* Update SpotLight.html

* Update SpotLight.html

* Update SpotLight.js

* Update shadowmap_vertex.glsl.js

* Update SpotLight.js

* Update lights_fragment_begin.glsl.js

* Update SpotLight.html

* Update SpotLight.html

* Update shadowmap_vertex.glsl.js

* Update shadowmap_vertex.glsl.js

* Update WebGLLights.js

* Update WebGLLights.js

* Update shadowmap_vertex.glsl.js

* Update WebGLLights.js

Co-authored-by: Michael Herzog <[email protected]>
Co-authored-by: mrdoob <[email protected]>
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.

9 participants