Jump to content

Shadows Suddenly Vanish


Borislav
 Share

Recommended Posts

I hope that info helps, @Lynxerious... but I'm not sure it will.  Positioning AND light.setDirectionToTarget(), or other aiming-methods... is very important for directionalLights used as shadow sources. 

For pointLights... just position, no aiming (as you know) but... there is a distance-to-shadow-caster issue with pointLights... which I will now repro-dude.  :)   Also, sorry for mis-identifying issue as 'acne', earlier, guys. My mistake on that.

@Deltakosh, or anyone... thx for help on these issues.

http://www.babylonjs-playground.com/#1EVNNB#94

In this version, I have light2 pointLight active (lines 33-36). 

When light is .positioned 450 units above dude, shadows start failing.

I think this will cause problems for people who use pointLight for sun.

It seems pointLight range has no affect.  Any thoughts?

If pointLight-sun maximum-distance is 450 units, I am buying stock in sunblock lotion and fireproof umbrellas.  :D

Light1 directionalLight seems to lose shadows at 10000+ units distance.  Better range, but still an issue?  thx.

Link to comment
Share on other sites

@Deltakosh, are you sure?  :)

http://www.babylonjs-playground.com/#1EVNNB#95

Line 58:  4096 map for light2.  8192 crashed my webGL context in FF .

Line 35:  Light2 height = 150;  No shadows.

Change line 35 to height 250;  Got shadows (jaggy).

Change to height 350;  No shadows.  Does shadow generator hate the numbers 150 and 350 ?  :)

Change to height 450;  Got shadows (jaggy).

Something is strange, it seems.  Could be Wingnut.

Link to comment
Share on other sites

hmmm.  http://www.babylonjs-playground.com/#1EVNNB#96

@Deltakosh/anyone... watch console and shadows on that PG.  I am slowly-increasing light2.position.y and reporting it to console.

Are we seeing shadows ON, OFF, ON, OFF, etc?  If that's normal, I'm cool with it.  :)

 

I wonder if spotlights (and their shadows) will work for far-away sun.  Perhaps directionals.

I think many game proggers will want sun position > 600 units from Earth - for solar system sims.  hmm.  Maybe not.  :) 

Checking Spots & Directionals:  [link #97]  Spots and Directionals seem consistent (working fine) beyond 2500 units.

PointLights though... they are different.  Their shadowMaps go in ALL directions.

Link to comment
Share on other sites

Hi again.  I decided to build a PG pointLight shadow torture test

PointLight is in center of big sphere.  Camera is NOT in center... but it is a freeCamera, so fly it around with arrow keys.

Each knot is 4000 units away from center pointLight.  Yet, the shadows look great, in all 6 primary directions.

This puzzles me. 

In this PG, the pointLight is 600 units from Dude (line 15)... and shadows look less-than-optimal (kind of crappy)  :)

Wingnut is confused.  4000 units from pointLight, knots make good shadows (first link).  600 units from pointLight, Dude makes ugly shadow (2nd link).

*scratch scratch ponder ponder*

Link to comment
Share on other sites

Oh, dude is small-sized.  I forgot to check that.  ah ha!  THX!

Ok, for #96 playground... shadows appear/disappear as light rises.  You see that, @Deltakosh?  Looks normal? 

Perhaps I worry too much.  I want BJS 3+ series to be max-sweet, and I want to be an informed forum helper.  :) 

When light is 35 units Y, the first "shadow disappearing" happens (see line 35, here).  It also happens when light is 75 or 155 units.  Same for higher values, too.

User might ask "Why do shadows work with light at 25 or 45 Y-units, but NOT at 35 Y-units?".  We might need to answer them.  :) 

Perhaps a "precision-range change-over" happens when light is at Y-pos 35, 75, and 155 height?  I'm not sure how to answer user question, and/or how to write this in docs.

Link to comment
Share on other sites

We are fighting with precision still but in a different way :)

this time the light can see the shadow casters but due to inherent precision lost we are facing...shadow depth fighting :D

you can fix it by helping the shadow generator with a small bias: http://www.babylonjs-playground.com/#1EVNNB#100

This is the same reason we can have shadow acne

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