Three.js: VSMShadowMap issue with receiveShadow=true and castShadow=false

Created on 12 Sep 2019  路  3Comments  路  Source: mrdoob/three.js

Hi there,

I found that renderer.shadowMap.type=VSMShadowMap seems to have an issue in regards to 3D objects which are set to receiveShadow=true and castShadow=false.

In this fiddle you can see
https://jsfiddle.net/Thor_Bux/g1Loqb08/21/

That the red cube is set to castShadow=false and receiveShadow=true however if the shadowMap.type is set to VSMShadowMap it also casts a shadow.
If the shadowMap.type is set to another type like PCFSoftShadowMap it works as expected. (See line 125, 126)

Three.js version
  • [x] Dev
  • [x] r108
Browser
  • [] All of them
  • [x] Chrome
OS
  • [] All of them
  • [x] macOS

Most helpful comment

This is a limitation of VSM.

Oh good to know! Maybe it would be worth adding a note in the docs on the Renderer Constants page?

All 3 comments

It looks like that's due to this part of the condition in WebGLShadowMap on line 392 when determining whether or not to render an object:

object.castShadow || ( object.receiveShadow && type === VSMShadowMap )

I'm not sure why that second portion was added, though.

/ping @supereggbert

This is a limitation of VSM. The algorithm requires the depth of the scene for both casters and receivers for the maths to work out correctly. If you don't render receivers, it leads to some weird behaviour (normally skinny hard shadows).

This is a limitation of VSM.

Oh good to know! Maybe it would be worth adding a note in the docs on the Renderer Constants page?

Was this page helpful?
0 / 5 - 0 ratings