Multiple Bump Maps on one surface?


I have my basic bump mapping, mapped to my current surface with the following code:

	glBindTexture(GL_TEXTURE_CUBE_MAP, normalization_cube_map);
		glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoordsNorm );
		glTexCoordPointer( 3, GL_FLOAT, 0, (char *) NULL );	

	glBindTexture(GL_TEXTURE_2D, texture[tGNormalMap]); 
		glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoordsGround );
		glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL );	

This works fine, but I now want to add a ‘sub texture’ to the surface.

I have multitexturing (obviously), so I also have a detail texture which goes over my base texture which is modulated over this current bump map.

I want to be able to add bump mapping to the detail texture and still have the original bump mapping intact.

Is this possible? If so, how would I go about it?

I would probably use a shader to do the combining.(it may be possible in texture stages, but much more difficult to get it looking nice)

Humus has a demo that does just that:
It is in D3D but the shader code should be esay to understand.

Up until now I have never used a shader, as I want my program to be as compatible as possible with older cards.

I shall have a look into shaders, but if anyone can tell me how to do it without shaders, I would be very grateful.

add_signed in the combiner might work, however it would need a very subtle detail normalmap, else you will destroy too much of the original.

so you might want to change the texture data of the detail normal map, in a fashion that the normals are short in length.
In all cases you loose the normalized length of the combine normal map, which will create issues with lighting intensity. And you cant renormalize it with regular combiners.

Yes, I have it working now and I know exactly what you mean. The original bump map is now darkening everything extremely… A bit of tweaking to my normal maps and I should have it as good as ever :smiley:

Thanks for your help.

*Acctually, the problem is not within the normals maps, it appears to be something to do with my Texture environment settings… I will get back to you if I cannot find the correct settings…

Another tip: If you want visually pleasing results, dont just average the base normalmap and the detail normalmap. You´ll get “muddy” results. Instead, look at the detail normalmap as detail that is added ontop of the base normalmap. (imagine a sphere-shaped normalmap that you want to add bumps and indents to make is look like an orange).
So, you first have to transform the detail normal vector into the space of the base normal. Then add both, then renormalize. Works beautifully :slight_smile:

I have been working off the sample code found on NeHe for this so I would not know how to

transform the detail normal vector into the space of the base normal. Then add both, then renormalize

But I have adjusted the normalization cube map and have got it looking pretty alright at the moment. A big improvement on how it used to look without the detail bump map :smiley:

This is most probably not possible with texture combiners. But offline or with the help of a fragment shader, it can be done easily.

But I have done it already? Sure I haven’t gotten a perfect result, but a little more tweaking to my normal maps and it should be fine.

Ok, I was happy with the two bump maps on one surface, and until I get into relief mapping, I now want three bump maps on one surface.

The only problem with this is that when I try doing what I did before, with another texture, it decided it wants to go black and white… The bump mapping itself is working, but I have lost all color in my image.

It appears as though any texture overand including GL_TEXTURE4 doesn’t want to show.

Is it possible that my graphics card supports no more than 4 textures per surface? I am using a GF 5900XT 128mb.


I go back to 4 textures and it works fine. But now I cannot get the result I wanted.

I want to map the same texture once scaled to 10, and another time scaled to 100 so that I can get different detail effects on my surface, am I able to do this in a single GL_TEXTURE and have both, or do I have to do two seperate, one for the 10 times scale, and another for the 100 times scale?

short note, what u want is very difficult, as u want the detail bumpmap to ‘be orientated’ with the underlying bumpmap. the only easy way is to not use bumpmaps but to store the heights instead and then just add the main height + detailheight together + create a normal from that in a shader.
though for all intents and purposes doing the way u are wont even though its wrong wont be to easily detected

you will have more texture image units available if you use fragment shaders/programs