# HG changeset patch # User Steve Losh # Date 1466962448 0 # Node ID 9099c4a3d13da775fe97ad3252248238fc58edf4 # Parent 2d9281a1f7e7fc3d9e53f25e8d23be149fa62673 Proofread DS diff -r 2d9281a1f7e7 -r 9099c4a3d13d content/blog/2016/02/midpoint-displacement.html --- a/content/blog/2016/02/midpoint-displacement.html Sat Jun 25 15:57:05 2016 +0000 +++ b/content/blog/2016/02/midpoint-displacement.html Sun Jun 26 17:34:08 2016 +0000 @@ -25,6 +25,12 @@ In this post we'll be looking at Midpoint Displacement. +The full series of posts so far: + +* [Midpoint Displacement](/blog/2016/02/midpoint-displacement/) +* [Recursive Midpoint Displacement](/blog/2016/03/recursive-midpoint-displacement/) +* [Diamond Square](/blog/2016/03/diamond-square/) + [project]: https://www.youtube.com/watch?v=G5u79w4qiAA [Unity]: http://unity3d.com/ diff -r 2d9281a1f7e7 -r 9099c4a3d13d content/blog/2016/03/recursive-midpoint-displacement.html --- a/content/blog/2016/03/recursive-midpoint-displacement.html Sat Jun 25 15:57:05 2016 +0000 +++ b/content/blog/2016/03/recursive-midpoint-displacement.html Sun Jun 26 17:34:08 2016 +0000 @@ -22,6 +22,12 @@ the cleanest way to do it. Before moving on to other algorithms I wanted to clean things up by using a handy library. +The full series of posts so far: + +* [Midpoint Displacement](/blog/2016/02/midpoint-displacement/) +* [Recursive Midpoint Displacement](/blog/2016/03/recursive-midpoint-displacement/) +* [Diamond Square](/blog/2016/03/diamond-square/) + [mpd]: /blog/2016/02/midpoint-displacement/ [TOC] diff -r 2d9281a1f7e7 -r 9099c4a3d13d content/blog/2016/06/diamond-square.html --- a/content/blog/2016/06/diamond-square.html Sat Jun 25 15:57:05 2016 +0000 +++ b/content/blog/2016/06/diamond-square.html Sun Jun 26 17:34:08 2016 +0000 @@ -27,11 +27,11 @@ * [Recursive Midpoint Displacement](/blog/2016/03/recursive-midpoint-displacement/) * [Diamond Square](/blog/2016/03/diamond-square/) -Midpoint Displacement is fairly simple and pretty fast, but it suffers from some -flaws. If you look at the end result you'll probably start to notice "seams" in -the terrain that appear on perfectly square chunks. This happens because when -you're calculating the midpoints of the edges of each square you're only -averaging two sources. +Midpoint Displacement is simple and fast, but it has some flaws. If you look at +the end result you'll probably start to notice "seams" in the terrain that +appear on perfectly square chunks. This happens because when you're calculating +the midpoints of the edges of each square you're only averaging two sources of +information. [Diamond Square][] is an algorithm that works a lot like Midpoint Displacement, but it adds an extra step to ensure that (almost) every point uses *four* @@ -168,8 +168,8 @@ └─┴─┴─┴─┴─┴─┴─┴─┴─┘ └─┴─┴─┴─┴─┴─┴─┴─┴─┘ -First we define how do do a single diamond-shaped region. Once again we'll use -a center point and radius to specify the region inside the heightmap: +Once again we'll use a center point and radius to specify the region inside the +heightmap: :::clojure (defn ds-diamond [heightmap x y radius spread] @@ -235,13 +235,12 @@ ## Iteration -Unfortunately we can't use recursion to iterate for diamond square like we did -for midpoint displacement. We have to interleave the diamond and square steps, +Unfortunately we can't use recursion to iterate for Diamond Square like we did +for Midpoint Displacement. We have to interleave the diamond and square steps, performing each round of squares on the *entire* map before moving on to a round -of diamonds. +of diamonds. If we don't, bad things will happen. -If we don't, bad things will happen. Let's look at an example to see why. -First we perform the initial square step: +Let's look at an example to see why. First we perform the initial square step:
            Column
@@ -460,7 +459,7 @@
 
 
-It looks a lot like the result from midpoint displacement, but without the ugly +It looks a lot like the result from Midpoint Displacement, but without the ugly seams around the square chunks. The code for these blog posts is a bit of a mess because I've been copy/pasting