Trouble With Directional Light Shadows

So I have a scene where the units are by hundreds so the player so about 100 units and the scene is about 9000 units.

I have a sphere in the center then the player which can move around the area “freely”. Both are shadowCaster and receives shadows.

I am trying to wrap my head around the orthographic projection to get the shadows working, this is going to be important to get them right as it helps establish depth sense the scale of the objects in the scene are wonky (purposely)

can someone help me out? Ill try to make a PG right now with the setup.

https://playground.babylonjs.com/#L6838P#1

Here is the closest I can get, but I would really like to be able to have it out quite a bit farther.
https://playground.babylonjs.com/#L6838P#2

https://playground.babylonjs.com/#L6838P#3

The problem with large numbers are that we end up having poor precision on the depth axis.
Shadows work the best when between 0 and 1 :slight_smile:

The good idea to help set your shadows up is to use the inspector so you can pick the shadow map and see its content:

What would be a good setup for this then?

Ideally reduce the distance between camera.minZ and maxZ
But if you cannot, then you just need to make sure the light position is set up correctly so the light can see the objects as much as possible.

I guess its the same topic as:

I feel like there should be a way to handle this within the engine.

this means I will need to do my own shader for this… uhhg was not hoping to dive in this deep to just cast shadows from a ship to a planet.

http://ogldev.atspace.co.uk/www/tutorial49/tutorial49.html

Is this something that cascading shadow maps would solve? @Deltakosh

Yeah, I just don’t think anyone wants to dive into it.

Yes it is and it is on @sebavan to do list since forever

I want to as it sounds amazingly fun to build :slight_smile: but run out of time each release.

Let s make it my feature priority for 4.2 knowing 4.1 is webgpu ???

1 Like

it will really make larger scale projects a possibility for developers then. Cause I know lots of people will skip ship over shadow support.

When is the release of 4.2? 2020?

Dunno exactly but I could probably have it around November :slight_smile: Else I can definitely help anybody who wants to contribute.