Custom Diffuse and Specular response

I’ve read somewhere that the specular term response of the material definition in hardware was precomputed in a 1D lookup array according to the current shininess exponent value, which is why changing the shininess value is costly. Wouldn’t it be interesting to be able to redefine this 1D array with, eventually a 1D lookup texture, for the specular term and one for the diffuse term? This way it would be easy to do anisotropy or cartoon-like rendering. I’m aware you can do it with a vertex program and two 1D textures but it would be a waste of texture units and since it seems to be implemented that way in hardware…

Well, a lookup table is certainly one way to implement specular, but it is not the only way. Even if some particular HW did use a lookup table, it might look different from a texture (filtering, wrap modes, etc. might not be supported).

Changing shininess may or may not be expensive. It depends on the driver and the HW.

Diffuse is just a dot product, and so it is computed directly, not approximated. Everyone approximates specular (and to different degrees of accuracy), but there is no one preferred way of doing so.

  • Matt