TransformNode and Bone?gfx render?TransformAnimEvaluator::Bind and ChangeAnim?IsLightEnabled animation of a light?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.
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.
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.
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.
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.
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.
gfx libraries, such as the CTR Mii Face Library or the GR library, so as not to overwrite the commands.
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.
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.
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.
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.
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.
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.
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.
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.
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.
For details on enlarging or reducing the size of the coordinate system, see Usage of Each Scale.
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).
ParticleSet::ClearParticleCollectionPARTICLE_BUFFER_BACK side.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.
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