Problem with bumpmapping

Started by
4 comments, last by MessageBox 20 years, 6 months ago
I've bumpmapped a sphere with a normalisation cube map but I seem to be getting a weird effect where the lightvector is perpendicular to the normal. Could someone take tell me why I'm getting this effect in the following pics? http://homepage.eircom.net/~Sharpshooter/Sphere_1.jpg http://homepage.eircom.net/~Sharpshooter/Sphere_2.jpg http://homepage.eircom.net/~Sharpshooter/Sphere_3.jpg http://homepage.eircom.net/~Sharpshooter/Sphere_4.jpg Edit: And how do you post a link in these forums?? [edited by - MessageBox on October 9, 2003 3:06:46 PM]
Advertisement
It looks like you''re not saturating your N.L. If using a pixel shader do:
dp3_sat r0, t0_bx2, t1_bx2

assuming that t0 = BM and t1 = light direction.

If you don''t saturate, the value can wrap which is what it looks like is happening.

I think you could be right about the wrapping but I''m not using a pixlel shader:

glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

I have used GL_CLAMP_TO_EDGE to stop the wrapping but it doesn''t seem to have an effect
I''m refering to the wrapping of your dot product. Since the dot product is a signed operation, if its less then 0 it will wrap. So you need to clamp your dot product operation to the [0,1] range. I''m not sure how to do this with OpenGL combiners (is that what you''re using?) but look for a CLAMP or SATURATE parameter for your DOTPRODUCT3 (or equiv.) operation.
Yeah, you were right, I wasn''t clamping the normals in the cube map, it works fine now.

http://homepage.eircom.net/~Sharpshooter/Sphere_5.jpg
Awesome, glad I could help. I had problems like this too at one time.

This topic is closed to new replies.

Advertisement