Đang chuẩn bị liên kết để tải về tài liệu:
Focus On 3D Terrain Programming phần 3
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Hình 2.10 Heightmaps được tạo ra bằng cách sử dụng các thuật toán lỗi hình thành và bộ lọc sự xói mòn. Hình ảnh trên cùng có một giá trị bộ lọc của 0.0f, hình ảnh giữa một giá trị lọc của 0.2f, và hình ảnh dưới cùng có một giá trị lọc của 0.4f. | Fractal Terrain Generation 33 Figure 2.10 Heightmaps that were generated using the fault-formation algorithm and the erosion filter. The top image has a filter value of 0.0f the middle image has a filter value of 0.2f and the bottom image has a filter value of 0.4f. NOTE It s important to note that the midpoint displacement algorithm has a slight drawback to it The algorithm can only generate square heightmaps and the dimensions have to be a power of two.This is unlike the fault formation algorithm in which you can specify any dimension that you want. Midpoint Displacement Fault formation works great for a nice little scene composed of some small hills but what if you want something more chaotic than that such as a mountain range Well look no further. Midpoint displacement2 is the answer that you re looking for This algorithm is also known as the plasma fractal and the diamond-square algorithm. However midpoint displacement sounds so much cooler and it gives the reader that s you a better idea of what actually is going on in this whole process so I ll stick to that term most of the time. All we are doing in this algorithm essentially is taking a single line s midpoint and displacing it Let me give you a one-dimensional run-through. If we had a simple line such as AB in Figure 2.11 we d take its midpoint represented as C in the figure and move it A----ỗ----B Figure 2.11 A simple line which is the first stage in the ID version of the algorithm. Now we re going to displace the midpoint of that line by a height value which we ll call fHeight see Figure 2.12 . We ll make it equivalent to the length of the line in question and we ll displace the midpoint by a range of -fHeight 2 to fHeight 2. We want to subdivide the line in two each time and we want to displace the height of the line somewhere in that range. Figure 2.12 The line from Figure 2.11 after one displacement pass. After the first pass we need to decrease the value of fHeight to achieve the roughness that we .