Simple BumpMapping Question

Does BumpMapping add significant overhead? I am thinking about adding it to my Quadtree Terrain engine, but I am worried that it might slow things down too much…

Thanks in advance for any input…

I just added bump mapping to my terrain engine, so I might give you some hints.

  • the improvement in visual quality is dramatic, so it is really worth the effort. In my engine, the terrain has a rather low resolution color texture, combined with a very fine bump texture, and it looks really great and much more realistic than with only the color texture

  • performance loss mainly depends on two things: a) which hardware you are using and b) if only diffuse bump mapping is sufficient or if you also need specular lighting.

Afaik, on ATI hardware using pixel shaders (fragment programs) is as fast as using fixed function pipeline, so bump mapping would not cause any performance loss at all (at least, if you use diffuse bump mapping only).

My program is running on nvidia hardware and there, using NV_fragment_program with low precision registers causes a slight slowdown (~5-10 %) when using diffuse bump mapping only, and quite a lot (~30-50 %) when also rendering specular highlights. So I decided to use only diffuse, and performance can also be improved by using bump mapping only for the parts of the scene that are near enough for the viewer to acutally see the bumps… for the other parts of the scene, you obviously do not need bump mapping. So when only drawing the ground, no objects, trees, water or sky, performance of my program went down to ~180 from ~200 fps.

Jan

Hi, can you maybe post a screenshot? Because Im kinda thinking about using a detail bump map in combination with texture splatting, but Im not sure how the bump mapping would turn out, since I always thought youd need movement between the object and light source for the best results for bump mapping, otherwise you dont get as much of a sense of bumpiness :slight_smile:

The worst case scenario for bump mapping is when you have a bump map tiled on a flat surface under an infinite light source. Under those conditions, the lighting from the bump map looks perfectly tiled just like a regular texture. It makes it so that you have to move the light around to get a good sense of bumpiness.

The addition of per-pixel specular to the same scene will break up the repetition in the lighting and make the bumps more visible. What helps even more is to use a local light source, but you can’t usually do that in outdoor scenes.

I would second that. Under a directional light, a bump map reduces about to a standard grayscale detail texture that you would GL_MODULATE or GL_ADD_SIGNED.

Oh yes, terrain always looks shiny to me. Deffo worth per pixel lighting. Use a static light map texture.

screenshots, they are a little outdated and there still is a bug in the program, but you can see how the bumps enhance the visual quality:

http://de.geocities.com/westphj2003/scene1.jpg
http://de.geocities.com/westphj2003/scene2.jpg
http://de.geocities.com/westphj2003/scene6.jpg
http://de.geocities.com/westphj2003/scene8.jpg

it the links don’t seem to work, simply re-type them in the browser’s url field and hit enter, for strange reasons, they don’t work when clicked on, but do so after hitting enter in the url field.

It is true that the bump effect degenrates to something you could theoretically also do with a light map when only having one static directional light source, but it is still a great improvement… simply due to adding a fine granularity to the terrain.

edit:

I just added some acual screenshots:

http://de.geocities.com/westphj2003/a.jpg
http://de.geocities.com/westphj2003/b.jpg
http://de.geocities.com/westphj2003/c.jpg
http://de.geocities.com/westphj2003/d.jpg

but it is still a great improvement… simply due to adding a fine granularity to the terrain.
So what you’re saying is that using tangent space per pixel lighting, you get better resolution because you’re using a small normal map locally rather than a large precalculated light map.
It’s a valid point.

Yes, I guess that is what I mean. During the project, we made the experience (in fact, we knew before) that the design aspect of a terrain simulation is lot more effort than the programming work… and combinig a large color texture with a finer bump or color texture is a very efficient way to make things look more natural. We did this with simple multitexturing before, to make a tiled color texture look less repetative and monotonous by adding another one, and doing this with a bump map is giving even much better results. Did you look at the screenshots? I think the effect is self-explanatory.

<http://uk.geocities.com/sloppyturds/zed.html is bugger the large color texture and just go for multiple detailed textures (blended together, splatted) its what im doing at the bottom of this page http://uk.geocities.com/sloppyturds/zed.html hmmm looking at it there it doesnt look as good as large color + detail but believe me it is ‘in the flesh’ the downside is though u idealy need more powerful hardware.
azcoder - dont worry about it slowing down, that is the least of your concerns, the visual benifits of bumpmapping are huge.

So the best result is to use both diffuse texture, a detail texture and a bumpmap?
Or do u use the bumpmap instead of the detail map? Can you create the bumpmap texture from the detail map?

Regards, Ninja

Following on from my previous comment…
The tangent space bump mapping only breaks up the repetitiveness of the normal map if there is variation in the angle of each surface it’s applied to…in a terrain, you’ll get large areas of flatness, which combined with an infinite light give you ugly tiling. So, the bump map is not useful in those circumstances.
I’m finding it difficult to envisage a situation where normal mapping would enhance the terrain, parallax mapping maybe, but plain old dot3 diffuse is not going to give you any advantage over a static light map. Your screenshots could just as easily be of a lightmap than a normal map.

knackered, I doubt what you are saying, my experience is that adding a bump map enhances the quality very much, it does not look tiled and could not be achieved by adding a simple second color-/lightmap.

‘The tangent space bump mapping only breaks up the repetitiveness of the normal map if there is variation in the angle of each surface it’s applied to…in a terrain, you’ll get large areas of flatness, which combined with an infinite light give you ugly tiling.’

i believe youre mentioning two different types of terrain bumpmaps
A/ a large one (simulating opengl per vertex lighting, but with greater resolution)
B/ detailmap bumpmapping

now im sure everyone agrees A/ is a good thing and looks great (of course if the terrain is 100% flat its not gonna enhance it at allthough)
B/ can lead to tiling esp if u use just the one bumpmap texture throughout (unless u get rid of the high frequency crap in the texture, which tends to nullify the whole effect).
thus a good method is to blend multiple bumpmaps together thus getting rid of the tiling effect

‘I’m finding it difficult to envisage a situation where normal mapping would enhance the terrain, parallax mapping maybe, but plain old dot3 diffuse is not going to give you any advantage over a static light map. Your screenshots could just as easily be of a lightmap than a normal map’

a bit diffucult to simulate the sun moving with a lightmap.

faceit bumpmapping is prolly the single biggest thing to hit computergraphics in the last 30 years (bar hardware acceleration)

Mmm, why would simulating the sun moving be of concern in a game? Even if I agreed that a moving sun is worth millions of dot products per frame, the speed the sun moves would give many many frames in which to recalculate a lightmap.
No argument about bump mapping being revolutionary…but really only for geometry reduction, not for replacing stuff that ain’t broke.

what about this aspect: I added bump mapping (detail), and it looks much better now. Isn’t this proof enough?

I’ve looked at your screenshots Jan, and I must repeat my earlier observation - it could have been done with a detail light map.

May I add something ?

Originally posted by knackered:
- it could have been done with a detail light map.
Yes. Of course. But this detail lightmap would have been a super huge resolution. Just look at http://de.geocities.com/westphj2003/b.jpg you will see that the bump map is quite small and tiled a lot over the terrain. A detail light map would only be effective for a totally flat terrain.

Even though I love bump mapping and I recommend it for pretty everything at this board, I have to admit it’s not my favourite shading for terrain rendering.
Bump mapping could really improve terrain rendering if used in conjunction with horizon mapping or virtual displacement mapping but this will kill both memory usage and performance. Without such advanced bump mapping techniques, you will merely not make the difference between a detail map and bump map since terrain normals have a priviliged direction. And detail mapping is supported on much wider range of hardware, plus is rendered much faster and uses less texture memory (greyscale image instead of RGB-encoded normal maps) and wastes less texture units than bump mapping.

Real-time moving sun isn’t a problem either. Sun movement (yes I know the Sun does not move, the Earth rotates around itself) is so slow that it is negligible to move bumps in realtime when the sun moves.

As a last note, I can’t stand how http://de.geocities.com/westphj2003/b.jpg shows the efficiency of bump maps. This picture is a combination of two maps : a low-frequency map (colormap or lightmap) and a high-frequency map (the bump map). The same thing could just happen with detail map replacing the bump map.

Please note that the terrain is not very flat at certain spots, and also, bump mapping will take the light vector into concern, what a detail color map will not do… lighting can quite easily be replaced by point lights (for example, car lights) and the of course the bump mapping will take advantage. And even if it can also be done with a color map, it can still be done with bump mapping, which will not cost very much performance. And of course the idea is to add specular lighting later (with faster hardware :wink: ) and probably create a night scene with some point lights.

edit:

added some screenshots from a different scene which is not as flat, maybe they are more convincing.

http://de.geocities.com/westphj2003/e.jpg
http://de.geocities.com/westphj2003/f.jpg
http://de.geocities.com/westphj2003/g.jpg
http://de.geocities.com/westphj2003/h.jpg
http://de.geocities.com/westphj2003/i.jpg