Highlight a part of the 3D model

Hi,
I have a 3D character model and I have applied several texture materials to the geometries of the model. Now I want to highlight a specific part of the body (lets say fore arm) dynamically when an action is triggered and remove the highlight when it is not needed. But I don't understand how to access these specific body parts and do the color changes. Any help would be appreciated.

Answers

  • EgorBoEgorBo BYXamarin Team ✭✭✭

    Just find the material of the corresponding part of the body and apply some animation depending on the material, for example:

    var specColorAnimation = new ValueAnimation();
    Color color = new Color(0.8f, 0.8f, 0.1f);
    Color fade = new Color(0.5f, 0.5f, 0.5f);
    specColorAnimation.SetKeyFrame(0.0f, fade);
    specColorAnimation.SetKeyFrame(0.5f, color);
    specColorAnimation.SetKeyFrame(1.0f, fade);
    mat.SetShaderParameterAnimation("MatDiffColor", specColorAnimation, WrapMode.Loop, 1.0f);
    

    I've done something similiar in my small project: https://github.com/EgorBo/UrhoAssetImporter/blob/master/UrhoSharp.Viewer.Core/Previewers/PrefabPreviewer.cs#L88

    Result.

Sign In or Register to comment.