#Shadowmapping OpenGL - Acne

27 messages · Page 1 of 1 (latest)

worldly lintel
#

I'm trying to implement shadowmapping using OpenGL. So far I've gotten stabilized cascades working, and I'm trying figure out if everything works properly and how to deal with the shadow acne to a reasonable degree. I have implemented a receiver plane bias, but noticed something weird one on of the meshes.

Shader can be found here: https://github.com/Cryru/Emotion/blob/master/Emotion/Assets/Shaders/MeshShader.frag

I need someone to mentor me a bit in this
Please help ;_;

GitHub

A game engine. Contribute to Cryru/Emotion development by creating an account on GitHub.

cold path
#

more bias is needed

worldly mason
#

bias
Weird way to spell vsm but aight

worldly lintel
#

I increase the bias but the shadows are still blocky like on the screenshot
Also it makes everything else peter pan like crazy
How would I go about biasing this object in particular, do I hardcode a bias per mesh? That doesn't seem very scalable

cold path
#

you use normal offset to fix peter panning

#

to fix aliasing you make cascades

#

except it doesn't fix aliasing KEKW

#

to fix aliasing you either do RT or you filter your shadows enough so that it's less noticeable

short pollen
worldly lintel
#

@short pollen Thanks for that link, I had already gone through most of those and none seemed to solve my issue

@worldly mason
Implemented VSM, and while most problems went away, the model still exhibits the same problem. (Also light bleeding lol)
I'm starting to think it's the model's fault? I got from here - https://www.kenney.nl/assets/animated-characters-2
The link with the shader above has been updated

Download this package (8 assets) for free, CC0 licensed!

cold path
#

but that's fine the good VSM isn't really meant to be implemented by normal people

#

only those whose brain has rotted due to too many brainworms

worldly mason
#

variance shadow mapping is good for some situations anyways, so it's good to have at your disposal

#

but yeah for directional shadows it's not great because of the leaking (unless your scene is built for it)

#

as for your problem, I'd try a different model to make sure it exhibits the same issues. I noticed that the test model I made in blender was trolling me for a long-ass time because the normals were jacked up bleakekw

#

which leads to my other suggestion, which is to use flat normals for biasing the receiver plane, if you're going that route, instead of interpolated normals

worldly lintel
#

thanks for the response
I'll try those ^^

worldly lintel
#

would it be feasible, as a measure against shadow acne, to hash each triangle and write the hash to the shadow map. then when sampling it if the shadow receiver is the same triangle as the shadow caster we ignore it?
I guess you would still get acne from where two triangles cover each other from the view point of the light, maybe combined with some world position bias it would be fine?

worldly mason
#

that's similar to the idea of storing the triangle ID in the shadow map and doing a ray-triangle test against it, but it has the same problems

#

to make that technique robust, you have to store a linked list per shadow texel which isn't very cheap

worldly lintel
#

a linked list of each triangle that contributed to that texel?

worldly mason
#

I personally don't think the technique is worth it, but you can still try

worldly lintel
#

probably isn't, but it sounds interesting enough to look into, I might learn something

worldly mason
#

for sure, and that's a good mindset to have

cold path
#

oh damn HFTS shadows