i’ve implemented a simple Dot3 bumpmapping based on the Radeon Tutorial by ATI. All works fine, but there is still a question:
I know dot3 bumpmapping is a pixel and vertex based operation. Pixel based for combine the textures and vertex based for calculate the lightvector…
Is there any way to combine the result of the vertex based light calculation with vertex buffer objects?
I think it’s not an efficient way to render complex objects (1000+ more Vertices) for dot3 bumpmapping with loops and glVertex3f after setting the color value vor each vertex …
Normaly i use VBOs for render my scene. If this should not be possible, i must abandon to the best renderpactice and combine a expencive light calcultation with an expencive rendermode …
Hope someone of you can help, thx
you would precalculate your tangents and pass them as vertex attribute, e.g. as texcoord, then write a vertex_program (or vertex_shader) that calculates the color or better (texcoord) of the lightvector for each vertex.
it is better to use cubemaps which auto normalize the passed lightvector, than packing them in colors. And on latest hardware I guess its even faster renomarlizing without a cubemap.
Thanks CrazyButcher for u’re fast reply. Ok, writing a shader might not be the problem, but is there a way to reach this aim without shaders only with pure OpenGL?
No, because you’re having to transform the light vector into tangent space per vertex - therefore you need to do this using a vertex program or the CPU (which is what you’re currently doing).
I would go out on a limb and say that you can be sure that any hardware that supports per-pixel dot3 will also support one of the vertex program extensions.
btw if you are worried about what extensions who supports, this is the place to go:
and arb_vertex_program is really quite spread
When you use the CPU to compute the tangent-vectors you can keep the static vertex-data using a static VBO and use a dynamic one for the tangent-vectors. This ways you reduce bandwith, cause only the tangents need to be transferred to the card, and you dont have all gl-Calls per vertex.
This can be usefull for cards like the radeon 7000 which has dot3 but no vp support. But because it doesn’t support VBOs u need to use normal vertex arrays. This would still have the advantage of not calling glVertex all the time.