Jump to content

ESM shadows render on top of shadow caster


Fridolin
 Share

Recommended Posts

I have a large model exported from a software with a lot of nested instances. I added a shadow generator with defaults and added most meshes to its renderList. The console recommends to use Exponential Shadow Maps (ESM) which look also a lot nicer ("VSM are now replaced by ESM. Please use useExponentialShadowMap instead").

With ESM enabled, the scene turns mostly black because shadows are rendered also on top of those meshes that cast that part of the shadow. The issue only disappears when the shadow generator has only a single mesh in the renderList. See here:

http://www.babylonjs-playground.com/#7CPG3X

Is this a bug? Is ESM not yet stable (although the console recommends using it)? Is there a work-around?

---

Another question: My model is mostly static. Are shadow maps regenerated at every frame or only when something (lights, meshes) changes?

Link to comment
Share on other sites

You have multiple options:

- Remove the caster from the list of shadow receivers. This is the best option by far

- Play with bias and depthScale: http://www.babylonjs-playground.com/#7CPG3X#1 (doc: http://doc.babylonjs.com/tutorials/shadows#exponential-shadow-map)

 

Regarding update of the shadow map, you can set the refreshRate to 0 (The refreshrate property is set to 0 if you want the texture to only render once. If set to 1, it will render every frame, 2 every two frames, etc.)

Link to comment
Share on other sites

On behalf of all of us, welcome to the forum, Fridolin... good to have you with us.

Feel free to teach us things that you learn (thx).  Freely adjust our documentation, if you think adjustments need to be made.

You can also write NEW documentation/tutorials, such as "Advanced ESM Shadow Techniques". 

It needs to be written in GitHub .md markdown... which is real easy to learn. 

Then put the .md file into the correct GitHub folder.

Finally, adjust/add-to a file called statics.json.

After a fresh "docs-build", your new document will be rendered-as-HTML, and included in the BJS docs site (and you'll become a BJS super-hero).  :)

More info here.  Welcome 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...