Jump to content
  • Advertisement
Sign in to follow this  

soft shadow edges

This topic is 4373 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

im using horizon based shadows for my terrain engine and i calcualte it real-time in my fragment shader... butthe shadow edges get way to shadrp.. how could i blur them nad make the softer?
#version 110

varying vec3 Vertex;

uniform sampler2D horizons;
uniform sampler2D normals;
uniform float angle;

void main()
	vec3 Normal = texture2D(normals, gl_TexCoord[0].st).rgb*2.0-1.0;
	vec3 LightDir = vec3(-cos(angle*0.01745329), -sin(angle*0.01745329), 0.0);
	float LightSlope = LightDir.y/LightDir.x;
	float HorizonSlope = texture2D(horizons, gl_TexCoord[0].st).x;
	float Shadow = LightSlope <= HorizonSlope ? 0.3 : 1.0;
	float brightnes = dot(LightDir, Normal)*Shadow;

	gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0)*brightnes ;


basically what id like to do is to blur the values i get for "Shadow" for each pixel.. one way i coudlve dne this i using teh vertex shadow for the calc of "Shadow" and then it gets interpolate dinto the fragmetn shader.. but since im using LOD.. thsi si not an option.. Image Hosted by ImageShack.us EDIT:: Just noticed that this image isnt correct... but it has the same problems with the sharp shadow edges...

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!