Followers 0

VSM severe acne

0 posts in this topic

********** EDIT: I've found a bug in the CPU side that wasn't my fault, I'm investigating and then update the topic, for now the following description is not valid anymore, if mods want to  close the topic it's fine to me ****************

I'm implementing a VSM algorithm. My code is pretty much like everything is online.

//coords is after the w divide and 0.5 + 0.5* corrections
float VSM(vec3 coords, float dist){

if(dist <= moments.x) return 1.0;
float variance = moments.y - (moments.x*moments.x);
variance = max(variance, 0.001);

float d = (dist) - moments.x;
float P_max = variance / (variance + d*d);

return pMax;
}


Here if I use a small value to clamp the variance as done in almost every source I found the result is a terrible acne:

If I start increasing the max value for the variance the acne diminish, although still evident. Also the proper shadow is definitely lighten (too much)

Eventually if I keep increasing such value the proper shadow disappear. Moreover the value to produce this image above is 6.0! Way higher than everything I saw around.

Similarly I've tried something like:

	float d = (dist + bias) - moments.x;


but I found no value that solve the problem, although not tried that many.

The depth map is I think fine because with PCF I get a good result.

What can be the issue here?

Thanks!

Edited by cifa
0

Create an account

Register a new account