Skip to content

Commit 226619f

Browse files
Fixed affects AO for deacl materials (#2950)
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent 4e4bbcc commit 226619f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4242
- Fixed shader graph not supporting indirectdxr multibounce (case 1294694).
4343
- Fixed the planar depth texture not being properly created and rendered to (case 1299617).
4444
- Fixed C# 8 compilation issue with turning on nullable checks (case 1300167)
45+
- Fixed affects AO for deacl materials.
4546

4647
### Changed
4748
- Removed the material pass probe volumes evaluation mode.

com.unity.render-pipelines.high-definition/Editor/Material/Decal/DecalUI.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialPro
4747
// All Setup Keyword functions must be static. It allow to create script to automatically update the shaders with a script if code change
4848
static public void SetupCommonDecalMaterialKeywordsAndPass(Material material)
4949
{
50+
bool affectsMaskmap = false;
51+
affectsMaskmap |= material.HasProperty(kAffectMetal) && material.GetFloat(kAffectMetal) == 1.0f;
52+
affectsMaskmap |= material.HasProperty(kAffectAO) && material.GetFloat(kAffectAO) == 1.0f;
53+
affectsMaskmap |= material.HasProperty(kAffectSmoothness) && material.GetFloat(kAffectSmoothness) == 1.0f;
54+
5055
CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_ALBEDO", material.HasProperty(kAffectAlbedo) && material.GetFloat(kAffectAlbedo) == 1.0f);
5156
CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_NORMAL", material.HasProperty(kAffectNormal) && material.GetFloat(kAffectNormal) == 1.0f);
52-
CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", material.HasProperty(kAffectMetal) && material.GetFloat(kAffectMetal) == 1.0f);
53-
CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", material.HasProperty(kAffectAO) && material.GetFloat(kAffectAO) == 1.0f);
54-
CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", material.HasProperty(kAffectSmoothness) && material.GetFloat(kAffectSmoothness) == 1.0f);
57+
CoreUtils.SetKeyword(material, "_MATERIAL_AFFECTS_MASKMAP", affectsMaskmap);
5558

5659
// Albedo : RT0 RGB, A - sRGB
5760
// Normal : RT1 RGB, A

0 commit comments

Comments
 (0)