Self Shadow Casting

Hey Forum, I have seen some post about this, but i could not figure out why it does not work in my project
As you can see the walls of my model are not casting shadows on themselves but on the other objects (see floor).

I am iterating over all the meshes and setting cast and receive shadows to true. Also, renderer.shadowMap is enabled. All the other shadows work, but not the “self shadow” on the walls.

Here (in the cornor left to the sink) you can see that the shadows are just not acting correctly (I think it is not even JUST the walls but also other elements…)

Do you have an idea why this is the case?

Thank you for any help :slight_smile:

Are you trying to do shadows like in these snapshots:

Check the boundaries of the shadow camera. I’m not sure about the size of your model, but you can try the following code: = -20; = 20; = 20; = -20;

PS. For the snapshots I also modified the type of shadows, the strength of the lights, the position, the bias.

That is amazing! Thank you :slight_smile:

May I ask what exactly you changed? I am new to the topic and could use some tips on realistic lighting…

PS: Sry for the late reply

  1. Comment line 61
//renderer.shadowMap.type = THREE.BasicShadowMap;
  1. Comment line 138:
  1. Change spotLight properties lines 142-144
spotLight.shadow.bias = -0.001;
spotLight.shadow.mapSize.width = 1024;
spotLight.shadow.mapSize.height = 1024;
  1. Add spot light shadow camera properties:
// added lines = -20; = 20; = 20; = -20;