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>Create the shader binary using and <B>UserShader</B> and <a href="ShaderRegister.html">Register Allocations</a> for reference.<br> To read about creating the shader binary see <I>VertexShaderReferenceManual.pdf</I>.<br><br> 57 </li> 58 <li>Create a shader intermediate file from the created shader binary in CreativeStudio.<br> Select Create > Expert > User shader 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 surrounding in red in the figure, represent 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>Specifies the vertex shader index contained in the shader binary.<br> At this time, the kind must be assigned in the order shaders were linked when generating shader binary.<br> The example in the figure includes the following four vertex shaders: gfx_UserShader0.vsh, gfx_UserShader1.vsh, gfx_UserShader2.vsh, and gfx_UserShader3.vsh. Create a description by specifying each individual index number, 0, 1, 2 or 3. 64 </li> 65 <li><B>Geometry shader index</B><br>Specifies the geometry shader index contained in the shader binary.<br> What's 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>Specifies the maximum number of vertex lights that the shader supports.<br> If you are not using vertex lights, set this value to 0.<br> Up to 9 vertex lights (54 registers) can be set.<br><br> 68 </li> 69 <li><B>Starting offset for user registers</B><br>Specifies the starting offset for user registers.<br> What is specified is the first register in the universal registers which will be used as user registers.<br> The value can be set between 1 and 60, depending on the number of bones and vertex lights.<br> You must set the same value as <CODE>nw_user_register_start</CODE> in <CODE>ShaderConfig.h</CODE>.<br><br> 70 </li> 71 <li><B>Rigid skinning</B><br> Enable this when rigid skinning is supported.<br><br> 72 </li> 73 <li><B>Smooth skinning</B><br> Enable this when smooth skinning is supported.<br><br> 74 </li> 75 <li><B>Hemispherical lighting</B><br>Enable this when hemispherical lighting is supported. <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 when vertex morphing is supported. <br> At the present time this is not supported.<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> When using UserShader, the shader corresponding to the index number given above can be applied by specifing a value of 0 through 3 for the program index.<br><br> 82 </li> 83 <li>Specify shader parameters to the newly added register.<br> With UserShader, NDeform and ExColor are added as Vector 4.<br> Under texture combiner settings, select "Vertex shader output result" for the source in order to apply color addition according to the ExColor parameter.<br><br> <a href="images/ShaderSetting.png"><img src="images/ShaderSetting.png" width="400" border="0"></a> 84 </li> 85 </ol> 86 </div> 87 <hr><p>CONFIDENTIAL</p></body> 88</html>