Dad72

Shadow probleme black bar

Recommended Posts

Hi,

I think there is a problem with the version 3.2 shadow generator. There is a huge black bar that is larger or smaller depending on the changes we make to shadowMinZ and shadowMaxZ and when we add no mesh with addShadowCaster ()

The second bug is if I add a mesh, the bar is no longer visible, except that it is always present, because if you move a character animate in the alignment of this invisible black bar, it becomes visible.

https://playground.babylonjs.com/#B48X7G#15

Thanks in advance

Share this post


Link to post
Share on other sites

I forgot to mention that this only happens if we use this filter:

shadowGenerator.usePercentageCloserFiltering = true;

With other filters this problem does not appear

 

Share this post


Link to post
Share on other sites

Hello,

All of the mentioned points are the result of the computation of the scene extends for the shadows. Basically in PCF several taps are made on the Shadow map to compute the final shadow. 

We prevent with this PR to compute huge extends when no meshes are present solving 1. https://github.com/BabylonJS/Babylon.js/pull/4712

About the second point, I am unfortunately unbable to repro, could you create another PG highlighting the issue ?

 

Share this post


Link to post
Share on other sites

I do not know how to reproduce it, it can be due to a lot of things.

I think it's following the orientation of the camera. But what is strange is that it is very random, it happens for example when I'm on the mesh of my city and more su the field and other times, it is on both.

I try to make a PG, but I do not know what causes it at home, so I do not reproduce anything on the PG.

I do not know how to help you with a useful repro. I should already understand why this is happening, but I do not understand yet.

That's what I have :

355829295_2018-07-1000_37_39-Greenshot.thumb.jpg.1956c874780ef46737b3076798d96212.jpg

Share this post


Link to post
Share on other sites

This improves a little bit by putting a big value of 1.0 (100%) of shadowOrthoScale , but it stays there.

Look on the pictures. if I leave by default shadowOrthoScale , I have streaks on the shadow of the character.  depending on the orientation of the character or the camera. IF I turn my character to the right or left, no problem. This only happens on the line of the black bar that we can currently see if we do not add mesh to the shadow generator using this filter only usePercentageCloserFiltering 

On static meshes no problem, maybe it comes from the fact that the character is animate or has bones (which I suppose)

763728745_2018-07-1012_28_45-Greenshot.jpg.1c40cb360d40a31835da7fdc95bc8802.jpg

If I increase shadowOrthoScale, there are fewer sorts, but there are still some and I still have the problem, but less present.

445569165_2018-07-1012_32_40-Greenshot.jpg.aaeeb2ece347d9a63fd13858a07dc2cc.jpg

Looks like the problem comes from there. Look at the shadow of this video how it works according to stri:

Captured video Webm

 

 

Share this post


Link to post
Share on other sites

I have to test : exclude of the hemispherical light the sidewalk mesh so that it is only illuminated by both directionals and the problem this product on the ground now.

I do not understand what produces this, but I think there is a little bug with this filter.

857511220_2018-07-1013_18_11-Greenshot.thumb.jpg.f614bbea6eb73c2e56e8bdbb97f9e50a.jpg

Share this post


Link to post
Share on other sites

This looks like you have self shadow turned on and you have got acnea. black to white regular stripes.

Could you increase the bias a bit ? PS: you can also play with normalBias to prevent it at grazing angle.

Share this post


Link to post
Share on other sites

Ok, the bias fix, the shadows are ok. But I still have this shadows extended when I move my character. if I stop it, no problem, but running, I have this:

 If I disable the filter (usePercentageCloserFiltering ), it works well. If I use another filter, no problem either. It's really only with this filter that I get that when I move a character and the camera is in a certain direction.

Left : walk. right: stop

404520455_2018-07-1017_32_48-Greenshot.thumb.jpg.fe37f6f6dd470506534f36462887f0b4.jpg 1439576929_2018-07-1017_32_50-Greenshot.thumb.jpg.cf214da53dfe470815a97daa0021ad31.jpg

I do not have a PG, because I do not know how to reproduce it because I do not know what this problem is. 

With your audit trails, I may end up finding out why and can be doing a useful PG.

Thank you

Share this post


Link to post
Share on other sites

Ok, I managed to reproduce on a PG the problem.

Wait for the complete loading of the character, there is for a moment, because there is a file of 20 mo which loads all the animations.

To see the problem move the character in a circle (key Z) and you will see what I see in the image of the post above.

http://www.babylonjs-playground.com/#IFYDRS#10

it's been 4 hours that I try to make this PG, it was hard to reproduce it, I was afraid to have to recreate all my play on the playground, which would have been impossible.  it seems to be linked to the fact that the character is animating or because he has bones.

Share this post


Link to post
Share on other sites

Should be good now: http://www.babylonjs-playground.com/#IFYDRS#12

This is mostly because we need to avoid reading data from the border of the texture :) (check line 36)

I also recommend to boost the shadowOrthoScale a bit (0.2+) to make sure the shadowmap encompasses all the bones :)

Share this post


Link to post
Share on other sites

Oh, cool. Big thanks DK, there is so much parameter with the shadows. It's really hard to get nice shadows, but we can.

Thank you again and sorry for the loss of time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.