public static void UpdateStandardMaterialKeywords(Material material)
        {
            if (material == null)
            {
                throw new ArgumentNullException("material");
            }

            if (material.GetTexture("_MetallicGlossMap"))
            {
                material.SetFloat("_Smoothness", material.GetFloat("_GlossMapScale"));
            }
            else
            {
                material.SetFloat("_Smoothness", material.GetFloat("_Glossiness"));
            }

            if (material.IsKeywordEnabled("_ALPHATEST_ON"))
            {
                material.SetFloat("_AlphaClip", 1.0f);
            }

            material.SetFloat("_WorkflowMode", 1.0f);
            CoreUtils.SetKeyword(material, "_OCCLUSIONMAP", material.GetTexture("_OcclusionMap"));
            CoreUtils.SetKeyword(material, "_METALLICSPECGLOSSMAP", material.GetTexture("_MetallicGlossMap"));
            UpdateSurfaceTypeAndBlendMode(material);
            BaseShaderGUI.SetupMaterialBlendMode(material);
        }
 static void UpgradeV2(Material material, ShaderPathID shaderID)
 {
     // fix 50 offset on shaders
     if (material.HasProperty("_QueueOffset"))
     {
         BaseShaderGUI.SetupMaterialBlendMode(material);
     }
 }
Exemplo n.º 3
0
        static void UpgradeV2(Material material, ShaderID shaderID)
        {
            if (shaderID.IsShaderGraph())
            {
                return;
            }

            // fix 50 offset on shaders
            if (material.HasProperty("_QueueOffset"))
            {
                BaseShaderGUI.SetupMaterialBlendMode(material);
            }
        }
        public static void UpdateMaterialKeywords(Material material)
        {
            if (material == null)
            {
                throw new ArgumentNullException("material");
            }

            material.shaderKeywords = null;
            BaseShaderGUI.SetupMaterialBlendMode(material);
            UpdateMaterialSpecularSource(material);
            CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap"));

            // A material's GI flag internally keeps track of whether emission is enabled at all, it's enabled but has no effect
            // or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color.
            // The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color.
            MaterialEditor.FixupEmissiveFlag(material);
            bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0;

            CoreUtils.SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled);
        }
Exemplo n.º 5
0
        public static void ConvertHDRPtoURPMaterialKeywords(Material material)
        {
            if (material == null)
            {
                throw new ArgumentNullException("material");
            }

            if (material.GetTexture("_MetallicGlossMap"))
            {
                material.SetFloat("_Smoothness", 1);
            }
            //else
            //    material.SetFloat("_Smoothness", material.GetFloat("_Glossiness"));

            material.SetFloat("_WorkflowMode", 1.0f);
            CoreUtils.SetKeyword(material, "_OCCLUSIONMAP", material.GetTexture("_OcclusionMap"));
            CoreUtils.SetKeyword(material, "_METALLICSPECGLOSSMAP", material.GetTexture("_MetallicGlossMap"));
            UpdateSurfaceTypeAndBlendMode(material);
            BaseShaderGUI.SetupMaterialBlendMode(material);
        }
        public static void UpdateStandardSpecularMaterialKeywords(Material material)
        {
            if (material == null)
            {
                throw new ArgumentNullException("material");
            }

            if (material.GetTexture("_SpecGlossMap"))
            {
                material.SetFloat("_Smoothness", material.GetFloat("_GlossMapScale"));
            }
            else
            {
                material.SetFloat("_Smoothness", material.GetFloat("_Glossiness"));
            }

            material.SetFloat("_WorkflowMode", 0.0f);
            CoreUtils.SetKeyword(material, "_OCCLUSIONMAP", material.GetTexture("_OcclusionMap"));
            CoreUtils.SetKeyword(material, "_METALLICSPECGLOSSMAP", material.GetTexture("_SpecGlossMap"));
            CoreUtils.SetKeyword(material, "_SPECULAR_SETUP", true);
            UpdateSurfaceTypeAndBlendMode(material);
            BaseShaderGUI.SetupMaterialBlendMode(material);
        }
Exemplo n.º 7
0
    private void UpdateMaterialKeywords(MaterialEditor materialEditor)
    {
        Material material = materialEditor.target as Material;

        material.shaderKeywords = null;

        CoreUtils.SetKeyword(material, ToonShaderEditorStatic.RIM_LIGHTNING_ENABLED, this.RimPower.floatValue >= 0f && this.RimPower.floatValue <= 1f);
        CoreUtils.SetKeyword(material, ToonShaderEditorStatic.TOON_SPECULAR_ENABLED, this.SpecularRamp.textureValue != null);
        CoreUtils.SetKeyword(material, ToonShaderEditorStatic.TOON_EMISSION_ENABLED, this.EmissionMap.textureValue != null);

        // Receive Shadows
        if (material.HasProperty("_ReceiveShadows"))
        {
            CoreUtils.SetKeyword(material, "_RECEIVE_SHADOWS_OFF", material.GetFloat("_ReceiveShadows") == 0.0f);
        }

        // Normal Maps
        if (material.HasProperty("_BumpMap"))
        {
            CoreUtils.SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap"));
        }

        BaseShaderGUI.SetupMaterialBlendMode(material);
    }