Sign in to follow this  

Help with Steep Parallax Mapping shadows

Recommended Posts

I've got Parallax Mapping up and running using a linear depth trace and the tangent view vector to obtain the displaced texture coords. The paper i'm following uses ps3 and while loops, but i want it to work with ps2 hardware.

vec3	displacementTrace(int numIterations, vec3 tangentViewVector, sampler2D texture, vec3 texcoord){

    float 	distance2Trace;
    float	normalizationFactor	=	1.0/numIterations;
    vec3 	offset 			= 	normalize(tangentViewVector)*normalizationFactor;
    vec3	texCoord 		= 	vec3(texcoord);
    // RAY MARCH  
    for (int i = 0; i < numIterations; i++) {
	distance2Trace = texture2D(texture, texCoord).a;
	texCoord += distance2Trace * offset;
    return texCoord;
vec3 	texCoord = displacementTrace(NUM_ITERATIONS,tanEyeVec,tex2,gl_TexCoord[0]);

Now I want to add self-shadow to the above, but am having problems understanding the methods I have found on the internet. As I understand it, I need to do another linear trace using the tangent light vector, but my results are incorrect. Any help would be appreciated. [Edited by - _Lopez on August 12, 2008 5:03:41 AM]

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