How to eliminate the terrain staircase effect

Started by
5 comments, last by nullstate 20 years ago
Hey All, I’ve implemented a CLOD terrain engine using geomipmapping. Everything is fine except for one problem. When I render a very hilly/mountainous scene, the terrain looks like a set of staircases on the slopes and not very natural. Especially when I’m at the highest level of detail (maximum number of vertices). However, with a less hilly/mountainous scene, there are no problems. Thank you in advance.
Advertisement
You''re going to have to implement some kind of erosion function. This function should take your height map as an input parameter and do something like:

for( int x = 0; x < Size; ++x )
{
for( int z = 0; z < Size; ++z )
{
// The y value at (x,z) in the new height map
// equals the average of the y values of the same
// point in the old height map and the surrounding
// points.
}
}

How you define the surrounding values is up to you. I usually use a radius of one, that is (x,z) + (x+1, z) + (x, z+1).... and so on.
After that you can render your terrain from the new height map or set the old height map equal to the new height map. You will have to check to make sure that you arguments don''t read off the height map. Like if you x = 0, and you said x - 1.
tolleyc> that won''t work well if the slope is really smooth, you will just smooth the stairs, not throw away the stair effect. it will still be visible. I tryed with catmull-rom, it''s much better, but still noticeable depending on the heightmap.

nullstate> I guess you''re using a standard 8 bit grayscale heightmap? the stair effect becomes noticeable because you''ve only got 255 heights between your terrain lowest possible point, and the heighest one. you need to use a 16 bpp heightmap, or load digital elevation model files, or load terragen files (really easy to load).
Hey All,

Thank you for the quick responses. Currently I am already filtering the heightmap. However, I''ll give sBibi''s suggestion a try and increase the heightmap to 16bpp. I''ll let you know how it worked out once I implement it. Again, thank you guys for your suggestions and help!

NS
Are you sure the res of the heightmap is high enough? If you get stepping that suggest that there are more than 1 vertex per pixel, and that doesn''t sound too good.. Don''t take my word for it thogh.. the only experience I have with terrain rendering is a roam demo/sourcecode that I downloaded and took a quick look at.. I''m still a noob
It might be worth to check out though.
perhaps it is because you have a greater LOD than your heightmap can work with. if you have a heightmap with the size 256x256 and you have more than 8 LOD''s, there is no more detail. so a solution would be to simply interpolate the height between to pixels on the heightmap. you can do this linearly or using the cos. the best solution would be bezier patches or something like that to visualize resolutions greater than your heightmap has.
The problem of Object Oriented Programming:Everybody tells you how to use his classes, but nobody how not to do it !
This is typical to the low 8 bits precision of your heightmap. Switching to 16 bits should fix it.

Y.

This topic is closed to new replies.

Advertisement