コード例 #1
0
        public static Material WithPBRMetallicRoughness(
            this Material material,
            Vector4 baseColor,
            string baseColorImageFilePath,
            string metallicImageFilePath = null,
            float metallicFactor         = 1,
            float roughnessFactor        = 1
            )
        {
            material.WithPBRMetallicRoughness();

            material.WithChannelParameter("BaseColor", baseColor);
            material.WithChannelParameter("MetallicRoughness", new Vector4(metallicFactor, roughnessFactor, 0, 0));

            if (!string.IsNullOrWhiteSpace(baseColorImageFilePath))
            {
                material.WithChannelTexture("BaseColor", 0, baseColorImageFilePath);
            }
            if (!string.IsNullOrWhiteSpace(metallicImageFilePath))
            {
                material.WithChannelTexture("Metallic", 0, baseColorImageFilePath);
            }

            return(material);
        }