Note: These are informal notes provided for the general interest of the Internet community. Use them at your own risk.

Tech Notes Contents

There are two outstanding material parameters which influence the appearance of specular highlights. The colloquial terms which we use at Artifice for these parameters are "roughness" and "specular reflectivity". In the DesignWorkshop material preferences file, we pack these two values into a single "glossiness" number.

Roughness effectively controls the range of angles over which a highlight is seen bouncing off a surface. For the classic example of a shpere, roughness controls how "wide" the highlight appears to be. In general, reasonable roughness values range from 1.0 to 300.0 exponentially, where 1.0 represents ideal microscopic "roughness" and 300.0 represents an extremely smoothly polished surface.

Specular reflectivity effectively controls the brightness of the brightness of the highlights, with reasonable vaules ranging 0.0 (no reflections) to 1.0 (maximum reflections).

Because computer graphics is based on idealizations rather than literal reality, the true definitions of these parameters come from the equations in which they are applied during rendering.

In the Apple Interactive Renderer, which is the standard shader for QuickDraw 3D, specular reflections are calculated according to the Phong illumination approach, and the relevant Phong illumination equation is documented in the Apple/Addison-Wesley book "3D Graphics Programming with QuickDraw 3D" near the top of page 14-7.

The text on that page clearly and correctly describes n, the "specular reflection exponent", and k.s, the "specular reflection coefficient", and it explains their separate effects on the appearance of specular highlights.

So far so good. If you're following this in "3D Graphics Programming", turn to the next page (14-8) and read at the bottom "A surface's specular reflection coefficient is also called its "specular control". You specify a specular reflection coefficient by inserting an attribute of type kQ3AttributeTypeSpecularControl into the surface's attribute set."

This clear piece of documentation states, in other words, that SpecularControl is the "specular reflection coefficient" (k.s), whereas in the actual implementation of QD3D 1.0.6, 1.5, and 1.5.1, SpecularControl is the "specular reflection exponent" (n). (There was an obscuring bug in version 1.0.6 such that the highlight rendered differently at the n=0 case.) We point out this direct contradiction between documentation and implementation because it confused us for a long time before we figured it out (and subsequently had it confirmed).

For comparison and further elucidation, if you can refer to a copy of "Computer Graphics, Principles and Practice" by Foley and Van Dam, 2nd Edition, 1990, and turn to page 730, you'll find a couple of other versions of the Phong illumination equation.

The upper equation on page 730, eq. 16.14, is functionally identical to the equation on p. 14-7 of "3D Graphics Programming ..." (once you filter out the difference in the expression of the light source(s), which doesn't matter for this discussion, and the wavelength approach). Equation 16.14 and the related illustrations cover the same ground as p14-7 and p14-8 in "3D Graphics Programming", although in figure 16.10 Foley and Van Dam list the actual values of k.s and n which go with the illustrated graphic results, which really helps in firmly grasping the concepts.

But actually, since QD3D also gives us access to the SpecularColor, it is the next equation, eq. 16-15, which would best encapsulate the parameters as used in QD3D (of course the figures go with both equations equally). I think the form used in eq. 16-15, which shows the SpecularColor as term O.s, would be more appropriate for the Apple QD3D book (future edition??). It really only shows one more term, but that additional term is one of the important parameters in QD3D.

Why am I belaboring this academic fine point? Because we're so plush at Artifice that we can spend our time counting angels on pin-heads?? Not exactly.

In addition to entertaining ourselves, we're mostly just trying to explain how to control the specular behavior of surfaces in QD3D. Although there is not a direct way to assign k.s in QD3D, equation 16.15 is helpful because it illuminates how k.s and O.s can go together, resulting in a hidden but specified k.s. This is a little odd, but it works.

(I do have a guess that the evolution of the documentation/implementation slippage we see may have been enabled by the non-explicit parameter handling in the given equation in the Apple book, because the result is that where there are really three distinct things to name and vary (k.s, O.s, and n), the equation in the Apple book only shows two of the three. The attributes implemented in QD3D actually define a different two of the three. In other words, maybe no wonder it's gotten a little confused.)

When rendering textures, the QD3D Interactive Renderer effectively reads O.s from the pixel color of the texture, and reads k.s from the SpecularColor.

Artifice Foyer | Free Software | Product Ordering | Artifice Gallery | Index

© 1997 Artifice, Inc. - All Rights Reserved. This document is provided for on-line viewing only.

*
http://www.artifice.com/tech/qd3d_specularity.html
*