Hacker News new | ask | show | jobs
by lalc 4842 days ago
This looks great and that is a huge amount of effort. I have to ask about what I think is the elephant in the room: Surely you must have noticed that all your mountains are chopped off at the exact same altitude? Wouldn't the scene look way better if you just increased the maximum, with basically no effort?

It's as though you spent a month painstakingly mixing 64 channels of crystal clear audio, but, right at the end, threw your hands up and clipped the final mix into oblivion.

2 comments

Very good question! Actually, I can't increase the maximum without going to two bytes per elevation. All of the (top) plateaus are at a height equivalent to 255.

Q: OK, why not put them a bit lower than that, with some variety between peaks?

A: I already have. If you take a closer look, you will notice that there is another layer of flat surfaces, lower than the top.

Q: I'm not convinced. Why only two layers of 'flatness', one at the top, another a bit lower?

A: In the end, it's all about the dynamic range that you have to work with. When using a single byte, there are only 255 distinct height values. The key point is to understand that these values must not differ by much (i.e. they cannot be scaled by large values), since this will affect the appearance of the rest of the terrain (think very, very sharp, unnatural triangles everywhere). On the other hand, the scale factor must be large enough to allow for distinct terrain 'features', avoiding the appearance of a deflated terrain. Two layers of flatness, safely away from each other, was the best compromise.

Q: I'm still not convinced. Just vary the top layer by a small amount between peaks.

A: Using a small value wouldn't make much of a difference. If the amount was large enough, the distinction between the two 'flatness' layers would be lost and the terrain would lose that specific character that it currently has.

Going to two bytes per elevation (and thus be able to use a small scale factor) would allow me to keep the style intact (of some specific geological procedure that has formed the terrain), while varying the peaks and keep the rest of the terrain smooth.

I hope this made some sense. However you're right, it is noticeable! I just didn't think it detracts that much from the overall feel, while it still has advantages, so I went with it.

Could you add a cheap procedural function in the rendering pipeline to get more depth variety (past the 255 limit)? You might avoid adding the byte that way, though I'd guess it depends on how much of the pipeline is locked into that limit.
I felt the resulting plateaus were nice, though I'll admit it's a tad distracting that they're all the same height.