Jump to content

pointLight - issue with shadows


Amarth2Estel
 Share

Recommended Posts

Hi everybody, and Happy New Year ! :D

I've been working with BJS for several months now and I have been able to solve every problem I encountered by reading docs and posts on this forum, thanks to you, community, so Thank You.

However, I never manage to find a complete solution for one problem that I am going to expose now.

Considering the pointLight shadows demo : https://www.babylonjs-playground.com/#LYCSQ#12
If the container is also casting shadows, then a weird effect occurs : https://www.babylonjs-playground.com/#LYCSQ#333
I believe it's because the container is self-shadowing. I read about Close Exponential Shadow Map and its additional parameters so I tried and It solved to problem for the demo scene : https://www.babylonjs-playground.com/#LYCSQ#334

I need to use BJS to display a scene for which geometries are computed server-side. Next PG shows the kind of results I currently get.
This is a corridor in a L shape with a pointLight in one side. http://www.babylonjs-playground.com/index.html#EHE2DW#2
I would like both the scene illumination to be proper and the shadow of the wall casted on the floor. I tried to play with parameters (shadowM[in/ax]Z, bias etc..) but I cannot manage to find a correct configuration. Moreover, because scenes I need to display are always different, I can not use tricks like "in this configuration, do not receive shadows on the wall, or do not make the floor cast shadows (I may render differents floors/levels)".
Do you have any idea of what I am doing wrong ?

I thank you for your answers.

Link to comment
Share on other sites

Hello and welcome in the shadows hell ;D

We try to add all possible tools to help on creating simple and accurate shadows but because we are fighting against math precision, the fight is tough!

here are some advises that COULD help:

* Try to keep everything within a 1x1x1 cube. Close ESM shadow works almost flawlessly in this case

* To reduce shadow acne, you can try to play with bias (the problem is that this value is clearly scene dependent): https://www.babylonjs-playground.com/index.html#EHE2DW#3

* Try to reduce the depthScale to the barely minimum value: https://www.babylonjs-playground.com/index.html#EHE2DW#4

 

All these ideas tend to focus one single objective: Getting more precision

Link to comment
Share on other sites

Hello DK ! Thanks for your answer.

I understand very well the constant fight to find balance between accuracy, computation weight and the ease of use ! And congratulations for it by the way ! I find shadows easy to set up with directionnal light - which may be enough in most cases -, I only encountered issues with point light !

I will try to adapt my scenes following your advices.  I didn't know about the property depthScale of the ShadowGenerator, but it seems to be exactly what I need. 
In order to fit my scene in an unit cube, I may add a TransformNode at root of the meshes tree to scale entire scene. Is there a more elegant way to do it ? (scene bounding box is known)

Thank you again

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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