Monday, June 3, 2019

mathematics - Terracing mountain features


I'm looking to replicate a procedural terrain effect I found on a portfolio/blog site a few days ago.


Terraced terrain


Quoting the site, the terracing was generated through, "multiplying [the final height] by some damping value within a certain height range, to create beautiful canyon features."


I was wondering, would anyone be able to provide a more technical example or procedure for going about this? Over the past week, I've been researching and learning a lot about procedural terrain/texture methods and practices but I still haven't come across anything that explains in detail what 'clamping' is, and I'm starting to become frustrated.



Answer



After a very long break, I now understand how the effect was achieved, and it's incredibly simple. There are 4 parts to this effect:




  • The initial heightmap of the terrain

  • Defining a terrace 'range', with the lowest height of the terrace being h1 and the highest height of the terrace being h2

  • A damping value that flattens out the ground within the range of the terrace height

  • A second, longer-range heightmap to modify the h1 and h2 values, which is how the continuous ramps between terraces are formed (a third heightmap could be used to increase or decrease h1 and h2 independent of eachother, creating larger or smaller terraces)


Here is the procedure to create the effect:


h1 = 1
h2 = 2
damp = .01


h = gen_noise(position)
hm = heightmod_noise(position)
if h1+hm <= initial_terrain_height =< h2+hm
th = h * damp
elseif h2+hm < h
th = h - (h2-h1) * damp
else
th = h

(th, of course, is the height of the terrain after the terracing effect is applied)



No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...