Jump to content
  • Advertisement
Sign in to follow this  

VSM severe acne

This topic is 1485 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

********** 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){

	vec2 moments = texture(shadowTexture, coords.xy).rg;

	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?



Edited by cifa

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!