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);
        }
示例#2
0
        public static Material WithPBRMetallicRoughness(
            this Material material,
            Vector4 baseColorFactor, string baseColorImageFilePath,
            float metallicFactor  = 1, string metallicImageFilePath   = null,
            float roughnessFactor = 1, string roughtnessImageFilePath = null
            )
        {
            material.WithPBRMetallicRoughness();

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

            material.FindChannel("BaseColor").SetFactor(baseColorFactor);
            material.FindChannel("Metallic").SetFactor(metallicFactor);
            material.FindChannel("Roughness").SetFactor(roughnessFactor);

            return(material);
        }
示例#3
0
        public static Material WithPBRMetallicRoughness(
            this Material material,
            Vector4 baseColor,
            string baseColorImageFilePath,
            string metallicImageFilePath = null,
            float metallicFactor         = 1,
            float roughnessFactor        = 1
            )
        {
            Guard.NotNull(material, nameof(material));

            material
            .WithPBRMetallicRoughness()
            .WithChannelColor("BaseColor", baseColor)
            .WithChannelFactor("MetallicRoughness", "MetallicFactor", metallicFactor)
            .WithChannelFactor("MetallicRoughness", "RoughnessFactor", roughnessFactor);

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

            return(material);
        }
        public static Material WithChannelTexture(this Material material, string channelName, int textureSet, string imageFilePath)
        {
            Guard.NotNull(material, nameof(material));

            var image = material.LogicalParent.UseImageWithFile(imageFilePath);

            return(material.WithChannelTexture(channelName, textureSet, image));
        }