Cant put shadows straight down, only slight away

Hi there, I have this direction light and the shadow generator, all works really well…
But!
I need need the shadow to be as downwards as possible, would be great if it was under the model, but as close as it can be would be amazing… Changing the directional light to different values move it around, but dont move it under-ish the object… Any ideas?

Hello and welcome!

Can you share a repro in the Playground?

So it took me a while to set a playground 'cause I was having some issues… And now it is with this “bug” wich I sorta have not in the playground too, wich is the shadow being sliced.
When its not sliced, its too stretched… I have the light.autoCalcShadowZBounds = true; 'cause if not, the shadows doesnt show…
Well, heres the link: babylonjs-playground.com/#UKNERM#258

I dont know if I can put 2 messages at once… BUT! It seems that the autoCalc was the culprit… I took advantage of the playground and the inspector in there, changed the light rotation and as I expected no shadows, then I disabled the autoCalc and messed around with the values manually… It seems that it fixed the problem by setting min 50 and max 85… The lesser the max value is, the better the shadows are, because it get less sliced, but if you go too low, then they disapear, like 75…
And if I may, I would like to know if I can put html inside the canvas, I mean, I tried already, but it doesnt show anything, even with higher zIndex, just to know if its possible.

1 Like

not sure to get the part about the html in the canvas ?

Instead creating divs alongside it, create inside it… like <‘canvas><‘div><’/div><’/canvas>

This is not possible unfortunately.

Okay, thank you :smiley:

The auto calc feature tighten the light volume according to the shadow casters, but depending on how the shadows are projected it can cut them:

The colored transparent cube shows you the light volume: as you can see, the shadow is cut exactly where the volume ends.

You can correct the problem by either adding the ground to the list of shadow casters (but then the quality of the shadow will lessen because the light volume will grow) or update the values manually as you did to grow the volume enough to encompass the shadow.