Jump to content
  • Advertisement
Sign in to follow this  
Hermes

Emboss bumpmapping

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

Hi ya guys i know reading is pain but hear me out. I use multitexture exensions to make some fake emboss the problem is that at the second pass i don't see the detail texture but only the the bump texture and the inverted bump texture that should have been underneath.I highlighted the place where the problem arises
void DrawSceneWithExtension()
{

	GLfloat c[4]={0.0f,0.0f,0.0f,1.0f};
	GLfloat n[4]={0.0f,0.0f,0.0f,1.0f};
	GLfloat s[4]={0.0f,0.0f,0.0f,1.0f};
	GLfloat t[4]={0.0f,0.0f,0.0f,1.0f};

	GLfloat l[4]={0.0f,0.0f,2.0f};

/*//////////////////////////////FIRST PASS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Tex#0
1.no blending    4.non offset texture coordinates  6.offset texture coordinates
2.no lighting    5.GL_REPLACE -texture operation   7.GL_ADD  
3.bump texture   Tex#1

//////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
glDisable(GL_LIGHTING);
glDisable(GL_BLEND);
//TEXTURE-UNIT #0
glActiveTextureARB(GL_TEXTURE0_ARB);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,gTexBump);

glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV,GL_COMBINE_RGB_EXT,GL_REPLACE);

//TEXTURE -UNIT #1

glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,gTexInvBump);

glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV,GL_COMBINE_RGB_EXT,GL_ADD);

glDisable(GL_BLEND);
glDisable(GL_LIGHTING);

glBegin(GL_QUADS);


n[0]=0.0f;
n[1]=0.0f;
n[2]=1.0f;
s[0]=1.0f;
s[1]=0.0f;
s[2]=0.0f;
t[0]=0.0f;
t[1]=1.0f;
t[2]=0.0f;


	for( int i=0;i<4;i++)
	{

      c[0]=data[5*i+2];
	  c[1]=data[5*i+3];
	  c[2]=data[5*i+4];

	  SetUpBumps(n,c,l,s,t);



						
						// Display the top left vertex
						glMultiTexCoord2fARB(GL_TEXTURE0_ARB,data[5*i],data[5*i+1]);
						glMultiTexCoord2fARB(GL_TEXTURE1_ARB,data[5*i]+c[0],data[5*i+1]+c[1]);
						glVertex3f(data[5*i+2],data[5*i+3],data[5*i+4]);

						
	}

glEnd(); 

/*////////////////////////////////SECOND PASS(problem here)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D,gTextureID);/*this is the detailed texture*/
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);




glBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
glEnable(GL_BLEND);

glBegin(GL_QUADS);

				for( i=0;i<4;i++)
				{
				
					glTexCoord2f(data[5*i],data[5*i+1]);
					glVertex3f(data[5*i+2],data[5*i+3],data[5*i+4]);

				}				

glEnd(); 


}

data is an array which has 5 coordinates on a row(the first two are texture coordinates and the last three are vertex coordinates as you probably know) Thanks in advance for your help!

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure I will be very helpful in replying here, but the point is you should really forget about emboss bump-mapping. It looks crap, is pretty hard to setup, renders a very limited set of lighting effects, and today any graphics card can perform DOT3 bump-mapping for just about 50 bucks.

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!