Black Bumpmaps
Hello its my first time posting in these forums and I had an interesting dilemma....Tonight I finally figured out how to implement bumpmaps but for some reason just as soon as I add them in all my textures go black except for spectural light....I am using glMaterial to colorise and have blending disabled but unfortunately this also disables my ability to properly colorise the base texture....
Here is a simple rundown of what I do to enable my bumpmaps and draw...
It bumps just great and draws the texture underneath but I have to totally disable glMaterial with : glEnable(GL_COLOR_MATERIAL); and use the conventional calls with glColor4f etc... And then I only get a small patch of light on my quad like a large specular reflection....Is it something to do with my combiners? Do I have to add in some extra combiners to get it to be properly lit? All I know is everything went to black when I added bumpmaps...I take them out and everything looks fine...
Heres a sample image of what it looks like when bums are enabled...
http://celestialvisions.net/pics/bbm1.jpg
And disabled:
http://celestialvisions.net/pics/bbm2.jpg
Its still dark but its the random color that was chosen for that planet...
Here is a simple rundown of what I do to enable my bumpmaps and draw...
Code:
glDisable(GL_BLEND);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, id1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
glEnable(GL_TEXTURE_2D);
// The DOT3 Bumpmap Texture
if (g_useEXTdot3) {
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, id2);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGBA_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
glEnable(GL_TEXTURE_2D);
}
glMaterialfv(GL_FRONT, GL_AMBIENT, white);
glMaterialfv(GL_FRONT, GL_DIFFUSE, white);
glMaterialfv(GL_FRONT, GL_SPECULAR, white);
glMaterialf(GL_FRONT, GL_SHININESS, 100);
all the drawing stuffIt bumps just great and draws the texture underneath but I have to totally disable glMaterial with : glEnable(GL_COLOR_MATERIAL); and use the conventional calls with glColor4f etc... And then I only get a small patch of light on my quad like a large specular reflection....Is it something to do with my combiners? Do I have to add in some extra combiners to get it to be properly lit? All I know is everything went to black when I added bumpmaps...I take them out and everything looks fine...
Heres a sample image of what it looks like when bums are enabled...
http://celestialvisions.net/pics/bbm1.jpg
And disabled:
http://celestialvisions.net/pics/bbm2.jpg
Its still dark but its the random color that was chosen for that planet...
I have yet to have the joy of crossing this hurdle, but perhaps take a look at this thread with source code:
http://www.idevgames.com/forum/showthread.php?t=8937
http://www.idevgames.com/forum/showthread.php?t=8937
I am the one who ported the above mentioned example code. I am really a newbee at glTexEnvf calls and I just made a port. I don't really understand the OpenGL calls. I do understand the theory however. I may think that your rendering with bump mapping may actually be correct. My example has no ambient light and no specular light. For a sphere as used in your example this would indeed mean that the non lit parts will be black. I however see no extra bumpiness on your example so I might wonder if anything at all happens.
Also my example explicitly tells the light position in the rendering pass (by using a (normalising) cube map texture). I see nothing of that kind in your code. I assume therefor that you are using another technique. If you get it to work with your technique could you post the source code and maybe reference to the theory behind your technique?
Also my example explicitly tells the light position in the rendering pass (by using a (normalising) cube map texture). I see nothing of that kind in your code. I assume therefor that you are using another technique. If you get it to work with your technique could you post the source code and maybe reference to the theory behind your technique?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Discrad black parts in texture | bonanza | 7 | 5,003 |
Oct 27, 2011 01:05 AM Last Post: bonanza |
|
| Fade Particle to black | bonanza | 8 | 4,698 |
Apr 3, 2008 05:24 AM Last Post: bonanza |
|
| Blending -> Black Lines Through Textures (Wireframe like) | hangt5 | 2 | 2,991 |
Apr 5, 2005 05:06 AM Last Post: ThemsAllTook |
|
| glOrtho and a black screen | Taxxodium | 4 | 4,989 |
Sep 27, 2004 01:30 PM Last Post: Vertizor |
|

