Archive 17/01/2023.

Shadow Map Normal Offset Bias

Enhex

Normal Offset seems like a better way to eliminate self-shadowing with much less to virtually no peter panning:
dissidentlogic.com/old/image … Offset.png

dissidentlogic.com/old/ (has explanation video)
digitalrune.com/Blog/Post/1765/Shadow-Acne
ndotl.wordpress.com/2014/12/19/ … adow-bias/
mynameismjp.wordpress.com/2013/ … adow-maps/
c0de517e.blogspot.co.il/2011/05/ … notes.html

Bananaft

Aren’t there already “Depth Slope Bias” aka slopeScaledBias parameter ?

Enhex

It’s kinda confusing, but slope scale bias is something else, it’s about scaling the constant depth offset according to the angle of the slope, and that causes severe peter panning.

I recommend watching the video, it explains the difference between constant & slope bias and normal offset bias:
dissidentlogic.com/old/video … s_0001.wmv

Daniel Holbert also uploaded a tech demo on that website that works with Nvidia FX Composer.

cadaver

Normal offset shadow bias is in. See added normalOffset_ member in BiasParameters.

According to my tests this is most useful on desktops, as on mobile devices the shadow coordinate interpolation is rather low precision.

1vanK

Oh, Slope Bias + Normal offset works perfect!

Some tests:

  1. Without bias
  2. Constant bias
  3. Slope bias
  4. Normal offset
  5. SlopeBias + Normal offset
rikorin

Huge Thank You for this, it works amazing! No more detached shadows.
Though now it became apparent that physics objects are not touching the surface :slight_smile:
How can I change the distance of contact for physics objects? (figured it out, have to change margin for the floor, not the object )

Enhex

So glad it’s been added!

[quote=“rikorin”]Huge Thank You for this, it works amazing! No more detached shadows.
Though now it became apparent that physics objects are not touching the surface :slight_smile:
How can I change the distance of contact for physics objects? (figured it out, have to change margin for the floor, not the object )[/quote]

With Bullet physics you have a default collision margin that for most shapes extrudes outwards. You’ll just have to take it into account when matching the size of the model and collision shape.
Good video about it: youtube.com/watch?v=BGAwRKPlpCw

rikorin

Thanks for the video, you’ve probably saved me a lot of time and nerves in the future :3
And Bullet is really good.