1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>GXInitLightShininess</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXInitLightShininess</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17#define GXInitLightShininess(lobj, shininess)   \
18        GXInitLightAttn(lobj, 0.0F, 0.0F, 1.0F, \
19                    (shininess)/2.0F, 0.0F,     \
20                    1.0F-(shininess)/2.0F )
21</pre></dd></dl>
22
23<H2>Arguments</H2>
24<TABLE class="arguments" border="1" >
25  <TBODY>
26    <TR>
27<TH>lobj</TH>
28<TD>Pointer to a light object.</TD>
29    </TR>
30    <TR>
31<TH>shininess</TH>
32<TD>shininess parameter</TD>
33    </TR>
34  </TBODY>
35</TABLE>
36
37<H2>Return Values</H2>
38<P>None.</P>
39
40<H2>Description</H2>
41<P>This function sets the <SPAN class="argument">shininess</SPAN> of a specular light at the vertex level.&nbsp;In reality, shininess is a property of the <em>material</em> 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 <A href="GXInitLightAttn.html"><CODE>GXInitLightAttn</CODE></A>.) The arithmetic formula approximates the function (N*H)^<SPAN class="argument">shininess</SPAN> &quot;(Normal vector (1/2 the line-of-sight and the light direction))^brightness&quot; 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 <CODE>GX_AF_SPEC</CODE> using the <A href="GXSetChanCtrl.html"><CODE>GXSetChanCtrl</CODE></A> function.</P>
42<P>The graph below represents the attenuation curve for various shininess levels (<SPAN class="argument">shininess</SPAN>).</P>
43<P><IMG src="shininess.jpg" alt="shininess.jpg (30875 bytes)" width="571" height="421"></P>
44<P>As you can see from the graph, a larger value of shininess creates a narrower specular highlight.</P>
45<P>And the following image shows result samples.</P>
46<TABLE border="0" cellspacing="0" cellpadding="0">
47  <TBODY>
48    <TR>
49      <TD><IMG src="Spec004.gif" alt="Spec004.gif (8415 bytes)" width="160" height="160"></TD>
50      <TD><IMG src="Spec016.gif" alt="Spec016.gif (7761 bytes)" width="160" height="160"></TD>
51      <TD><IMG src="Spec064.gif" alt="Spec064.gif (6036 bytes)" width="160" height="160"></TD>
52      <TD><IMG src="Spec256.gif" alt="Spec256.gif (4218 bytes)" width="160" height="160"></TD>
53    </TR>
54    <TR>
55      <TD align="center"><SPAN class="argument">shininess</SPAN> = 4.0</TD>
56      <TD align="center"><SPAN class="argument">shininess</SPAN> = 16.0</TD>
57      <TD align="center"><SPAN class="argument">shininess</SPAN> = 64.0</TD>
58      <TD align="center"><SPAN class="argument">shininess</SPAN> = 256.0</TD>
59    </TR>
60  </TBODY>
61</TABLE>
62
63<H2>See Also</H2>
64<P class="reference">
65<A href="GXSetChanCtrl.html">GXSetChanCtrl</A>,
66<A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A>
67</P>
68
69<H2>Revision History</H2>
70<P>
712006/03/01 Initial version.<br>
72</P>
73
74<hr><p>CONFIDENTIAL</p></body>
75</HTML>