Beispiel #1
0
    /// <summary>
    /// Creates a material with sensible default values for characters
    /// <param name="matType">body, eye or mouth</param>
    /// </summary>
    public static Material CreateCharacterMaterial(CharacterMaterialType materialType)
    {
        var material = new Material(Shader.Find("Pegasus/CH/CH_Base"));

        ApplyDefaultMaterialProperties(material, materialType);

        return(material);
    }
Beispiel #2
0
    public static string ToKeywordString(this CharacterMaterialType materialType)
    {
        switch (materialType)
        {
        case CharacterMaterialType.Eyes:
            return("EYE");

        case CharacterMaterialType.Mouth:
            return("MOUTH");

        default:
            return("BODY");
        }
    }
Beispiel #3
0
    public static void ApplyDefaultMaterialProperties(Material material, CharacterMaterialType materialType)
    {
        material.shader = Shader.Find("Pegasus/CH/CH_Base");
        material.DisableKeyword("_MATERIALTYPE_BODY");
        material.EnableKeyword($"_MATERIALTYPE_{materialType.ToKeywordString()}");
        material.SetInt("_MaterialType", (int)materialType);

        material.SetFloat("_OutlineWidth", 0.2f);
        material.SetColor("_OutlineColor", new Color(0.1f, 0.1f, 0.1f, 1f)); // TODO: Calculate from average texture color
        material.SetFloat("_OutlineOffset", 0.5f);
        material.SetColor("_HighlightColor", Color.white);
        material.SetColor("_AddColor", Color.black);
        material.SetColor("_Condition", Color.gray);
        material.SetColor("_Visible", Color.white);

        material.SetTexture("_ShadowColor", TextureHelpers.GetDefaultTexture("ShadowColor"));
        material.SetTexture("_MatCap", TextureHelpers.GetDefaultTexture("CH_LightMap"));
        material.SetTexture("_Kamishitu", TextureHelpers.GetDefaultTexture("Gayousi_loop"));
        material.SetTexture("_HSVMaskTex", TextureHelpers.GetDefaultTexture("HSVMaskTex"));
    }