Jump to content

ShadowGenerator doesn't take in account light position


mache
 Share

Recommended Posts

Hello,

I am having trouble with the shadow generator, this playground illustrate my problem => http://www.babylonjs-playground.com/#DAKLR#4

I made a room with a window. Then I add two lights with a shadowgenerator for each one, the two sphere show their position into the scene. The one outside the room act properly (you can see light pass through the window), but the one inside the room light nothing.

If you comment line 97 -> 104 (remove the roof) the light inside act properly.

Thanks :)

Link to comment
Share on other sites

Hi guys!  To expand on that notion...  http://www.babylonjs-playground.com/#DAKLR#5

I am moving/animating the directional light1 .position... to see WHY directionalLights even have a .position property.  What is it used for?  I needed to do tests.  (curiosity, ya know?)  :)

As you can see, moving dirLight 1 far away, DOES do things.  Shadow edges get distorted, lighting gets dimmer, etc.  Not sure why.  Line 130... I experimented with light1.range... no affect seen.  hmm.  Switching usePoissonSampling to false... does even more fun things.  I HAVE heard that certain types of sampling... don't work well at great distances (like the distance to the Sun)  :)

Link to comment
Share on other sites

By default directionlight's position is used to define where the virtual camera used to render shadow maps should be positioned.

Since bjs 2.3, this position is automatically computed by Babylon.js (it takes the closer position where all the scene can be seen). But as always, you can also consider doing it by yourself.

Link to comment
Share on other sites

Helo guys,

Thanks for your reply :)

@jellix Directional light in babylon.js are using shadow mapping so as said Deltakosh it's possible to define a position. Nevertheless I am still a beginner in 3D, the directional light don't seem to be the right choice. What would be an adapted indoor light to fit a scene such as my playground?

@Wingnut Yeah I also notice some fun things with the sampling :

@Deltakosh Ok I'll give a try to see what can I get.

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