高度图有什么意义?

发布于 2024-09-05 14:02:21 字数 232 浏览 7 评论 0原文

我现在一直在思考这个问题...许多 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

调妓 2024-09-12 14:02:35

高度图的优点是具有直接的硬件支持(纹理),并且可以使用现有的绘画工具(甚至是专用的)进行绘制。

当然,根据高度图中存储的信息的格式,某些渲染看起来并不像应该的那样,但因为高度图实际上是在错误的情况下使用的。

作为增强功能,高度图像素可以存储在 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.

书信已泛黄 2024-09-12 14:02:34

高度图的另一个优点是,一般来说,它避免了悬垂问题,这使得物理和运动方面变得更加困难。但即使使用高度图,您也可以使用其他可能产生悬垂的几何图形。

此外,只要高度变化不会太大而导致拉伸,纹理就可以更简单。

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.

菩提树下叶撕阳。 2024-09-12 14:02:32

但是如果您想为珠穆朗玛峰建模怎么办?

你会用别的东西。显然,如果您遇到的每个引擎都使用高度图,那么它就适合它们。如果简单的解决方案适合您,则无需使事情过于复杂。

But what if you wanted to model Mt. Everest?

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.

池予 2024-09-12 14:02:30

高度图优点:

  1. 从远处看就像真实的地形。
  2. 假设 z 向上,很容易计算任意 x、y 处的高度。这对于移动玩家、碰撞检测和物理非常有用。
  3. 易于在绘画程序中编辑。

高度图缺点:

  1. 当存在大的平坦区域(恒定高度)时,内存使用效率低下。
  2. 当存在大的平坦区域时,渲染硬件的使用效率低下。
  3. 无法代表陡峭或悬垂的地形。
  4. 只能表示正方形区域。

Heightmap Pros:

  1. Look like real terrain from a distance.
  2. Very easy to compute height at any x, y assuming z is up. This is useful for moving players, collision detection, and physics.
  3. Easy to edit in a paint program.

Heightmap Cons:

  1. Use memory inefficiently when there are large flat areas (constant height).
  2. Use rendering hardware inefficiently when there are large flat areas.
  3. Can't represent steep or overhanging terrains.
  4. Can only represent square areas.
⒈起吃苦の倖褔 2024-09-12 14:02:28

从显示图形的角度来看,通常重要的最大精度(简单来说)是最终显示中的单个像素1。考虑到典型当前显示器的分辨率,为高度图再设置几个或​​三个位会很好,但对于大多数几何体来说,这并不是真正必要的。特别是,尽管单个像素几乎定义了您经常使用的最大精度,但绘制珠穆朗玛峰使其高度实际上误差两三个像素对于大多数人来说并不是什么大问题。时间。

归根结底:您想要使用一米的精度来绘制珠穆朗玛峰的高度图的想法根本就是一个错误 - 需要(甚至使用)这种精度水平是正确的稀有与不存在之间的界限。同时,使用相对密集的格式(例如每个像素一个字节)通常意味着相当多的存储空间和带宽,从而实现更快的显示。

  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.

  1. Technically with anti-aliasing, sub-pixel resolution can and does mean something -- but while it matters a lot for things like smoothing lines that would otherwise look quite jagged, for something like getting the height of a mountain correct, it doesn't mean nearly so much. In fact, as far as most people care most of the time, it's completely meaningless.
一人独醉 2024-09-12 14:02:26

高度图非常轻量,加载速度非常快,并且可以相当容易地按程序生成。它们还使用相当小的内存占用。

它们被广泛使用,因为它们简单、快速,并且可以很好地处理许多场景。话虽如此,它们并不适用于所有场景,也不是完全通用的地形格式。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文