Sign in to follow this  
Dragon_Strike

soft shadow edges

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this