Jump to content

[SOLVED] Shadow map degenerates


Recommended Posts

Hi !

I am having an issue with shadow maps, it seems pretty random, but from time to time the shadow map seems to "degenerate" meaning that the shadow map's resolution progressively lowers until the shadow is not visible anymore.

I don't know what could cause that, I am not running any scene optimiser and not touching my shadow map during the renderloop so there is no reason its resolution suddently start to lower by itself...

I am running the (v2.5.-beta) version. I will try and pose a screenshot of the scene as I can't seem to be able to reproduce it in the playground.

Thanks in advance for your time and answer ! :)

Link to comment
Share on other sites

Okay, I tried to reproduce this bug or to find a pattern but it seems highly random, I though it was a cache issue but there is no real correlation...

So, here is the project hosted on github. The code is quite messy for now : Roll A Ball !
If the shadow map does not "degenerate" just F5 the page until it does, there seems to be 1/2 chance of having this issue.

[EDIT] : I noticed that by reducing the size of my scene and the number of objects, the shadowMap seems to have less chances of "degenerating". You can change the scene's size by changing the number sent to createPlayground(), the bigger the playground, the bigger the chances of having the shadowMap degenerate.

Link to comment
Share on other sites

Very strange.  When the shadow edges DO start going "jaggy"... they just continue to get worse and worse, over time.  Weird. 

Any chance you could get this into a simple playground scene, and reproduce the issue there?  That would help the Gods troubleshoot this.  :)  thx

A VERY nice scene, by the way.  Looks great, plays smooth.  Well done.

Link to comment
Share on other sites


Also note that different Browsers has different Code -Optimization Engines, that phrases or code into binary. When you open a Tab, the Engine will compile your code with most of optimization it can do.
At some point therefor if you press F5 (compile and run ) the optimizer just say OK. this one is less important, lets free some memory for other stuff, for things that come next. 
And our code will be less optimized. I actually dont really know, where this bug happens, or if there is an officially name for this, but i also notice it many times not for WegGL for Javascript in general.   

Link to comment
Share on other sites

Are you using a directional light for shadows?

If yes this could be the reason of what you're seeing: by default the directional light tries to capture all meshes which cast a shadow. This means that resolution can be reduced to allow more meshes (This is done by virtually moving the light farther than expected).

You can turn this behavior off with light.autoUpdateExtends = false

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.

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.


  • Recently Browsing   0 members

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