Skybox 与 Skysphere

发布于 2024-09-27 05:31:55 字数 37 浏览 2 评论 0原文

两者之间有哪些优点和缺点。特别是对于 3D 游戏之类的东西。

What are some advantages and disadvantages between the two. Especially for something like a 3D game.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

写给空气的情书 2024-10-04 05:31:55

天空盒和天空球在某种意义上几乎是等效的,您将获得相同的视觉效果 - 即看起来距离很远的漂亮背景。

不过,我通常会出于以下三个原因推荐天空盒:

  • 所需的多边形较少
  • 假设您正确设置了投影矩阵,您就无法判断自己在一个盒子内(如果您弄错了,您可能会看到一些扭曲)
  • 渲染方形天空盒图像更容易(每个尺寸方向一个)

关于最后一点,通过创建 90 度视场,配置渲染器来生成完全适合天空盒的光线追踪方形图像非常容易,例如在 POVRay 中,您将使用如下所示的内容:

camera {
   right -x
   up y
   direction -z
   location 0
}

我通常使用 1024*1024 或 2048*2048 方形纹理。

我能想到使用天空球的一个很好的理由是,如果您使用某种程序纹理方法,需要在(大约)单位球体上的点处生成。然而,我认为这是一个非常特殊的情况,对于大多数游戏应用程序来说不太可能是必需的。

Skyboxes and skyspheres are pretty much equivalent in the sense that you will get the same kind of visual effect - i.e. a nice background that appears to be at a long distance away.

However I'd normally recommend a skybox for the following three reasons:

  • Less polygons required
  • Assuming you set up your projection matrices correctly, you can't tell that you are inside a box (if you get it wrong, you may see some distortions)
  • It's easier to render square skybox images (one for each of the size directions)

Regarding the last point, it is pretty easy to configure a renderer to produce raytraced square images that exactly fit on a skybox by creating a 90 degree field of view, e.g. in POVRay you would use something like the following:

camera {
   right -x
   up y
   direction -z
   location 0
}

I typically use 1024*1024 or 2048*2048 square textures for this.

The one good reason I can think of to use a skysphere is if you are using some kind of procedural texture approach that requires generation at (approximately) the points on a unit sphere. I think that is a pretty special case however, and unlikely to be necessary for most gaming applications.

_失温 2024-10-04 05:31:55

为天空盒制作纹理更容易。多边形数量也会减少(但这对于今天的卡片来说可以忽略不计)。

天空盒的唯一问题是立方体的边缘在某些条件下可能是可见的。

另一个与众不同的方面是:

  • 天空盒永远不会与几何体碰撞 - 图像仅从与用户相机一起旋转的另一个相机投影,并且
  • 在天空球的情况下“卡在盒子里”,背景将直接渲染(玩家可以“撞到天空”)

这里有一个很好的描述和 OpenGL 示例。

It is easier to make textures for skybox. Also polygon count will be smaller (but this is negligible with today cards).

The only problem with skybox is that the edges of the cube may be visible under certain conditions.

Another aspect that makes a difference:

  • skybox will never collide with the geometry - the image is only projected from another camera that rotates together with the user camera and is "stuck in the box"
  • in case of skysphere, the background will render directly (player can "bump into the sky")

A good description and OpenGL sample is here.

萌无敌 2024-10-04 05:31:55

天空球也非常酷,因为您可以使用任何墨卡托投影图来对其进行纹理处理,并且它根本没有失真。

a skysphere is also very cool cause you can use any mercator projection map to texture it, and it have no distortion at all.

夏见 2024-10-04 05:31:55

天空盒的另一个优点是能够使用立方体贴图 - 另一方面,球体贴图不是硬件加速的(据我所知)。

Another advantage of skyboxes is being able to use a cubemaps for them - sphere mapping on the other hand is not hardware accelerated (afaik).

始终不够 2024-10-04 05:31:55

当您使用天空盒时,您很可能会使用盒纹理。该纹理也可用于反光材料。 Skyphere 纹理在这里使用起来并不容易。

when you are using a skybox, you most likely will use a box texture. This texture can also be used for reflective materials. Skyphere textures are not that easy to use here.

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