Hi,
I’ve implemented diffuse bump mapping using the DOT3 blend mode and is working fine. It does its job in a simple pass, and does not require a top-notch graphic card.
However, I have some questions that arise when 'I guess- when we pass from an eye-candy bump-map demo to a real implementation in a rendering engine.
The first one is related to the light color. I pass the light vector in tangent space in texcoord1, and then render in a single pass using multitexture, with diffuse texture loaded in tu0 and the normal map in tu1. Then the blend modes are set to perform a dot3 on tu1, but I don’t know where to put the light color in the blending states, and worse, if its possible to accomodate for it somewhere, as to render in a single pass.
Any idea?
Another question is related to fog. I have my scene with fog and I have some materials with dot3 bump-map. However I lost the fog in those materials: Since I’m using a vertex program, fog calculation and contribution are bypassed. So, the question is… Is there a way to add the fog in computations without fragment shaders? Or there is no other way than rendering those triangles with all material properties set to 0,0,0,0 in a second, additive pass (Ambient light could be added here too).
Finally, how do we manage multiple light sources with bump-mapping? I guess only by multiple passes, one for each light. So the rendering algo would be:
* Render all materials that have no bump, with std shading, fog enabled
Then for each light
* Render materials with bump using vp, for light0
* Render materials with bump using vp, for light1
...
* Render materials with bump using vp, for lightn
* Render materials with bump as pure black, std lighting and fog enabled.
* Render transparencies.
etc..
Is this the better way? Wouldn’t it be too slow? Or would it be better to have a vp (vertex program) that computes the light vector in tangent space for several light sources and outputs these in various different txcoords. If that’s the way, how can I use a texcoord (aka vertex attribute) as a blending operand?
Of course, all this should be possible with OpenGL 2.0. But can it be done with 1.3 or 1.4?
(No fragment shaders)
I really would like to have bump-map well integrated in my rendering engine, and running in GL < 1.5 hardware.
Thanks in advance and excuse my engligh.