高度图有什么意义?
我现在一直在思考这个问题...许多 3D 引擎支持使用四叉树、LOD 进行高级地形渲染...您期望的所有功能。但我见过的每个引擎都会从高度图...灰度位图加载高度数据。我只是不明白这有什么用——高度图中的每个点都可以有 256 个值之一。但是如果您想模拟珠穆朗玛峰怎么办?细节达到 1 米,甚至更大?这远远超出了 256 的范围。当然,我知道您可以实现自己的地形格式来实现此目的,但我只是不明白为什么高度图尽管有很大的局限性,但仍得到如此广泛的使用。
I've been pondering this question awhile now... many 3d engines support advanced terrain rendering using quadtrees, LOD... all the features you expect. But every engine I've seen loads height data from heightmaps... grayscale bitmaps. I just can't understand how this is useful - each point in a heightmap can have one of 256 values. But what if you wanted to model Mt. Everest? with detail of 1 meter, or even greater? That's far outside the range of 256. Of course I understand that you can implement your own terrain format to achieve this, but I just can't see why heightmaps are so widely used despite their great limitations.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
高度图的优点是具有直接的硬件支持(纹理),并且可以使用现有的绘画工具(甚至是专用的)进行绘制。
当然,根据高度图中存储的信息的格式,某些渲染看起来并不像应该的那样,但因为高度图实际上是在错误的情况下使用的。
作为增强功能,高度图像素可以存储在 16 位浮点数(半浮点数)或 32 位浮点数中,从而允许具有固定精度的 8 位像素具有更高的范围和精度。
Heightmaps have the advantage that has direct hardware support (texturing), and it can be draw using existing painting tools (even specialized).
Of course, depending on the format of the information stored in the heightmap, some rendering doesn't looks like it should be, but because heightmaps are actually used in the wrong situation.
As enhancement, heightmap pixels could be stored in a 16 bit floating number (half float) or a 32 bit float, allowing to have higher ranges and precision allowed with an 8 bit pixel with fixed precision.
高度图的另一个优点是,一般来说,它避免了悬垂问题,这使得物理和运动方面变得更加困难。但即使使用高度图,您也可以使用其他可能产生悬垂的几何图形。
此外,只要高度变化不会太大而导致拉伸,纹理就可以更简单。
Another plus with heightmaps is that in general it avoids the overhang issue which makes aspects of physics and movement harder. But even with a hightmap, you can have other geometry that could create overhangs.
Also, texturing can be simpler as long as the height doesn't vary too much causing stretching.
你会用别的东西。显然,如果您遇到的每个引擎都使用高度图,那么它就适合它们。如果简单的解决方案适合您,则无需使事情过于复杂。
You'd use something else. Clearly, if every engine you've encountered uses heightmaps, it works just fine for them. No need to overcomplicate things if the simple solution works for you.
高度图优点:
高度图缺点:
Heightmap Pros:
Heightmap Cons:
从显示图形的角度来看,通常重要的最大精度(简单来说)是最终显示中的单个像素1。考虑到典型当前显示器的分辨率,为高度图再设置几个或三个位会很好,但对于大多数几何体来说,这并不是真正必要的。特别是,尽管单个像素几乎定义了您经常使用的最大精度,但绘制珠穆朗玛峰使其高度实际上误差两三个像素对于大多数人来说并不是什么大问题。时间。
归根结底:您想要使用一米的精度来绘制珠穆朗玛峰的高度图的想法根本就是一个错误 - 需要(甚至使用)这种精度水平是正确的稀有与不存在之间的界限。同时,使用相对密集的格式(例如每个像素一个字节)通常意味着相当多的存储空间和带宽,从而实现更快的显示。
From a viewpoint of displaying graphics, the greatest precision that normally matters is (in simple terms) a single pixel in the final display1. Given the resolution of a typical current monitor, having another couple or three bits for the height map would be nice -- but for most geometry, it's not really necessary. In particular, even though a single pixel pretty much defines the greatest precision for which you have a lot of use, drawing Mt. Everest so its height is actually wrong by two or three pixels isn't really a major problem for most people most of the time.
It comes down to this: the idea that you'd want to use a precision of one meter for a height map of Mt. Everest is simply a mistake -- a need (or even use) for that level of precision is right on the border between rare and nonexistent. At the same time, using a relatively dense format like one byte per pixel generally means quite a bit -- less storage and less bandwidth leading to faster displays.
高度图非常轻量,加载速度非常快,并且可以相当容易地按程序生成。它们还使用相当小的内存占用。
它们被广泛使用,因为它们简单、快速,并且可以很好地处理许多场景。话虽如此,它们并不适用于所有场景,也不是完全通用的地形格式。
Heightmaps are very lightweight, very fast to load, and can be generated procedurally fairly easily. They also use quite a small footprint for memory.
They're used a lot because they're easy and fast, and handle many scenarios well. That being said, they're not useful for every scenario, and not a fully generalized terrain format.