Jump to content
  • Advertisement
Sign in to follow this  
Eps

OpenGL Real Quick Question on EMBM

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

In the opengl extension registry for ATI_env_bumpmap it says. This (du,dv) offset is also rotated through a user-specified rotation matrix to get the texture coordinates into the appropriate space. Is this essentially saying you need to put it into tangent space?

Share this post


Link to post
Share on other sites
Advertisement
No, the matrix is 2x2. EMBM really is just a hackish way to achieve environment bump mapping that really isn't grounded in theory very well. It can look good on hardware that suppports nothing else though and is much cheaper than the "correct" way to do it.

Share this post


Link to post
Share on other sites
Could you maybe point me in the direction of the "correct" way to do it?

Share this post


Link to post
Share on other sites
Okay, I googled it and read an Nvidia pdf document on the idea of reflective bumpmapping. Maybe I'm interpreting this wrong, but I don't see how it takes your geometry into the reflection. It seems to only read off of the cube-map, which is practically the same thing as all your skybox textures in one large texture. I want my terrain geometry included in the reflection.

Share this post


Link to post
Share on other sites
Quote:
Original post by Eps
I want my terrain geometry included in the reflection.

Then you have to render it to cubemap yourself. No other (cheap) way around it.

Share this post


Link to post
Share on other sites
Well it seems that reflective bumpmapping is oriented more for non-planer surfaces. Lucky for me, I am using a planer surface and so EMBM suits me just right. I'm creating water for a project and have been able to reflect everything onto it with no problems. I can bump map it as well. However I'm having problems perturbing the reflected texture. I hate to just ask what's wrong with code, but maybe a snippet will give a better idea of what I'm trying to do.


// UNIT 0
glActiveTexture(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texID);

// UNIT 1
glActiveTexture(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, offID);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, BUMP_ENVMAP_ATI);

// UNIT 2
glActiveTexture(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, bumpID);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT);

glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);


Now obviously on texture unit 2 I am applying the bumpmapping wrong, which I assume I need to correct by using BUMP_TARGET_ATI. Would this be the correct order of operations once that change is made? Also, I can't seem to find any good documentation on how to do this.

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!