Skip to content

Commit

Permalink
[Port] [2021.3] Fixed layered lit displacement.
Browse files Browse the repository at this point in the history
Fixed Layered Lit Displacement
  • Loading branch information
svc-reach-platform-support authored and Evergreen committed Oct 12, 2023
1 parent 6e9bcfe commit f7ab75e
Showing 1 changed file with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,6 @@ static public void SetupBaseLitKeywords(Material material)

bool enableDisplacement = material.HasProperty(kDisplacementMode) && (GetFilteredDisplacementMode(material) != DisplacementMode.None);

// Displacement mapping requires a height map.
if (enableDisplacement)
{
int layerCount = material.HasProperty(kLayerCount) ? material.GetInt(kLayerCount) : 1;

// If the layerCount is 1, then it means that the property we're fetching is not from a layered material
// thus it doesn't have a postfix
string[] postfixes = (layerCount > 1) ? new[] { "0", "1", "2", "3" } : new[] { "" };

for (int i = 0; i < layerCount; i++)
{
string kHeightMapN = string.Format("{0}{1}", kHeightMap, postfixes[i]);

enableDisplacement = enableDisplacement && material.HasProperty(kHeightMapN) && (material.GetTexture(kHeightMapN) != null);
}
}

if (enableDisplacement)
{
var displacementMode = GetFilteredDisplacementMode(material);
Expand Down

0 comments on commit f7ab75e

Please sign in to comment.