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

Select if a directional light should contribute to the lighting color contribution, or to a shadow map only ( real time shadowing ) #30085

Open
Samsy opened this issue Dec 10, 2024 · 2 comments

Comments

@Samsy
Copy link
Contributor

Samsy commented Dec 10, 2024

Description

A while ago I did hack my way on a custom threejs of the webGLRenderer to render both baked and real time lighting,
And I found out really useful to determine / selecting if a light should contribute of the color lighting output, or cast shadow only and only contributes to the shadow mapping

Example for a scene, let say you have two directional lights :

1 used for baking shadows globally and for lighting color contribution

1 used for real time shadowing, but this one should not contribute to the color lighting as it would add up a second contribution, and on top affecting perfs since one light is only needed for the lighting color contribution

Solution

Maybe adding an boolean property to toggle off the color contribution ?

Additional context

No response

@Samsy Samsy changed the title Select if a directional light should contributes to the lighting color contribution, or to a shadow map only Select if a directional light should contributes to the lighting color contribution, or to a shadow map only ( real time shadowing ) Dec 10, 2024
@Samsy Samsy changed the title Select if a directional light should contributes to the lighting color contribution, or to a shadow map only ( real time shadowing ) Select if a directional light should contribute to the lighting color contribution, or to a shadow map only ( real time shadowing ) Dec 10, 2024
@Samsy
Copy link
Contributor Author

Samsy commented Dec 12, 2024

Hey hello @sunag, @RenaudRohlinger maybe ?

I've been trying to look at this, but bumping into a few troubles :

Question link

@RenaudRohlinger
Copy link
Collaborator

Without diving too much in the code a temporary dirty solution @Samsy:

dirLight = new THREE.DirectionalLight( 0xffffff, 0.001 );
dirLight.position.set( 3, 12, 17 );
dirLight.castShadow = true;
dirLight.shadow.intensity = 10000;

https://jsfiddle.net/280ghu7n/8/
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants