how to get rid of peter panning completely using cascaded shadow maps?

I am making a voxel open world game with C and opengl 4.0. I implemented cascaded shadow maps using this tutorial: https://learnopengl.com/Guest-Articles/2021/CSM

I cant get rid of peter panning no matter how I set the bias variable. My shadows looks like this: current shadows

As you can see there are thin gaps between cubes and their shadows. I dont want that.

This is how I set bias variable:

float bias = max(0.005f * (1.0f - dot(normal, lightDirection)), 0.00028f);
const float biasModifier = 0.2f;
if(layer==0){
bias *= 1 / (cascade0range * biasModifier);
}
else if(layer==1){
bias *= 1 / (cascade1range * biasModifier);
}
else if(layer==2){
bias *= 1 / (cascade2range * biasModifier);
}
else if(layer==3){
bias *= 1 / (cascade3range * biasModifier);
}

If you want to see all of the code, this is the repository of the project: https://github.com/SUKRUCIRIS/OPENGL_VOXEL_GSU

I tried to decrease bias variable more but it caused shadow acne and even then the gap was still there: shadow acne still there is a gap



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation