PDA

View Full Version : Yet another question about DOT3 bump mapping



passalis
01-14-2004, 06:04 AM
Hi,
I just added DOT3 bump mapping in my engine. The problem is that in all the tutorials I've found they perform some per vertex calculations with the light position (and store the result in glcolor). My question is how can DOT3 bump mao be used with any kind of vertex arrays (like VBO,CVA,display lists) without using vertex programs. Can these calculations be pre-computed somehow so that static geometry can remain in AGP?

If you know any alternative way to do it, please share it http://www.opengl.org/discussion_boards/ubb/smile.gif

Lurking
01-14-2004, 06:52 AM
Sure. You can transform the light and half angle vector into tangent space in software though its probly faster on a vertex program!

SeskaPeel
01-14-2004, 07:04 AM
passalis : no it can't be precomputed.

It could, only if both geometry and light are static. If this is the case, than absolutely all can be precomputed, and this is called lightmap.

Even for static geometry, as long as your light is dynamic, you'll have to perform some vertex computations (passing the light in tangent space, for each vertex).

SeskaPeel.

passalis
01-14-2004, 07:37 AM
From what I understood in order to transform the light vector I need the modelview matrix along with the vertex's tangent,normal and binormal. Correct?

I checked nvidia's effect browser and they have some examples with different kinds of bump mapping. In the Earth Sphere demo they show how to tranform the light vector both in software and with vertex programs. But for the actual DOT3 operation they use register combiners. Is this faster than using the DOT3 extension and no register combiners?

Also I noticed the offset bump maping in the other thread and it looks great but does not run in my Quadro4 (since it uses arb fragment programs). Is it similar to the offset bump mapping demo shown in nvidia's cg browser (this one uses NV texture shaders I think)?

tfpsly
01-14-2004, 10:33 AM
Originally posted by SeskaPeel:
passalis : no it can't be precomputed.

It could, only if both geometry and light are static. If this is the case, than absolutely all can be precomputed, and this is called lightmap.

You may compute the vertex to light vectors on the CPU and then you can store them in the color components of your vertex arrays. That would require some agp memory writing, but not that much.

[This message has been edited by tfpsly (edited 01-14-2004).]

AdrianD
01-14-2004, 11:26 AM
check this out: http://oss.sgi.com/projects/ogl-sample/registry/NV/texgen_reflection.txt