From a2045b2075fdfc9b50d6f6ae2bd7a227a6ea1832 Mon Sep 17 00:00:00 2001 From: melchior Date: Sat, 29 May 2021 17:09:21 -0400 Subject: [PATCH] Tweaked slope shading --- Automap/Renderers/StandardRenderer.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Automap/Renderers/StandardRenderer.cs b/Automap/Renderers/StandardRenderer.cs index 415f488..1a56ba9 100644 --- a/Automap/Renderers/StandardRenderer.cs +++ b/Automap/Renderers/StandardRenderer.cs @@ -126,10 +126,7 @@ namespace Automap } } else missingRainmap++; } - - ushort avgOverlap_Y = ( ushort )overlapHeightmap.OfType( ).Average((ushort sel) => sel == 0 ? targetColMeta.YMax : sel); - //TODO: Row - then - Column averaging at Edges? - + #if DEBUG var badHeightData = overlapHeightmap.OfType( ).Count((ushort arg) => arg == 0); @@ -158,7 +155,7 @@ namespace Automap continue; } - float slopeBoost = 1f; + float slopeBoost = 0.95f; int northH, northWestH, westH; int north_X = localX + 1; @@ -169,12 +166,12 @@ namespace Automap int northWest_Z = localZ; bool edge = localX == 0 || localZ == 0; - northH = Math.Sign(localY - (overlapHeightmap[north_X, north_Z] == 0 ? localY : overlapHeightmap[north_X, north_Z])); - northWestH = Math.Sign(localY - (overlapHeightmap[northWest_X, northWest_Z] == 0 ? localY : overlapHeightmap[northWest_X, northWest_Z])); - westH = Math.Sign(localY - (overlapHeightmap[west_X, west_Z] == 0 ? localY : overlapHeightmap[west_X, west_Z])); + northH = Math.Sign(localY - (overlapHeightmap[north_X, north_Z] <= 1 ? localY : overlapHeightmap[north_X, north_Z])); + northWestH = Math.Sign(localY - (overlapHeightmap[northWest_X, northWest_Z] <= 1 ? localY : overlapHeightmap[northWest_X, northWest_Z])); + westH = Math.Sign(localY - (overlapHeightmap[west_X, west_Z] <= 1 ? localY : overlapHeightmap[west_X, west_Z])); float slopeness = (northH + northWestH + westH); - float tolerance = edge ? 2.0f : 0f; + float tolerance = edge ? 1.0f : 0f; if (slopeness > tolerance) slopeBoost = 1.2f; -- 2.11.0