GXInitLightShininess

Syntax

#include <revolution/gx.h>

#define GXInitLightShininess(lobj, shininess)   \
        GXInitLightAttn(lobj, 0.0F, 0.0F, 1.0F, \
                    (shininess)/2.0F, 0.0F,     \
                    1.0F-(shininess)/2.0F )

Arguments

lobj Pointer to a light object.
shininess shininess parameter

Return Values

None.

Description

This function sets the shininess of a specular light at the vertex level. In reality, shininess is a property of the material being lit, not the light. However, in the graphics processor, the specular calculation is implemented by reusing the diffuse angle/distance attenuation functions, so shininess is determined by the light attenuation parameters.( (See GXInitLightAttn.) The arithmetic formula approximates the function (N*H)^shininess "(Normal vector (1/2 the line-of-sight and the light direction))^brightness" Since the attenuation formula is only a ratio of two differential equations, it cannot be used as an accurate exponential function. To enable specular calculations, the lighting channel attenuation parameter must be set to GX_AF_SPEC using the GXSetChanCtrl function.

The graph below represents the attenuation curve for various shininess levels (shininess).

shininess.jpg (30875 bytes)

As you can see from the graph, a larger value of shininess creates a narrower specular highlight.

And the following image shows result samples.

Spec004.gif (8415 bytes) Spec016.gif (7761 bytes) Spec064.gif (6036 bytes) Spec256.gif (4218 bytes)
shininess = 4.0 shininess = 16.0 shininess = 64.0 shininess = 256.0

See Also

GXSetChanCtrl, GXLightObj Initialization Flow

Revision History

2006/03/01 Initial version.


CONFIDENTIAL