But, I was not yet convinced, so I took a closer look at the
RiemersSkyDome
class. In order to determine the place of the dome in the world, a matrix is calculated as follows:wMatrix = Matrix.CreateTranslation(0, -0.30f, 0)
* Matrix.CreateScale(100)
* Matrix.CreateTranslation(camera.Position);
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRbiceES2DRSsMce8i7FkOV0ilwiuoatwLKJ7XGb8u1py_VlDc2xGqIj0pnkNqZaKJSZrYVw0nh_ABJ_YgrDVJLS0riTXPwf2W41fKCu22z41D3bHBu0RAlqtowEUuGnDMVVcKYyUCBKmn/s320/screenshot.jpg)
On a different note, I also refined the island terrain trimmer (the
HeightMapIslandTrim
class) produced more pleasing terrains. I added two options: the one is a shape and the other is a trim method. The shape is either a circle or a square.The trim method is more interesting: it has two options: a fill option and a merge option. The fill option is the one described in the previous post. It simply fills in ground until the beach is perfect according to specification. The problem with this is that it creates an unnatural edge for the beach; except if that's what you were going for, you may not like it.
The merge option is much smarter. It takes the beach line (this is where the water hits the sand) and applies the fill method there. As it moves away from this line, the original form of the heightmap is gradually adopted with more vigor. Again this uses our old friend the lerp function.
The image shown here is a terrain built from a mirror of Riemer's original heightmap with the island modifier applied to it. Notice how the merge option created puddles on the beach.
No comments:
Post a Comment