Shadows in sandbox.babylonjs


I’ve been playing around with an object exported from 3ds max and I’d like to use real time shadows with it, but they don’t seem to work. Am I doing something wrong or maybe this can’t be done in sandbox?


Welcome aboard!

You should be able to use the sandbox to test shadows. Maybe you should provide the file you are testing with so that we can help more?

Note that you won’t get shadows just by loading the file: you must create a shadow generator for shadows to be generated. This is possible in the sandbox, on the light node (but the light must be a spot, point or directional light).

Thanks for the wecome and the reply.

I added a directional light and a shadow generator on it, but nothing happens.

I can’t share this model, but I can try creating a simple scene and share that if shadows continue not working.

Edit: here is a simple scene: Dropbox - scene.babylon - Simplify your life

I loaded .glb exported from max and added a directional light, then exported the scene as babylon.

Ok, got it.

That’s because the skybox mesh is also added in the list of the shadow casters when you create a shadow generator in the sandbox that you can’t see what happens, this mesh being very far from the scene.

This PR prevents the objects that are infinitely far (like the skybox) from being added to the shadow caster list:

After this change, you will have to remove and recreate the shadow generator so that the sky is not in the shadow caster list anymore.

Thank you very much!!

Just to understand correctly, when can I expect this change to take effect?

It is live :slight_smile:

1 Like

Hey, that’s amazingly fast, but I think I might be using an old version because shadows are still being cast by skybox. How can I verify the sandbox version I’m using?

Are you using the online version of the sandbox? You need to use the latest preview version files.

You should look at the browser console: