
This demo dynamically changes material settings.
This demo can change four types of material settings.
In order from top down, it can perform material change, change by buffer, texture change, and lookup table change.
This demo can change material settings.
Each of the four methods of making changes will be described separately.
In the past, separate material settings were applied without setting the material configured for the model.
Execute StartMaterialChangeRenderCommand before drawing a model whose material is to be changed. After rendering execute EndMaterialChangeRenderCommand.
Set the material to be swapped using SetMaterial. Set SetRenderMode to RENDERMODE_IGNORE_MATERIAL so that the material of the model to be drawn is not set and material settings are ignored.
This command restores the RenderMode changed by the StartMaterialChangeRenderCommand to its original state. Set RENDERMODE_DEFAULT to restore original status.
You can change the material settings for each model instance by using the material buffer when changing material settings.
In the demo, the diffuse color of the material is changed.
To use the material buffer, specify the option you want to use with BufferOption from BufferOption.
To dynamically set textures, set SetTexture to ResTexture. Ownership does not change even if SetTexture is set.
If a texture change has been made, invalidate the hash by setting nw::gfx::res::ResMaterial::SetTextureMappersHash to 0.
To dynamically change lookup tables, set SetSampler to ResLookupTable. Ownership does not change even if SetSampler is set.
If a lookup table change has been made, invalidate the hash by setting nw::gfx::res::ResMaterial::SetFragmentLightingTableHash to 0.
CONFIDENTIAL