Jump to content
  • Advertisement
Sign in to follow this  
_Madman_

Help with bumpmapping needed

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

I'm trying to set up a framework for bumpmapping, but after 1 year of doing nothing in this case I can't get through those space transformations. Currently my vertex shader looks like this:
uniform vec3 t;//Tangent from program
uniform vec3 b;//Binormal ...
uniform vec3 n;//Normal ...
varying vec3 l;//light to fsh

void main(void)
{
	mat3 tbn = mat3(t,b,n);//t,b,n to matrix;
	vec3 lpw = vec3(2.0,2.0,2.0);//Light position in world space
	vec3 lpe = lpw-vec3(0.0,0.0,8.0);//Conversion from world coords to eye coords
	vec3 lpo = gl_NormalMatrix * lpe;//IT to transform light position from eye space to object space
	vec3 lvo = lpo-gl_Vertex.xyz;//going from light position (obj space) to light direction (obj space).
	l = tbn * lvo;//light direction into tangent space
	gl_Position = ftransform();
	gl_TexCoord[0] = gl_MultiTexCoord0;
	gl_TexCoord[1] = gl_MultiTexCoord1;
}


I have a quad at (0,0,1) rotated using glRotatef(angl,0,1,0); and Look at (0,0,8,0,0,0,0,1,0); But lighting is definately wrong. [Edited by - _Madman_ on October 19, 2004 2:01:53 PM]

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!