mrdoob/three.js

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

Samsy opened this issue · 2 comments

Samsy commented

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 commented

Hey hello @sunag, @RenaudRohlinger maybe ?

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

Question link

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