Added and Revised Items in 2.0.0

Graphics

Animation

Particle

Troubleshooting:

How do I display more than one character having the same motion?

See Sharing Skeletons.

How do I dynamically change the world matrix of a model?

See Overwriting the world matrix of a node or bone.
For information regarding callbacks, also see Interrupting updates or rendering using callbacks.

How do I set the visibility of a mesh using DCC node names?

If the Mesh Visibility Mode option of the DCC exporter is set to Bind By Name, 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.

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.

The sample code below sets the model node named "Shield" as invisible.

Model* model;
int idx = model->GetResModel().GetMeshNodeVisibilitiesIndex("Shield");
NW_ASSERT(idx != -1); // Can't find a node with the specified name
model->GetResMeshNodeVisibilities(idx).IsVisible = false;

You can also set animations for this visibility table. The method for setting animations is the same as for other visibility animations.

How do I get the scale for nodes and bones?

See Handling Scaling.

Ambient light is not applied

Ambient light cannot be applied if at least one fragment light does not exist. This is due to hardware restrictions.
If you want to apply an ambient light only, this can be done by adding a black fragment light.

Named visibilities at the node level under DCC are not enabled

Set the Mesh Visibility Mode option of the DCC exporter to Bind By Name to sets visibility at the node name level under DCC rather than using mesh numbers.

This visibility flag is saved in table format within the model class, rather than as a mesh. You must use the GetMeshNodeVisibilitiesIndex and GetResMeshNodeVisibilities functions to get the flag. You can also use the IsMeshVisible function to get the bitwise AND of the mesh visibilities and named visibilities.

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 BasicEnqueueModelFunctor implementation for details.

How do I apply lighting and other material settings to a non-gfx render?

When also using non-gfx 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 gfx material with another library, use the DirectMaterialActivator function to set a specific command. The following code gives an example of use.

  1. Create a DirectMaterialActivator object and set the flag.
    directActivator = nw::gfx::DirectMaterialActivator::Create(allocator);
    directActivator->SetActivateFlags(nw::gfx::Model::MULTI_FLAG_LIGHTING_MATERIAL);
        			
    This code sets a lighting material to the flag.
  2. Get the Material from the Model, and set it to the RenderContext. Use DirectMaterialActivator to activate the set material.
    nw::gfx::Material* material = model->GetMaterial(0);
    renderContext->SetMaterial(material);
    renderContext->ActivateContext(directActivator);
        			
    This only sets the commands for the specified material.
  3. Render for the non-gfx libraries, such as the CTR Mii Face Library or the GR library, so as not to overwrite the commands.

Models very far from the origin are not rendered correctly

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.

The following figure shows Male.cmdl located at a coordinate position of (10000.0f, 10000.0f, 10000.0f).

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.

How do I swap parts of a skeletal model?

Here, we introduce a method of sharing skeletons as one method of swapping parts such as when changing the clothes of a player character.

The following data is required.

Displays a model with swapped parts in the next step.

  1. Create a base skeletal mode.
    Bind animations or other effects to this model.
  2. Hide the base skeletal model as necessary.
    You must turn off mesh visibility at this time because skeleton updates will not be appplied if the visibility of the Model instance itself is turned off. Get the mesh using the GetResMeshes function and set visibility using the ResMesh::SetVisible function.
  3. Create a skeletal model having the required parts by sharing the skeleton with the base skeletal model.
    For details on sharing skeletons, see Sharing Skeletons.

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 InverseBaseMatrix 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.

Changes to TranslucencyKind at runtime are not reflected

If TranslucencyKind of the ResMaterial resource of the Material class is changed using the ResMaterial::SetTranslucencyKind function, be sure to make changes to the resource obtained using the GetShadingParameterResMaterial function. Regardless of the material buffer settings, you can get a resource to be changed using the GetShadingParameterResMaterial function.

How do I change a bone pose using TransformAnimEvaluator::Bind and ChangeAnim?

Bone poses change when calling TransformAnimEvaluator::Bind and ChangeAnim (even if the animation is not being evaluated).
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 Bind and ChangeAnim.

How do I execute an IsLightEnabled animation of a light?

IsLightEnabled animations are only enabled when the scene environment light set includes the target light.

The same is true when directly setting a flag without using animation.

How do I improve rough motion that results when changing the playback speed of a frame-format skeletal animation?

Calculate the value of a fractional frame by using linear interpolation to find the value of the previous and next frame.
This algorithm emphasizes accuracy over speed.

How do I make the double buffer work smoothly?

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.

See Explicitly Flushing the VBO Cache.

How do I change resource parameters?

See Changing Resource Parameters.

How do I change individual particle values?

See Changing Particle Information

How do I make the initializer disappear?

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.

See Conditions for Optimizing Streams to Parameters.

How do I execute a user-defined process on particles?

See User Updaters.

How do I change the size?

For details on enlarging or reducing the size of the coordinate system, see Usage of Each Scale.

See Enlarging and Reducing Particles During Rendering.

The GPU hangs after certain operations

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.

Do not run the following operations if the GPU might be accessing the buffer (i.e. when particle rendering is not complete).

How do I reduce the binary file size for particles?

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 Delete Unnecessary Animation Members for details.

If the message "Vertex-lights or user-registers might be overridden by bone matrices." appears

This message indicates that vertex lights or user registers may have been overwritten by bone matrices.
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.


CONFIDENTIAL