1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../css/document.css" type="text/css" />
7    <style type="text/css"><!--
8      span.static_style
9      {
10        font-size                       : 8pt;
11        color                           : white;
12        font-weight                     : bold;
13        background                      : #44f;
14        border-left                     : solid 1px #aaf;
15        border-top                      : solid 1px #aaf;
16        border-right            : solid 1px #00c;
17        border-bottom           : solid 1px #00c;
18        padding-left            : 2px;
19        padding-right           : 2px;
20      }
21
22      span.virtual_style
23      {
24        font-size                        : 8pt;
25        color                            : white;
26        font-weight                     : bold;
27        background                      : #0a0;
28        border-left                     : solid 1px #0f0;
29        border-top                      : solid 1px #0f0;
30        border-right            : solid 1px #060;
31        border-bottom           : solid 1px #060;
32        padding-left            : 2px;
33        padding-right           : 2px;
34      }
35
36      span.protected_style
37      {
38        font-size                        : 8pt;
39        color                            : white;
40        font-weight                     : bold;
41        background                      : #444;
42        border-left                     : solid 1px #ccc;
43        border-top                      : solid 1px #ccc;
44        border-right            : solid 1px #222;
45        border-bottom           : solid 1px #222;
46        padding-left            : 2px;
47        padding-right           : 2px;
48      }
49        --></style>
50    <title>Procedure for Switching Shaders</title>
51  </head>
52  <body>
53    <h1>Procedure for Switching Shaders</h1>
54    <div class="section">
55      <ol>
56        <li>Reference <CODE>UserShader</CODE> and the <a href="ShaderRegister.html">Shader Register List</a> to create the shader binary. See <I>VertexShaderReferenceManual.pdf</I> for details on how to create the shader binary.<br/><br/>
57        </li>
58        <li>Create a shader intermediate file from the created shader binary in CreativeStudio.<br/> Select <B>Create</B> &gt; <B>Expert</B> &gt; <B>User shader</B> to open the Shader Creation panel.<br/> The item settings for this shader intermediate file are described below.<br/><br/>
59        <p class="notice">Note: Parts surrounded in red in the figure indicate where the UserShader sample has changed.</p><br/>
60
61        <a href="images/ShaderCreationPanel.png"><img src="images/ShaderCreationPanel.png" width="400" border="0"/></a>
62        <ul>
63            <li><B>Vertex shader index</B><br>Specify the vertex shader index contained in the shader binary.<br/> When doing so, you must assign the shader kind in the same order you linked the shaders when generating the shader binary.<br/> For example, when linking the four vertex shaders <CODE>gfx_UserShader0.vsh</CODE>, <CODE>gfx_UserShader1.vsh</CODE>, <CODE>gfx_UserShader2.vsh</CODE>, and <CODE>gfx_UserShader3.vsh</CODE> to the shader binary, create the description by specifying the index numbers for each vertex shader index in order as 0, 1, 2, and 3.<br/><br/>
64            </li>
65            <li><B>Geometry shader index</B><br>Specify the geometry shader index contained in the shader binary.<br/> What is specified here is the index number of the geometry shader assigned by <B>Shader types</B>.<br/><br/>
66            </li>
67            <li><B>Maximum number of vertex lights</B><br>Specify the maximum number of vertex lights that the shader supports.<br/> Specify <CODE>0</CODE> if you are not using vertex lights.<br/> You can use up to 9 vertex lights (54 registers).<br/><br/>
68            </li>
69            <li><B>Starting offset for user registers</B><br>Specify the starting offset for user registers.<br/> What is specified is the first register in the universal registers that will be used as a user register.<br/> You can specify values from <CODE>1</CODE> through <CODE>60</CODE>, depending on the number of bones and vertex lights.<br/> You must set the same value as in <CODE>nw_user_register_start</CODE> in <CODE>ShaderConfig.h</CODE>.<br/><br/>
70            </li>
71            <li><B>Rigid skinning</B><br>Enable this to support rigid skinning.<br/><br/>
72            </li>
73            <li><B>Smooth skinning</B><br>Enable this to support smooth skinning.<br/><br/>
74            </li>
75            <li><B>Hemispherical lighting</B><br>Enable this to support hemispherical lighting.<br/> Disable this when the register used for hemispherical lighting is to be used for a different purpose.<br/><br/>
76            </li>
77            <li><B>Vertex morphing</B><br>Enable this to support vertex morphing.<br/> This is not supported in the current version.<br/><br/>
78            </li>
79        </ul>
80        </li>
81        <li>Assign the created shader intermediate file to a mesh.<br/> Select a shader category and apply the the created shader and program index.<br/>
82
83
84        For the program index, specify the shader index number configured in the Shader Creation panel.<br/><br/>
85        </li>
86        <li>Specify shader parameters for the newly added register.<br/> With <CODE>UserShader</CODE>, add <CODE>NDeform</CODE> and <CODE>ExColor</CODE> as <CODE>Vector4</CODE> values.<br/> Select <B>Vertex shader output result</B> for the source in the texture combiner settings in order to apply color additions according to the <CODE>ExColor</CODE> parameter.<br/><br/> <a href="images/ShaderSetting.png"><img src="images/ShaderSetting.png" width="600" border="0"/></a>
87        </li>
88      </ol>
89    </div>
90  <hr><p>CONFIDENTIAL</p></body>
91</html>