Dot3Bump rework coming along nicely

· by Steve · Read in about 2 min · (250 Words)

I’ve been working on the dot3bump demo among other things (like wrapping pressies ;), and it’s looking nice. I’ve decided to implement a number of versions of the effect, since the variety of cards it can run on means that there are a few different ways of achieving it. The one prerequisite is vertex program support - this is required to calculate the object-space light parameters. However, here are the variants, in ascending order of complexity:

  • Single pass (on 4 unit cards), only one light permitted and no ambient light or attenuation

  • (#lights + 2) pass using only vertex programs and fixed-function dot3 fragment operation; this supports ambient light and any number of point lights but cannot do coloured lights or attenuation

  • (#lights + 2) pass using vertex and fragment programs; this supports any number of lights, an ambient pass, coloured lights and attenuation. This rocks 😀

You can see the results of technique 3 on the OGRE screenshots page. I plan to improve on it still further by adding a specular component to the lighting, which should look even better.

Interestingly, I found an issue with GL while developing this demo - whilst D3D is quite happy to mix fixed function and vertex program passes without artefacts, on the same card if you do this under GL, you get bad depth-fighting artefacts, nasty flickering between layers. I’ve got around this by using vertex programs for all the passes including the really basic ones, but it’s a shame it’s necessary.