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">
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    <title>Optimization Tips</title>
8  </head>
9  <body>
10    <h1 id="newlist1_3_0">Items Added and Revised in 1.3.0</h1>
11    <ul>
12
13    <!-- <GFX>  -->
14    <li><a href="#share_same_shaders">Sharing the Same Shaders</a></li>
15    <li><a href="#optimaize_resource_setup">Optimizing Resource Setup (VRAM Transfers)</a></li>
16    <li><a href="#optimaize_scene_object_creation">Speeding Up the Creation of Scene Objects</a></li>
17    <!-- </GFX>  --> <!-- <ANIM>  -->
18    <li><a href="#full_baked">Using Fully-Baked Format Animation Data</a></li>
19    <li><a href="#remove_useless_anim">Deleting Alpha Value Animations Unused by Standard Features</a></li>
20    <!-- </ANIM>  -->
21
22    </ul>
23    <h1>CPU/GPU Optimization</h1>
24    <ul>
25
26    <!-- <GFX>  -->
27
28    <li><a href="#document">Reading the Optimization Document</a></li>
29    <li><a href="#option">Enabling Optimization Options</a></li>
30    <li><a href="#vram">Loading Vertex data and Textures in VRAM</a></li>
31    <li><a href="#doublecmdlist">Duplicating Command Lists</a></li>
32    <li><a href="#glclear">Avoiding Calls to <CODE>glClear</CODE></a></li>
33    <li><a href="#share_same_shaders">Sharing the Same Shaders</a></li>
34
35    <!-- </GFX>  -->
36
37    </ul>
38    <h1>CPU Optimization</h1>
39    <ul>
40
41    <!-- <GFX>  -->
42    <li><a href="#material_id">Calculating Material IDs</a></li>
43    <li><a href="#customrendersort">Customizing Sort Algorithms for the Render Queue</a></li>
44    <li><a href="#optimizerenderkey">Optimizing Render Queue Key Creation</a></li>
45    <li><a href="#shared_skeleton">Sharing Skeletons</a></li>
46    <li><a href="#shared_material">Sharing Materials</a></li>
47    <li><a href="#traverse">Executing Traverses Only when the Scene Tree Structure Changes</a></li>
48    <li><a href="#skip_update">Partially Omitting Traverses and Updates</a></li>
49    <li><a href="#savedcmdlist">Reusing Command Lists when Displaying in 3D</a></li>
50    <li><a href="#build_option">Disabling Features Not Required by the Build Options</a></li>
51    <li><a href="#optimaize_resource_setup">Optimizing Resource Setup (VRAM Transfers)</a></li>
52    <li><a href="#optimaize_scene_object_creation">Speeding Up the Creation of Scene Objects</a></li>
53    <!-- </GFX>  -->
54
55    <!-- <ANIM>  -->
56    <li><a href="#frame_format">Using Frame-Format Animation Data</a></li>
57    <li><a href="#full_baked">Using Fully-Baked Format Animation Data</a></li>
58    <li><a href="#change_anim">Reusing <CODE>AnimEvaluator</CODE> when Switching Animations</a></li>
59    <li><a href="#anim_cache">Using Animation Caches Appropriately</a></li>
60    <li><a href="#delete_anim_member">Deleting Unnecessary Animation Members</a></li>
61    <li><a href="#delete_anim_member_auto">Automatically Deleting Unnecessary Animation Members</a></li>
62    <li><a href="#disable_anim">Disabling <CODE>AnimBinding</CODE> for Unanimated Nodes</a></li>
63    <li><a href="#remove_useless_anim">Deleting Alpha Value Animations Unused by Standard Features</a></li>
64    <!-- </ANIM>  -->
65
66    </ul>
67    <h1>Vertex Process Optimization</h1>
68    <ul>
69
70    <!-- <GFX>  -->
71    <li><a href="#shader_program">Selecting a Shader Program According to the Number of Textures</a></li>
72    <li><a href="#light_off">Turning Off Unnecessary Lights</a></li>
73    <li><a href="#light_write">Baking Lights to Vertex Colors</a></li>
74    <li><a href="#user_shader">Using User Shaders</a></li>
75    <!-- </GFX>  -->
76
77    </ul>
78    <hr />
79
80    <!-- <GFX>  -->
81    <h2 id="document">Reading the Optimization Document</h2>
82    <div class="section">
83    Read the optimization document included with the SDK.<br /> Note that these optimization tips are not contained in the SDK documentation.<br />
84    </div>
85    <h2 id="option">Enabling Optimization Options</h2>
86    <div class="section">
87    Enable the optimization options of the export plug-in.<br /> In some cases, this may have a significant effect on performance.
88    </div>
89    <h2 id="vram">Loading Vertex data and Textures in VRAM</h2>
90    <div class="section">
91    Load vertex data and textures in VRAM.<br /> As shown below, transfer reservations can be made when initializing resources by configuring memory locations at the graphics file level.
92    <p class="info">
93    <CODE>ResGraphicsFile::ForeachTexture(nw::gfx::TextureLocationFlagSetter(NN_GX_MEM_VRAMA | GL_NO_COPY_FCRAM_DMP));<br /> ResGraphicsFile::ForeachIndexStream(nw::gfx::IndexStreamLocationFlagSetter(NN_GX_MEM_VRAMB | GL_NO_COPY_FCRAM_DMP));<br /> ResGraphicsFile::ForeachVertexStream(nw::gfx::VertexStreamLocationFlagSetter(NN_GX_MEM_VRAMB | GL_NO_COPY_FCRAM_DMP));<br /></CODE>
94    </p>
95    </div>
96    <h2 id="doublecmdlist">Duplicating Command Lists</h2>
97    <div class="section">
98    Duplicate command lists to allow for simultaneous command generation and execution. However, you might get display tearing if buffers are not swapped correctly, as transfers from the render buffer to the display buffer are also accumulated as commands.<br /> In the demo library, the <a href="../../nw/demo/CommandListSwapper/Overview.html"><CODE>CommandListSwapper</CODE></a> class duplicates command lists.
99    </div>
100    <h2 id="glclear">Avoiding Calls to <CODE>glClear</CODE></h2>
101    <div class="section">
102    The <CODE>glClear</CODE> function affects calculations and other processes because it generates CPU interrupts even if the <CODE>RenderBuffer</CODE> is located in VRAM.<br /> If possible, render starting from the most distant on-screen items in order clear the screen without calling <CODE>glClear</CODE>.<br /> You can do this in NW4C by configuring the mesh materials of the most distant display items as follows.<br />
103    <ul>
104    <li>Depth test: Always pass (Always)</li>
105    <li>Color depth buffer: Update </li>
106    <li>Use layer IDs and render priorities to render the most distant model first.</li>
107    </ul>
108    Also set <CODE>LayerId</CODE> for <CODE>SubmitView</CODE> to prioritize rendering of the celestial sphere, as done in the <CODE>gfx</CODE> demo. Whichever approach you take, the most distant model must lie between the near and far clipping planes.
109    </div>
110    <h2 id="shared_skeleton">Sharing Skeletons</h2>
111    <div class="section">
112    When creating characters that share motions, share skeletons between the characters to reduce the number calculations required.<br /> For details on sharing skeletons, see <a href="./Coordinate.html#shared_skeleton">Sharing Skeletons</a>.
113    </div>
114    <h2 id="shared_material">Sharing Materials</h2>
115    <div class="section">
116    When creating models that use the same materials, share materials between the models to omit redundant material setup.<BR> To share a material, configure the source model to be shared in a <a href="../../nw/gfx/SceneBuilder/SharedMaterialModel.html"><CODE>SharedMaterialModel</CODE></a> object. When destroying objects that use shared materials, you must first destroy all models using the shared materials before destroying the shared model itself.
117    </div>
118    <h2 id="traverse">Executing Traverses and Initializing Only when the Scene Tree Structure Changes</h2>
119    <div class="section">
120    Only execute a traverse or initialize when the tree structure has changed, such as when a child has been added to or removed from the <CODE>SceneNode</CODE>, by calling <a href="../../nw/gfx/SceneTraverser/Overview.html"><CODE>SceneTraverser</CODE></a> or <a href="../../nw/gfx/SceneInitializer/Overview.html"><CODE>SceneInitializer</CODE></a> respectively on a <a href="../../nw/gfx/SceneNode/Accept.html"><CODE>SceneNode::Accept</CODE></a> object. You do not need to do this again when the <CODE>Visible</CODE> property changes.
121    </div>
122    <h2 id="skip_update">Partially Omitting Traverses and Updates</h2>
123    <div class="section">
124    If you want to omit running <a href="../../nw/gfx/SceneUpdater/UpdateAll.html"><CODE>SceneUpdater::UpdateAll</CODE></a> or traverses for a particular node, prepare multiple instances of the <a href="../../nw/gfx/SceneContext/Overview.html"><CODE>SceneContext</CODE></a> class to allow you to skip some traverse and update processing. For example, you can collect traverse results for each individual <a href="../../nw/gfx/SceneContext/Overview.html"><CODE>SceneContext</CODE></a> by separating the group of nodes you want to update and the ones you don't into separate branches, and then traverse only some of the branches. Alternately, split them into separate scene trees and then traverse only some of the trees. Reduce the processing load by skipping traverses and updates for <a href="../../nw/gfx/SceneContext/Overview.html"><CODE>SceneContext</CODE></a> instances that are collections of nodes whose status does not change. Use functions such as <a href="../../nw/gfx/SceneUpdater/SubmitView.html"><CODE>SceneUpdater::SubmitView</CODE></a> or <a href="../../nw/gfx/BasicRenderQueue/EnqueueModel.html"><CODE>RenderQueue::EnqueueModel</CODE></a> to place multiple instances of <a href="../../nw/gfx/SceneContext/Overview.html"><CODE>SceneContext</CODE></a> in a single <a href="../../nw/gfx/RenderQueue.html"><CODE>RenderQueue</CODE></a>.
125    </div>
126    <h2 id="material_id">Calculating Material IDs</h2>
127    <div class="section">
128    The default sorting algorithm sorts materials using the material IDs. Use the <a href="../../nw/gfx/IMaterialIdGenerator/Overview.html"><CODE>IMaterialIdGenerator</CODE></a> function to calculate material IDs. Set the material IDs of materials with the same or similar settings to values that are close to each other in order to reduce the CPU load during rendering. To calculate material IDs, pass a <CODE>IMaterialIdGenerator</CODE> instance to the <a href="../../nw/gfx/SceneInitializer/Overview.html"><CODE>SceneInitializer</CODE></a> function, and then call, in order, the <a href="../../nw/gfx/SceneInitializer/Begin.html"><CODE>SceneInitializer::Begin</CODE></a>, <a href="../../nw/gfx/SceneNode/Accept.html"><CODE>SceneNode::Accept</CODE></a>, and <a href="../../nw/gfx/SceneInitializer/End.html"><CODE>SceneInitializer::End</CODE></a> functions. You can customize the material ID generator algorithm by inheriting from the <CODE>IMaterialIdGenerator</CODE> class. Refer to <a href="../../nw/gfx/SortingMaterialIdGenerator/Overview.html"><CODE>SortingMaterialIdGenerator</CODE></a> when implementing your customized algorithm.
129    </div>
130    <h2 id="customrendersort">Customizing Sort Algorithms for the Render Queue</h2>
131    <div class="section">
132    Customize the sort algorithm by customizing <a href="../../nw/gfx/RenderElementCompare/Overview.html"><CODE>RenderElementCompare</CODE></a> and <a href="../../nw/gfx/BasicRenderKeyFactory/Overview.html"><CODE>BasicRenderKeyFactory</CODE></a>.
133    </div>
134    <h2 id="optimizerenderkey">Optimizing Render Queue Key Creation</h2>
135    <div class="section">
136    If you do not need to sort by depth, such as when using non-translucent meshes, you can omit depth-related calculations when generating keys or when caching key generation results. Skip these calculations by using the <a href="../../nw/gfx/ISceneUpdater/SetDepthSortMode.html"><CODE>ISceneUpdater::SetDepthSortMode</CODE></a> function to set <CODE>SORT_DEPTH_OF_TRANSLUCENT_MESH</CODE> for depth-related calculations and then using the key factory created by <a href="../../nw/gfx/CreatePriorMaterialAndZeroDepthRenderKeyFactory.html"><CODE>CreatePriorMaterialAndZeroDepthRenderKeyFactory</CODE></a>. Enable the key cache by passing <CODE>true</CODE> in the <SPAN class="argument">cacheEnabled</SPAN> argument to the <a href="../../nw/gfx/BasicRenderQueue/Reset.html"><CODE>RenderQueue::Reset</CODE></a> function. Disable the caching of sort keys saved for each mesh by calling <a href="../../nw/gfx/Model/InvalidateRenderKeyCache.html"><CODE>InvalidateRenderKeyCache</CODE></a>. You can also disable sort key caching on a per mesh basis by using the <CODE>ResMesh::SetFlags</CODE> function directly to set the <CODE>ResMesh::FLAG_VALID_RENDER_KEY_CACHE</CODE> flag to <CODE>0</CODE>.
137    </div>
138    <h2 id="savedcmdlist">Reusing Command Lists when Displaying in 3D</h2>
139    <div class="section">
140    When displaying in 3D, you can cut down on command generation by generating one command list and re-using it for both left and right eyes, instead of generating a separate command list for the left and right eyes. The demo library renders 3D displays using the <a href="../../nw/demo/RenderSystem/RenderStereoScene.html"><CODE>RenderStereoScene</CODE></a> function, which uses the <a href="../../nw/demo/CommandListSwapper/Overview.html"><CODE>CommandListSwapper</CODE></a> class to save and reuse the command list. For the process flow, see <a href="./AdvancedFeature.html#stereo">Normal Rendering and Stereoscopic Rendering</a>.
141    </div>
142    <h2 id="build_option">Disabling Features Not Required by the Build Options</h2>
143    <div class="section">
144    You can skip unnecessary determination and other processing by using the build options to disable unneeded features. For details, see <a href="./../macros.html">Macro List</a>
145    </div>
146
147    <h2 id="share_same_shaders">Sharing the Same Shaders</h2>
148    <div class="section">
149    <p>
150      Load shared shaders ahead of time from the binary files.
151    </p>
152    <p>
153      Use <a href="../../nw/gfx/res/ResGraphicsFile/Setup.html"><CODE>nw::gfx::ResGraphicsFile::Setup</CODE></a> or a similar function to set up the models and other binary file resources. In such cases as when the function call returns <CODE>nw::gfx::RESOURCE_RESULT_NOT_FOUND_SHADER</CODE>, you can share a single shader by setting up the binary resource for the loaded shader again.
154    </p>
155    <p>
156      See <a href="demo/ResourceDemo.html"><CODE>ResourceDemo</CODE></a> for specific examples.
157    </p>
158    </div>
159
160    <h2 id="optimaize_resource_setup">Optimizing Resource Setup (VRAM Transfers)</h2>
161    <div class="section">
162      See <a href="BinaryResource.html#transfer_vram">Users Handling VRAM Transfers</a>.
163    <p>
164    </p>
165    </div>
166
167    <h2 id="optimaize_scene_object_creation">Speeding Up the Creation of Scene Objects</h2>
168    <div class="section">
169    <p>
170      Call <a href="../../nw/gfx/SceneBuilder/GetMemorySize.html"><CODE>nw::gfx::SceneBuilder::GetMemorySize</CODE></a> or a similar function to calculate the amount of memory required to create objects, and then allocate all the required memory at once to speed up object creation.
171    </p>
172    <p>
173      Manage such memory by using an allocator class that inherits from <a href="../../nw/os/IAllocator/Overview.html"><CODE>os::IAllocator</CODE></a> (herein called a &quot;suballocator&quot;). Configure the created suballocator as an allocator for creating objects.
174    </p>
175    <p>
176      For speedier object creation, use classes such as the SDK's <CODE>FrameHeap</CODE> class when implementing your suballocator.
177    </p>
178    </div>
179
180    <!-- </GFX>  -->
181
182    <!-- <ANIM>  -->
183    <h2 id="frame_format">Using Frame-Format Animation Data</h2>
184    <div class="section">
185      <p>
186        Use frame-format animation data to reduce the processing load of evaluating animations. Only skeletal animations can currently be output in frame format.
187      </p>
188      <p>
189        The drawback to frame format is larger data sizes. The accuracy of evaluating fractional frames also declines when the playback speed is changed.
190      </p>
191    </div>
192
193    <h2 id="full_baked">Using Fully-Baked Format Animation Data</h2>
194    <div class="section">
195      <p>
196        Use fully baked animation data to reduce the processor load for skeletal animation evaluation compared to frame format.
197      </p>
198      <p>
199        See <a href="anim/AdvancedFeature.html#full_baked">Advanced Features</a> for details on usage and disadvantages.
200      </p>
201    </div>
202
203    <h2 id="change_anim">Reusing <CODE>AnimEvaluator</CODE> when Switching Animations</h2>
204    <div class="section">
205      <p>
206        Use <a href="../../nw/gfx/AnimEvaluator/ChangeAnim.html"><CODE>ChangeAnim</CODE></a> when switching animations for a single model.
207      </p>
208      <p>
209        This is faster than re-creating an <a href="../../nw/gfx/AnimEvaluator/Overview.html"><CODE>AnimEvaluator</CODE></a> instance and then executing <a href="../../nw/gfx/AnimEvaluator/Bind.html"><CODE>Bind</CODE></a> again.
210      </p>
211    </div>
212
213    <h2 id="anim_cache">Using Animation Caches Appropriately</h2>
214    <div class="section">
215      <p>
216        Using an evaluation result cache is a fast approach when applying animation results to more than one model. Meanwhile, this also increases the overhead if enabled when the cache is not needed. For more details, see <a href="anim/AdvancedFeature.html#anim_cache">Advanced Features</a>.
217      </p>
218    </div>
219
220    <h2 id="delete_anim_member">Deleting Unnecessary Animation Members</h2>
221    <div class="section">
222      <p>
223        You can delete animation members when exporting models and other data from CreativeStudio to binary format. Delete any unnecessary animation members to speed up animation evaluation and blends in particular. Be careful not to delete any necessary animation members.
224      </p>
225      <p>
226        The following examples show a filter definition file and a script file for binary output of a model where only material constant colors <CODE>0</CODE> and <CODE>1</CODE> can be animated.
227      </p>
228      <h3>OptimizeFilter.xml</h3>
229      <pre>
230&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
231&lt;OptimizeAnimationMemberSettings&gt;
232        &lt;Filters Mode=&quot;positive&quot;&gt;
233                &lt;Path&gt;Materials[&quot;*&quot;].MaterialColor.Constant0&lt;/Path&gt;
234                &lt;Path&gt;Materials[&quot;*&quot;].MaterialColor.Constant1&lt;/Path&gt;
235        &lt;/Filters&gt;
236&lt;/OptimizeAnimationMemberSettings&gt;</pre>
237      <h3>Binarize.py</h3>
238      <p>
239        You must save the script file encoded in UTF-16 with BOM.
240      </p>
241      <pre>
242CreativeStudio.Execute(&quot;FileLoad&quot;, &quot;human.cmdl&quot;)
243CreativeStudio.Execute(&quot;FileLoad&quot;, &quot;human_all.ctex&quot;)
244CreativeStudio.Execute(&quot;OptimizeAnimationMember&quot;, &quot;-sf=OptimizeFilter.xml&quot;)
245CreativeStudio.Execute(&quot;FileSave&quot;, &quot;-o=human.bcres&quot;, &quot;-t=nw4cBinary&quot;)</pre>
246      <p>
247        Run a command similar to the following in the CreativeStudio console to output to binary.
248      </p>
249      <pre>NW4C_CreativeStudioConsole.exe -s=Binarize.py</pre>
250      <p>
251        The following definition file example shows the opposite scenario, where instead of only keeping the specified members, we only delete the specified members. Note here that the <CODE>Mode</CODE> attribute of the <CODE>Filters</CODE> member is set to <CODE>negative</CODE>.
252      </p>
253      <pre>
254&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
255&lt;OptimizeAnimationMemberSettings&gt;
256        &lt;Filters Mode=&quot;negative&quot;&gt;
257                &lt;Path&gt;IsVisible&lt;/Path&gt;
258                &lt;Path&gt;Meshes[&quot;*&quot;].IsVisible&lt;/Path&gt;
259                &lt;Path&gt;MeshNodeVisibilities[&quot;*&quot;].IsVisible&lt;/Path&gt;
260        &lt;/Filters&gt;
261&lt;/OptimizeAnimationMemberSettings&gt;</pre>
262      <p>
263        The <CODE>reset</CODE> value for the <CODE>Mode</CODE> attribute is new starting from version 1.2.0. Although the binary export works basically the same for both <CODE>positive</CODE> or <CODE>reset</CODE>, specifying <CODE>reset</CODE> will re-enable the specified members if they have already been deleted and disabled.
264      </p>
265      <p>
266        The example here uses a script file, but you can also run a binary export from the console panel.
267      </p>
268    </div>
269
270    <h2 id="delete_anim_member_auto">Automatically Deleting Unnecessary Animation Members</h2>
271    <div class="section">
272      <p>
273        CreativeStudio version 1.2.0 and later include an operation to extract necessary members from animation data while also automatically deleting unnecessary members. The following example shows the main way of using this feature. Note that this example also outputs an intermediate file containing information about which members were deleted (disabled). As of version 1.2.0, you cannot check from within CreativeStudio whether a member is enabled or disabled.
274      </p>
275      <h3>Optimizing Loaded Content</h3>
276      <ol>
277        <li>Load all objects and animations to optimize.</li>
278        <li>Select the objects to optimize. If no selection is made, all objects will be optimized.</li>
279        <li>Enter and execute the following command on the console panel.
280          <pre>CreativeStudio.Execute(&quot;OptimizeUnusedAnimationMember&quot;)</pre>
281        </li>
282        <li>This will optimize the relevant items and display the results on the console panel.</li>
283      </ol>
284      <h3>Creating a Definition File</h3>
285      <ol>
286        <li>Load all animations to optimize.</li>
287        <li>Note that all animations will be optimized regardless of the selection you make.</li>
288        <li>Enter and execute the following command on the console panel.
289          <pre>CreativeStudio.Execute(&quot;OptimizeUnusedAnimationMember&quot;)</pre>
290          or
291          <pre>CreativeStudio.Execute(&quot;OptimizeUnusedAnimationMember&quot;, &quot;-sf=[definition_file_name]&quot;)</pre>
292        </li>
293        <li>This saves a definition file.</li>
294        <li>Close all animations and load the objects to optimize.</li>
295        <li>Select the objects to optimize. If no selection is made, all objects will be optimized.</li>
296        <li>Enter and execute the following command on the console panel.
297          <pre>CreativeStudio.Execute(&quot;OptimizeAnimationMember&quot;)</pre>
298          or
299          <pre>CreativeStudio.Execute(&quot;OptimizeAnimationMember&quot;, &quot;-sf=[definition_file_name]&quot;)</pre>
300        </li>
301        <li>This will optimize the relevant items and display the results on the console panel.</li>
302      </ol>
303      <p>
304        You can also use the definition file created by this procedure from a script file, as described in <a href="#delete_anim_member">Deleting Unnecessary Animation Members</a>.
305      </p>
306    </div>
307
308    <h2 id="disable_anim">Disabling <CODE>AnimBinding</CODE> for Unanimated Nodes</h2>
309    <div class="section">
310      <p>
311        If you know at time of creation that a model will not be animated, you can create nodes with animation disabled. This avoids unnecessary processing during scene updates.
312      </p>
313      <p>
314        For details, see <a href="../../nw/gfx/SceneBuilder/IsAnimationEnabled.html"><CODE>SceneBuilder::IsAnimationEnabled</CODE></a>.
315      </p>
316    </div>
317
318    <h2 id="remove_useless_anim">Deleting Alpha Value Animations Unused by Standard Features</h2>
319    <div class="section">
320      <p>
321        Deleting the following material animations unused by standard features can reduce memory sizes and improve runtime efficiency.
322        <ul>
323                <li>Emission alpha colors</li>
324                <li>Specular 0,1 alpha values</li>
325        </ul>
326        You can also automatically delete these items, similar to the script shown in <a href="#delete_anim_member">Deleting Unnecessary Animation Members</a>.
327        <pre>
328CreativeStudio.Execute(&quot;FileLoad&quot;, &quot;human.cmata&quot;)
329<font color="blue">CreativeStudio.Execute(&quot;RemoveUselessAlphaAnimation&quot;)</font>
330CreativeStudio.Execute(&quot;FileSave&quot;, &quot;-o=human.bcres&quot;, &quot;-t=nw4cBinary&quot;)</pre>
331      </p>
332    </div>
333
334    <!-- </ANIM>  -->
335
336    <!-- <GFX>  -->
337    <h2 id="shader_program">Selecting a Shader Program According to the Number of Textures</h2>
338    <div class="section">
339    When using the default shader, you can select a shader program according to the number of textures.<br /> Configure this automatic shader program selection as follows.<br />
340    <p class="info">
341    ResGraphicsFile::ForeachModelMaterial(nw::gfx::DefaultShaderAutoSelector());
342    </p>
343    </div>
344    <h2 id="light_off">Turning Off Unnecessary Lights</h2>
345    <div class="section">
346    When not using fragment lights, disable material fragment lighting settings instead of just turning out lights. Also disable settings for vertex and hemispherical lights. You can skip quaternion calculation by the vertex shader by disabling fragment lighting. Normals are not included in exports from CreativeStudio when all lights are disabled.
347    </div>
348    <h2 id="light_write">Baking Lights to Vertex Colors</h2>
349    <div class="section">
350    If vertex processing is the bottleneck, bake vertex lights to the vertex color. If fill is the bottleneck, bake fragment lights to the vertex color. This should improve both vertex and fill processing.
351    </div>
352    <h2 id="user_shader">Using User Shaders</h2>
353    <div class="section">
354    When rendering models with an extremely large number of vertices, use a custom shader to improve processing. However, changing shaders increases the CPU load, so you must make offsetting adjustments to keep the CPU load from increasing, such as applying the custom shader to the background model only and using render priority to render that first. For information on user-defined shaders, see <a href="UserShader.html">Creating Shaders</a>.
355    </div>
356    <!-- </GFX>  -->
357  <hr><p>CONFIDENTIAL</p></body>
358</html>