EnvMap and MultTexture

Started by
3 comments, last by alex_r 19 years ago
How I use a envmap in mult-texture to give a reflex effect to my model??? Thx
Advertisement
Google --> "Reflective Bump Mapping"

I am guessing you are using Multitexturing to texture map a surface with multiple textures. Assuming you know how to calculate reflection vector using view and normal vector either per vertex of per pixel. Now use this reflection vector inside the pixel shader to look into the environment map.

To load an environment map use GL_TEXTURE_CUBE_MAP_ARB.
Thanks for the answer...

This is with shader right?!
I see some samples just with shader in google, some in ATI and nVidia sites...

I can't like to use shaders now, I just can use the glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); and glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);...

I'm using the vertex array to render my model, I made it to start the mult-textures:

// Metal texture
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, t_Metal);

// "Reflex" texture
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);

glBindTexture(GL_TEXTURE_2D, t_Reflex);

the problem is, where I place the glEnable(GL_TEXTURE_GEN_S); and glEnable(GL_TEXTURE_GEN_T); :-/

I made some test but the results is like I didn't start the GL_S and GL_T...
when you call glActiveTexture( ... ), you actually need to call glClientActiveTexture( .... ) before it, and you also need to enable S and T coordinate generation; eg:

glClientActiveTexture( GL_TEXTURE0_ARB );glActiveTextureARB( GL_TEXTURE0_ARB );glEnable( GL_TEXTURE_2D );glBindTexture( GL_TEXTURE_2D, t_Metal );// "Reflex" textureglClientActiveTexture( GL_TEXTURE1_ARB );glActiveTextureARB(GL_TEXTURE1_ARB);glEnable(GL_TEXTURE_2D);glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2);glBindTexture(GL_TEXTURE_2D, t_Reflex);glEnable( GL_TEXTURE_GEN_S );glEnable( GL_TEXTURE_GEN_T );
hope that helps..
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
yes, is that what I like :D

Thanks

This topic is closed to new replies.

Advertisement