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<H2>C Specification</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17  <PRE><CODE>#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 )</CODE></PRE>
21</DL>
22<H2>Arguments</H2>
23<TABLE border="1" cellpadding="3" cellspacing="0.1">
24  <TBODY>
25    <TR>
26<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>lobj</CODE></STRONG></EM></TD>
27<TD width="520">Pointer to a light object.</TD>
28    </TR>
29    <TR>
30<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>shininess</CODE></STRONG></EM></TD>
31<TD width="520">shininess parameter</TD>
32    </TR>
33  </TBODY>
34</TABLE>
35<H2>Return Values</H2>
36<P>None.</P>
37<H2>Description</H2>
38<P>This function sets the <em><strong><code>shininess</code></strong></em> of a per-vertex specular light.&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 function, 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)^<CODE><EM><STRONG>shininess</STRONG></EM></CODE> &quot;(Normal vector (1/2 the line-of-sight and the light direction))^brightness&quot; Since the attenuation formula is only a fraction of second degree 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 <A href="GXSetChanCtrl.html"><CODE>GXSetChanCtrl</CODE></A> function.</P>
39<P>The graph below represents the attenuation curve for various shininess levels (<EM><STRONG><CODE>shininess</CODE></STRONG></EM>).</P>
40<P><IMG src="shininess.jpg" alt="shininess.jpg (30875 bytes)" width="571" height="421"></P>
41<P>As you can see from the graph, a larger value of shininess creates a narrower specular highlight.</P>
42<P>And the following image shows result samples.</P>
43<TABLE border="0" width="71%" cellspacing="0" cellpadding="0">
44  <TBODY>
45    <TR>
46<TD width="21%"><IMG src="Spec004.gif" alt="Spec004.gif (8415 bytes)" width="160" height="160"></TD>
47<TD width="21%"><IMG src="Spec016.gif" alt="Spec016.gif (7761 bytes)" width="160" height="160"></TD>
48<TD width="21%"><IMG src="Spec064.gif" alt="Spec064.gif (6036 bytes)" width="160" height="160"></TD>
49<TD width="37%"><IMG src="Spec256.gif" alt="Spec256.gif (4218 bytes)" width="160" height="160"></TD>
50    </TR>
51    <TR>
52<TD width="21%" align="center"><strong><em>shininess</em></strong> = 4.0</TD>
53<TD width="21%" align="center"><strong><em>shininess</em></strong> = 16.0</TD>
54<TD width="21%" align="center"><strong><em>shininess</em></strong> = 64.0</TD>
55<TD width="37%" align="center"><strong><em>shininess</em></strong> = 256.0</TD>
56    </TR>
57  </TBODY>
58</TABLE>
59<H2>See Also</H2>
60<P><A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A></P>
61<P><A href="GXSetChanCtrl.html"><code>GXSetChanCtrl</code></A></P>
62<H2>Revision History</H2>
63<P>2006/03/01 Initial version.</P>
64<hr>
65<P>CONFIDENTIAL</p>
66</BODY>
67</HTML>