Flipped y value on uv so that the macro material lines up with the corresponding height data. (#4701)

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
Mike Balfour
2021-10-14 13:03:19 -05:00
committed by GitHub
parent 0c670b1123
commit c7e6907064
@@ -567,13 +567,15 @@ namespace Terrain
ShaderMacroMaterialData& shaderData = macroMaterialData.at(i);
const AZ::Aabb& materialBounds = materialData.m_bounds;
// Use reverse coordinates (1 - y) for the y direction so that the lower left corner of the macro material images
// map to the lower left corner in world space. This will match up with the height uv coordinate mapping.
shaderData.m_uvMin = {
(xPatch - materialBounds.GetMin().GetX()) / materialBounds.GetXExtent(),
(yPatch - materialBounds.GetMin().GetY()) / materialBounds.GetYExtent()
1.0f - ((yPatch - materialBounds.GetMin().GetY()) / materialBounds.GetYExtent())
};
shaderData.m_uvMax = {
((xPatch + GridMeters) - materialBounds.GetMin().GetX()) / materialBounds.GetXExtent(),
((yPatch + GridMeters) - materialBounds.GetMin().GetY()) / materialBounds.GetYExtent()
1.0f - (((yPatch + GridMeters) - materialBounds.GetMin().GetY()) / materialBounds.GetYExtent())
};
shaderData.m_normalFactor = materialData.m_normalFactor;
shaderData.m_flipNormalX = materialData.m_normalFlipX;