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>FAQ</title>
8  </head>
9  <body>
10    <h1 id="newlist2_0_0">Added and Revised Items in 2.0.0</h1>
11    <ul>
12      <!-- 2.0.0 で追加・修正された項目 -->
13      <li><a href="#gfx_model_away_from_origin">Models very far from the origin are not rendered correctly</a></li>
14      <li><a href="#gfx_to_replace_parts">How do I swap parts of a skeletal model?</a></li>
15      <li><a href="#gfx_to_set_translucency_kind">Changes to TranslucencyKind at runtime are not reflected</a></li>
16    </ul>
17    <h1>Graphics</h1>
18    <ul>
19
20      <li><a href="#gfx_shared_skeleton">How do I display more than one character having the same motion?</a></li>
21      <li><a href="#gfx_world_matrix">How do I dynamically change the world matrix of a model?</a></li>
22      <li><a href="#mesh_node_visibility">How do I set the visibility of a mesh using DCC node names?</a></li>
23      <li><a href="#gfx_node_bone_scale">How do I get the scale for <CODE>TransformNode</CODE> and <CODE>Bone</CODE>?</a></li>
24      <li><a href="#gfx_global_ambient">Ambient light is not applied</a></li>
25      <li><a href="#gfx_mesh_node_visibility_unable">Named visibilities at the node level under DCC are not enabled</a></li>
26      <li><a href="#gfx_other_renderer">How do I apply lighting and other material settings to a non-<CODE>gfx</CODE> render?</a></li>
27      <li><a href="#gfx_model_away_from_origin">Models very far from the origin are not rendered correctly</a></li>
28      <li><a href="#gfx_to_replace_parts">How do I swap parts of a skeletal model?</a></li>
29      <li><a href="#gfx_to_set_translucency_kind">Changes to TranslucencyKind at runtime are not reflected</a></li>
30
31
32    </ul>
33    <h1>Animation</h1>
34    <ul>
35    <li><a href="#bind">How do I change a bone pose using <CODE>TransformAnimEvaluator::Bind</CODE> and <CODE>ChangeAnim</CODE>?</a></li>
36    <li><a href="#light_enabled">How do I execute an <CODE>IsLightEnabled</CODE> animation of a light?</a></li>
37    <li><a href="#koma_precision">How do I improve rough motion that results when changing the playback speed of a frame-format skeletal animation?</a></li>
38    </ul>
39    <h1>Particle</h1>
40  	<ul>
41      <li><a href="#ptcl_flushvbo">How do I make the double buffer work smoothly?</a></li>
42      <li><a href="#ptcl_changeresource">How do I change resource parameters?</a></li>
43      <li><a href="#ptcl_changestream">How do I change individual particle values?</a></li>
44      <li><a href="#ptcl_optimizestream">How do I make the initializer disappear?</a></li>
45      <li><a href="#ptcl_userupdater">How do I execute a user-defined process on particles?</a></li>
46      <li><a href="#ptcl_drawoffset">How do I change the size?</a></li>
47      <li><a href="#ptcl_gpuhungup">The GPU hangs after certain operations</a></li>
48    </ul>
49
50    <h1>Troubleshooting:</h1>
51  	<ul>
52      <li><a href="#trouble_shader">If the message &quot;Vertex-lights or user-registers might be overridden by bone matrices.&quot; appears</a></li>
53    </ul>
54
55    <!-- <GFX>  -->
56    <h2 id="gfx_shared_skeleton">How do I display more than one character having the same motion?</h2>
57    <div class="section">
58    See <a href="Coordinate.html#shared_skeleton">Sharing Skeletons</a>.
59    </div>
60    <h2 id="gfx_world_matrix">How do I dynamically change the world matrix of a model?</h2>
61    <div class="section">
62    See <a href="Coordinate.html#world_matrix">Overwriting the world matrix of a node or bone</a>.<br /> For information regarding callbacks, also see <a href="AdvancedFeature.html#callback">Interrupting updates or rendering using callbacks</a>.
63    </div>
64    <h2 id="mesh_node_visibility">How do I set the visibility of a mesh using DCC node names?</h2>
65    <div class="section">
66    <p>
67      If the <B>Mesh Visibility Mode</B> option of the DCC exporter is set to <B>Bind By Name</B>, the exporter outputs the DCC node names and a mesh visibility flag table corresponding to those nodes. Use this table to look up and change a flag by name, allowing you to set mesh visibility using the DCC node name. Mesh rendering uses the bitwise AND of this flag and the visibility flag for the mesh itself.
68    </p>
69    <p>
70      Similar tables also exist for model resources and model instances. Flags actually referenced when drawing meshes are actually stored in the model instance table, so this table cannot be used to look them up by name. Therefore, when setting visibility, first get the index from the model resource table using name look-up, and then set the flag by specifying the index in the model instance table.
71    </p>
72    <p>
73      The sample code below sets the model node named &quot;Shield&quot; as invisible.
74    </p>
75    <pre>
76Model* model;
77int idx = model-&gt;GetResModel().GetMeshNodeVisibilitiesIndex(&quot;Shield&quot;);
78NW_ASSERT(idx != -1); // Can't find a node with the specified name
79model-&gt;GetResMeshNodeVisibilities(idx).IsVisible = false;</pre>
80    <p>
81      You can also set animations for this visibility table. The method for setting animations is the same as for other visibility animations.
82    </p>
83    </div>
84    <h2 id="gfx_node_bone_scale">How do I get the scale for nodes and bones?</h2>
85    <div class="section">
86    See <a href="Coordinate.html#node_bone_scale">Handling Scaling</a>.
87    </div>
88
89    <h2 id="gfx_global_ambient">Ambient light is not applied</h2>
90    <div class="section">
91    <p>
92    	Ambient light cannot be applied if at least one fragment light does not exist. This is due to hardware restrictions.<br /> If you want to apply an ambient light only, this can be done by adding a black fragment light.
93    </p>
94    </div>
95    <h2 id="gfx_mesh_node_visibility_unable">Named visibilities at the node level under DCC are not enabled</h2>
96    <div class="section">
97    <p>
98      Set the <B>Mesh Visibility Mode</B> option of the DCC exporter to <B>Bind By Name</B> to sets visibility at the node name level under DCC rather than using mesh numbers.
99    </p>
100    <p>
101      This visibility flag is saved in table format within the model class, rather than as a mesh. You must use the <CODE>GetMeshNodeVisibilitiesIndex</CODE> and <a href="../../nw/gfx/Model/GetResMeshNodeVisibilities.html"><CODE>GetResMeshNodeVisibilities</CODE></a> functions to get the flag. You can also use the <a href="../../nw/gfx/Model/IsMeshVisible.html"><CODE>IsMeshVisible</CODE></a> function to get the bitwise AND of the mesh visibilities and named visibilities.
102    </p>
103    <p>
104      Your application does not generally need to be aware of these issues as these determinations are made automatically. However, if you have customized the render queue, you must also change visibility determination processing accordingly. See the <CODE>BasicEnqueueModelFunctor</CODE> implementation for details.
105    </p>
106    </div>
107
108    <h2 id="gfx_other_renderer">How do I apply lighting and other material settings to a non-<CODE>gfx</CODE> render?</h2>
109    <div class="section">
110    <p>
111    	When also using non-<CODE>gfx</CODE> libraries such as the CTR Mii Face Library or the GR library, you can render faster by batching commands together for each library. This minimizes the cost of switching between shaders and other resources. If using a <CODE>gfx</CODE> material with another library, use the <a href="../../nw/gfx/DirectMaterialActivator/Overview.html"><CODE>DirectMaterialActivator</CODE></a> function to set a specific command. The following code gives an example of use.
112    	<ol>
113    		<li>
114    			Create a <CODE>DirectMaterialActivator</CODE> object and set the flag.
115    			<pre>
116directActivator = nw::gfx::DirectMaterialActivator::Create(allocator);
117directActivator-&gt;SetActivateFlags(nw::gfx::Model::MULTI_FLAG_LIGHTING_MATERIAL);
118    			</pre>
119    			This code sets a lighting material to the flag.
120    		</li>
121    		<li>
122    			Get the <a href="../../nw/gfx/Material/Overview.html"><CODE>Material</CODE></a> from the <a href="../../nw/gfx/Model/Overview.html"><CODE>Model</CODE></a>, and set it to the <a href="../../nw/gfx/RenderContext/Overview.html"><CODE>RenderContext</CODE></a>. Use <CODE>DirectMaterialActivator</CODE> to activate the set material.
123    			<pre>
124nw::gfx::Material* material = model-&gt;GetMaterial(0);
125renderContext-&gt;SetMaterial(material);
126renderContext-&gt;ActivateContext(directActivator);
127    			</pre>
128    			This only sets the commands for the specified material.
129    		</li>
130    		<li>
131    			Render for the non-<CODE>gfx</CODE> libraries, such as the CTR Mii Face Library or the GR library, so as not to overwrite the commands.
132    		</li>
133    	</ol>
134    </p>
135    </div>
136    <h2 id="gfx_model_away_from_origin">Models very far from the origin are not rendered correctly</h2>
137    <div class="section">
138      <p>
139        If a model is located at a coordinate position that is very far from the origin, such as (1000.0f, 1000.0f, 1000.0f), a large error is introduced into vertext positions causing rendering precision to worsen because the error in floating point arithmetic in the vertex shader becomes relatively large.  When using the CTR vertex shader, floating point numbers are represented in 24 bits.
140      </p>
141      <p>
142        The following figure shows Male.cmdl located at a coordinate position of (10000.0f, 10000.0f, 10000.0f).
143      </p>
144      <img src="images/LessAccurateModel.png" width="240" height="180" />
145      <p>
146        This problem can be worked around by moving the background rather than the player character and shifting the entire scene so that the camera position is aligned with the origin before rendering.
147      </p>
148    </div>
149    <h2 id="gfx_to_replace_parts">How do I swap parts of a skeletal model?</h2>
150    <div class="section">
151      <p>
152        Here, we introduce a method of sharing skeletons as one method of swapping parts such as when changing the clothes of a player character.
153      </p>
154      <p>
155        The following data is required.
156      </p>
157      <ul>
158        <li>
159          Base skeletal models to be used for skeleton sharing<BR>A full body model of the character whose clothes are to be changed can be used.
160        </li>
161        <li>
162          Part skeletal model<BR>The structure of the base skeletal model and skeleton structure must match exactly.
163        </li>
164      </ul>
165      <p>
166        Displays a model with swapped parts in the next step.
167      </p>
168      <ol>
169        <li>
170          Create a base skeletal mode.<BR> Bind animations or other effects to this model.
171        </li>
172        <li>
173          Hide the base skeletal model as necessary. <BR> You must turn off mesh visibility at this time because skeleton updates will not be appplied if the visibility of the <a href="../../nw/gfx/Model/Overview.html">Model</a> instance itself is turned off. Get the mesh using the <a href="../../nw/gfx/Model/GetResMeshes.html">GetResMeshes</a> function and set visibility using the <a href="../../nw/gfx/res/ResMesh/SetVisible.html">ResMesh::SetVisible</a> function.
174        </li>
175        <li>
176          Create a skeletal model having the required parts by sharing the skeleton with the base skeletal model.<BR> For details on sharing skeletons, see <a href="./Coordinate.html#shared_skeleton">Sharing Skeletons</a>.
177        </li>
178      </ol>
179      <p>
180        If there are bones for which skin is not bound to the base skeletal model, the parts model display may break down, because values for the <a href="../../nw/gfx/res/ResBone/GetInverseBaseMatrix.html">InverseBaseMatrix</a> function used for skinning rendering vary depending on whether or not skin is bound to the bone . To prevent this, you can either bind skin to all bones, or reconfigure bones at runtime.  The members that must be reconfigured are InverstBaseMatrix and flags (ResBoneData::FLAG_HAS_SKINNING_MATRIX | ResBoneData::FLAG_IS_NEED_RENDERING). Both are overwritten using data obtained from the corresponding bone of the parts model. Flags can be set using the ResBone::SetFlags or ResBone::EnableFlags function.
181      </p>
182    </div>
183    <h2 id="gfx_to_set_translucency_kind">Changes to TranslucencyKind at runtime are not reflected</h2>
184    <div class="section">
185      <p>
186        If TranslucencyKind of the  <a href="../../nw/gfx/res/ResMaterial/Overview.html">ResMaterial</a> resource of the <a href="../../nw/gfx/Material/Overview.html">Material</a> class is changed using the <a href="../../nw/gfx/res/ResMaterial/SetTranslucencyKind.html">ResMaterial::SetTranslucencyKind</a> function, be sure to make changes to the resource obtained using the <span>GetShadingParameterResMaterial</span> function.  Regardless of the material buffer settings, you can get a resource to be changed using the GetShadingParameterResMaterial function.
187      </p>
188    </div>
189    <!-- <ANIM> -->
190    <h2 id="bind">How do I change a bone pose using <CODE>TransformAnimEvaluator::Bind</CODE> and <CODE>ChangeAnim</CODE>?</h2>
191    <div class="section">
192      <p>
193        Bone poses change when calling <a href="../../nw/gfx/TransformAnimEvaluator/Bind.html"><CODE>TransformAnimEvaluator::Bind</CODE></a> and <a href="../../nw/gfx/TransformAnimEvaluator/ChangeAnim.html"><CODE>ChangeAnim</CODE></a> (even if the animation is not being evaluated).<br /> The value of each frame does not need to be written for elements not being animated. The bind pose only needs to be written once when calling <CODE>Bind</CODE> and <CODE>ChangeAnim</CODE>.
194      </p>
195    </div>
196    <h2 id="light_enabled">How do I execute an <CODE>IsLightEnabled</CODE> animation of a light?</h2>
197    <div class="section">
198      <p>
199        <a href="../../nw/gfx/res/ResLight/IsLightEnabled.html"><CODE>IsLightEnabled</CODE></a> animations are only enabled when the scene environment light set includes the target light.
200      </p>
201      <p>
202        The same is true when directly setting a flag without using animation.
203      </p>
204    </div>
205    <h2 id="koma_precision">How do I improve rough motion that results when changing the playback speed of a frame-format skeletal animation?</h2>
206    <div class="section">
207      <p>
208        Calculate the value of a fractional frame by using linear interpolation to find the value of the previous and next frame.<br /> This algorithm emphasizes accuracy over speed.
209        <ul>
210          <li>Vector components used in scale and translate operations are subject to linear interpolation.</li>
211          <li>All quaternion elements are subject to linear interpolation for rotate operations.</li>
212        </ul>
213      </p>
214    </div>
215	<!-- <PTCL> -->
216    <h2 id="ptcl_flushvbo">How do I make the double buffer work smoothly?</h2>
217    <div class="section">
218      <p>The VBO cache may cause particle behavior such as particles not being displayed in locations where they should exist, particles being displayed in places where they should not exist, and particles not moving smoothly. </p>
219      <p>See <a href="Particle/Draw.html#flushvbo">Explicitly Flushing the VBO Cache</a>.
220      </p>
221    </div>
222    <h2 id="ptcl_changeresource">How do I change resource parameters?</h2>
223    <div class="section">
224    See <a href="Particle/Calc.html#changeresource">Changing Resource Parameters</a>.
225    </div>
226    <h2 id="ptcl_changestream">How do I change individual particle values?</h2>
227    <div class="section">
228    See <a href="Particle/Calc.html#changestream">Changing Particle Information</a>
229    </div>
230    <h2 id="ptcl_optimizestream">How do I make the initializer disappear?</h2>
231    <div class="section">
232      <p>Sometimes, after attempting to change resources, the initializer cannot be found even if you search for it. This happens because the initializer has been deleted due to optimization. </p>
233      <p>See <a href="Particle/Calc.html#optimizestream">Conditions for Optimizing Streams to Parameters</a>.
234      </p>
235    </div>
236    <h2 id="ptcl_userupdater">How do I execute a user-defined process on particles?</h2>
237    <div class="section">
238    See <a href="Particle/Calc.html#userupdater">User Updaters</a>.
239    </div>
240    <h2 id="ptcl_drawoffset">How do I change the size?</h2>
241    <div class="section">
242      <p>For details on enlarging or reducing the size of the coordinate system, see <a href="Particle/Coordinate.html#scale">Usage of Each Scale</a>.</p>
243      <p>See <a href="Particle/Draw.html#drawoffset">Enlarging and Reducing Particles During Rendering</a>.
244      </p>
245    </div>
246    <h2 id="ptcl_gpuhungup">The GPU hangs after certain operations</h2>
247    <div class="section">
248      <p>The command buffer is doubled. If CPU and GPU processes are executing in parallel, any operation that changes the buffer accessed by the GPU can cause rendering corruption, and can cause the GPU to hang.</p>
249      <p>Do not run the following operations if the GPU might be accessing the buffer (i.e. when particle rendering is not complete).</p>
250      <ul>
251        <li><CODE>ParticleSet::ClearParticleCollection</CODE></li>
252        <li>Destroying class instances</li>
253        <li>Changing streams on the <CODE>PARTICLE_BUFFER_BACK</CODE> side.</li>
254      </ul>
255    </div>
256    <h2 id="ptcl_gpuhungup">How do I reduce the binary file size for particles?</h2>
257    <div class="section">
258      <p>Delete the binary resources for the particle default shader. When doing so, your application must load an external shader file and set up the resources. You can further reduce the binary size by deleting any unnecessary animation members. See <a href="Optimization.html#delete_anim_member">Delete Unnecessary Animation Members</a> for details.
259      </p>
260    </div>
261
262	<!-- <TROUBLE> -->
263    <h2 id="trouble_shader">If the message &quot;Vertex-lights or user-registers might be overridden by bone matrices.&quot; appears</h2>
264    <div class="section">
265      <p>
266      	This message indicates that vertex lights or user registers may have been overwritten by bone matrices.<BR> If this message appears, be sure to either limit the number of bones using the DCC plug-in or reduce the number of vertex lights and user registers.
267      </p>
268    </div>
269
270<hr><p>CONFIDENTIAL</p></body>
271</html>
272