From eab6bdb9d108d6df2a2c0b62320e8a12c001a0ff Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Fri, 18 Dec 2020 11:29:43 +0100 Subject: [PATCH] Fixed affects AO for deacl materials --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Editor/Material/Decal/DecalUI.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index ccab5ab3375..4cc0bf3f8f7 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed enums UI for the shadergraph nodes. - Fixed ShaderGraph stack blocks appearing when opening the settings in Hair and Eye ShaderGraphs. - Fixed white screen when undoing in the editor. +- Fixed affects AO for deacl materials. ### Changed - Removed the material pass probe volumes evaluation mode. diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalUI.cs index e8d4d10e9fe..b3ad35c5241 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalUI.cs @@ -47,11 +47,14 @@ protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialPro // All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change static public void SetupCommonDecalMaterialKeywordsAndPass(Material material) { + bool affectsMaskmap = false; + affectsMaskmap |= material.HasProperty(kAffectMetal) && material.GetFloat(kAffectMetal) == 1.0f; + affectsMaskmap |= material.HasProperty(kAffectAO) && material.GetFloat(kAffectAO) == 1.0f; + affectsMaskmap |= material.HasProperty(kAffectSmoothness) && material.GetFloat(kAffectSmoothness) == 1.0f; + CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_ALBEDO", material.HasProperty(kAffectAlbedo) && material.GetFloat(kAffectAlbedo) == 1.0f); CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_NORMAL", material.HasProperty(kAffectNormal) && material.GetFloat(kAffectNormal) == 1.0f); - CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", material.HasProperty(kAffectMetal) && material.GetFloat(kAffectMetal) == 1.0f); - CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", material.HasProperty(kAffectAO) && material.GetFloat(kAffectAO) == 1.0f); - CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", material.HasProperty(kAffectSmoothness) && material.GetFloat(kAffectSmoothness) == 1.0f); + CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", affectsMaskmap); // Albedo : RT0 RGB, A - sRGB // Normal : RT1 RGB, A