Jump to content

Having an object casting and receiving shadows


Recommended Posts


I'm currently trying to have shadows layered on top of the other, with several objects in front of the light.

Here is a small playground demonstrating the topic


Box1 and Box2 are shadowed by their own shape, but I can't find a way to work around it. By toggling "receiveShadows" off for them, we can't see Box2 shadow projected on Box1.

I'm not so familiar with ShadowMaps, but as far as I understood it, it contains a depth value so my issue should be solvable. Or is it something we can't do with BabylonJS ?

Many thanks for your inputs on this, have a nice day !

Link to comment
Share on other sites

Okay, I had not thought depthScale had to be so high, thanks !

As we have quite a dynamic scene concerning objects positions, with elements of very different scales, etc, I'm pretty sure it will be to complex to predict these values from the scene layout.

I'll try to update the Playground with another attempt using different ShadowGenerator (we already do something like this for Reflection cubeTexture using probes, and it kinda works fine).

Obviously, thanks again for you impressive reactivity.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...