推荐球体映射的2D一些Bresenham's样的算法?球体、算法、Bresenham

2023-09-11 02:35:49 作者:孤独成瘾

我需要最快的领域映射算法。类似布氏白描之一。 喜欢的东西,我在星控制2(旋转的行星)看到了实现。 有没有已经发明和/或实施技术呢?

I need the fastest sphere mapping algorithm. Something like Bresenham's line drawing one. Something like the implementation that I saw in Star Control 2 (rotating planets). Are there any already invented and/or implemented techniques for this?

我真的不想重塑自行车。请帮助...

I really don't want to reinvent the bicycle. Please, help...

说明了这个问题。 我有二维表面,球体已经出现在一个地方。球体(让它成为一个地球)具有与细地图被纹理和必须具有一个扩展能力和自由旋转。我想与地图或坐标一些简单的变换函数来实现:球体的二维图像上的每个像素被定义为一个数从球体的圆柱形地图像素。这给了我实现所产生的图像的抗锯齿的能力。还我考虑使用的mipmap来实现,如果在所得的图像的一个像素对应于一个以上的象素的原始地图上(例如,接近球体的极)测绘的。深深里面我觉得这可以用一些琐碎的数学运算来实现。但是,所有这些想法都只是我的想法。

Description of the problem. I have a place on the 2D surface where the sphere has to appear. Sphere (let it be an Earth) has to be textured with fine map and has to have an ability to scale and rotate freely. I want to implement it with a map or some simple transformation function of coordinates: each pixel on the 2D image of the sphere is defined as a number of pixels from the cylindrical map of the sphere. This gives me an ability to implement the antialiasing of the resulting image. Also I think about using mipmaps to implement mapping if one pixel on resulting picture is corresponding to more than one pixel on the original map (for example, close to poles of the sphere). Deeply inside I feel that this can be implemented with some trivial math. But all these thoughts are just my thoughts.

这问题有点与此相关的一种:没有强大的失真​​,但没有回答我的问题可用。

This question is a little bit related to this one: Textured spheres without strong distortion, but there were no answers available on my question.

UPD:我想,我没有硬件支持。我想有一个跨平台的解决方案。

UPD: I suppose that I have no hardware support. I want to have an cross-platform solution.

推荐答案

你看看吉姆·博林的文章的如何画一个球体?我没有访问完整的文章,但它看起来像你所需要的。

Did you take a look at Jim Blinn's articles "How to draw a sphere" ? I do not have access to the full articles, but it looks like what you need.