Bump mapping

Originally posted by davepermen:
or how do you create your normalmap for worldspace stuff?

I take a texture (or an array, no matter), representing a height field. Then I convert it into a normal map, just as if I calculate vertex normals for a mesh. So I get a “tangent-space” normal map. Then I take my object’s mesh and calculate a transformation matrix from tangent space to object space for each normal, and then multiply it with the normal. (Actually, for my modeler’s meshes I just use functions, by which the mesh was created, so I don’t need high-tessellated meshes). Then I store the transformed normals in an RGB(A) texture. All this I’ve built in my modeler program, so I need only a source bitmap from photoshop (or any… ), or an array of height field, constructed from high-tessellated geometry…

Object space bumpmapping is good for static geometry. It is fast. It doesn’t load CPU and AGP bus as tangent-space technique does. Main drawback is that a bumpmap cannot be repeated on a curved surface, as you pointed it out above. However, it’s not a problem if the bumpmap represents not just roughness of the surface but tiny geometrical details, like parts of machines and mechanisms, sculpture images, etc. They usually don’t repeat exactly the same…
As to orientation in space… I don’t use vertex programs yet. (That’s because I’m still with official 6.5 drivers…) Maybe there are problems with it, I don’t know.
Ok, enough is enough, this gets very long one!
Alexei.

so you create the tangentspace to create the normals… ok… great i will think bout it… but now i want the ****ing specular working

its just boring… everything is projected to screenspace ( through modelview&projection matrix… the position, the light, the tangentspace… ) … in this space, the eyepos is ( 0, 0, 0 ), or isn’t it? so i have to calculate the halfangle ( normalized( normalized( point_to_eye ) + normalized( point_to_light ) )… i thought i have done this… damn…

Yes, you should transform your vectors from eye space to object space (and to tangent space if you need). But what’s the ifference between a light vector and a half-angle vector? You calculate your h-vector in
the world (eye) space, and then convert it into object space just as you do it with l-vector… However there is another problem with specular lighting. Good results are accepted with specular exponent about 128 or so… It cannot be achieved with GF(2) register combiners. The most accurate approximation which I got is
Intensity = 4096*((N’ dot H)-0.7828)^6 + 256*((N’ dot H)-0.7828)^4,
it’s better than commonly used (N’ dot H)^8 or (4*((N’ dot H)-0.75))^2
(without Max(0,…) for simplicity), but still much worse than ^128…
With the approximation mentioned above it’s possible to do diffuse@specular lighting
with two passes (with one general stage in register combiners for the first pass).
Unfortunately self-shadowing is correct only for diffuse lighting. For specular lighting it needs software emulation or additional passes…
So I think it’s better to use a cube map to encode specular lighting in it.
But not very shiny objects can get along without a cube map.
Well,I must go, bye to everyone (who are interested in bumpmapping ).
Alexei.

[This message has been edited by Alexei_Z (edited 04-21-2001).]