title: How do I remove a slope from terrain mesh to form a common ground?
body: <p>I am trying to create a flat terrain texture from photogrammetry.</p>
  <p>The terrain texture will look flat like this:</p>
  <p><a href="https://i.stack.imgur.com/OhHbR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OhHbR.png" alt="enter image description here" /></a></p>
  <p>The height should be stored in so-called additional height map.
  Such a height map looks like this:</p>
  <p><a href="https://i.stack.imgur.com/v91Yj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v91Yj.png" alt="enter image description here" /></a></p>
  <p>My terrain however has a slope. You can see this when you look at &quot;Side view&quot;.</p>
  <p>If I create my height map from this sloped terrain, the height map will reflect the unevenness. However, I just want to capture the height of the stones / grass and not the height of the terrain.</p>
  <p>To create a reasonable height map, I first need to flatten the terrain so that the height difference is not so huge anymore.</p>
  <p>The fine height details (coming from grass and stones) however should still be left intact.</p>
  <p>I have tried to bring it down to an even level by using a Move brush in a mesh modification software. The 3rd images reflects my efforts:</p>
  <p><a href="https://i.stack.imgur.com/ekjvH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ekjvH.png" alt="enter image description here" /></a></p>
  <p>It works, but I would like to use math to do this work for me.</p>
  <p>How could I do that?</p>
  <p>I have summed the height of all points and then divided the sum through the number of points to establish the average height.</p>
  <p>The average height was 150.</p>
  <p>Now I iterate through all points again, but what do I do now with the point value and the average height in order to make the terrain even?</p>
  <p>It should still keep its fine height details, it should just be more even (as can be seen in my manual attempt in image #3).</p>
  <p>Thank you!</p>