球面上的纹理错误 [英] Texturing error on a Sphere

查看:239
本文介绍了球面上的纹理错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个球面上的点,我需要可视化的球面经度/纬度坐标。为了这个目的,我改变了指向笛卡尔坐标和内置三角形,我可以VTK渲染的一个网格。到目前为止作品。

I have a number of spherical longitude/latitude coordinates for points on a sphere that I need to visualize. For that purpose, I transformed the points to cartesian coordinates and built a mesh of triangles that I can render with VTK. Works so far.

现在我想使用一个纹理球形模型。因此,我改变了球面坐标的纹理坐标和分配这些到每个点。这适用于大多数球体表面的三角形和结果看起来可以接受的。

Now I want to use a texture for the sphere model. Therefore I transformed the spherical coordinates to texture coordinates and assigned these to each point. This works for the majority of the sphere's surface triangles and the result looks acceptable.

但是,对于上本初子午线,这里的纹理包裹物,所述三角形纹理不正确的相对侧上的三角形:代替重复纹理和映射过纹理边界的,整个纹理被挤压到所述单三角形。

But, for the triangles on the opposite side of the prime meridian, where the texture wraps, the triangles are textured incorrectly: Instead of repeating the texture and mapping "over the texture boundary", the whole texture gets squeezed onto the single triangle.

下面是它的样子的照片:

Here is a picture of how it looks like:

在济科 - 扎克行显然是错误的,蓝线应该是可见的,而不是。整个纹理被映射在三角形,产生红色和白色条纹。这是有意义的,因为有问题的三角形,纹理坐标跨越整个纹理空间

The zick-zack line is obviously wrong, the blue line should be visible instead. The whole texture is mapped on the triangles, resulting in red and white stripes. This makes sense since, for the triangles in question, the texture coordinates span the whole texture space.

要说明这个问题,这是不特定领域,但所有封闭的对象,我创建了如下图所示:

To illustrate this problem, which is not specific to spheres but all closed objects, I have created the following figure:

在上面的矩形,我们看到了一个三角形跨越纹理边界与计算纹理坐标A,B和C由于纹理可以平铺,这是我想如何呈现的三角形。

In the upper rectangle, we see a triangle that spans over the texture boundaries with computed texture coordinates A, B and C. Since the texture can be tiled, this is how I would like the triangle to be rendered.

下面的三角标志显示了纹理坐标如何目前PTED除$ P $。边缘的A,B和C是相同的,但这次的坐标,多数纹理的使用而不是平铺纹理在边界为三角形,

The lower triangle shows how the texture coordinates are interpreted currently. The coordinates of the edges A, B and C are the same, but this time, the majority of the texture is used for the triangle, instead of tiling the texture at the borders.

我相信有相当我犯了一个常识性错误,但我没有发现任何帮助我呢。有任何暗示我吗?

I am sure there is quite a common mistake I made but I didn't find anything to help me yet. Have any hints for me?

推荐答案

答案其实很简单,你需要映射你的纹理坐标在边缘。实现取决于你的数据集,但这里是一个刺这个问题。

The answer is very simple you need to map your texture coordinates over the edge. The implementation depends on your data set but here is a stab at the problem.

在纹理坐标存储在面部,而不是顶点,并且问题显示原因计算机图形。当你周围的地图球体的纹理,让我们说,在10个步骤,你有0.0开始,然后继续增量为0.1。如果你沿着本初子午线去与纹理坐标你脸上的纹理坐标0.9和0.0。图形硬件做它是什么,并告诉插0.0和0.9之间的质感。

In computer graphics texture coordinates are stored on the faces and not on the vertices and your problem shows the reason. When you map a texture around a sphere, let us say in 10 steps you start with 0.0 then continue in 0.1 increments. If you go with texture coordinates along the prime meridian you get faces with the texture coordinate 0.9 and 0.0. The graphic hardware does what it is told and interpolates the texture between 0.0 and 0.9.

要解决你的问题,你需要的纹理贴图,从0.9到1.0。

To solve your problem you need to map the texture from 0.9 to 1.0.

如果你可以,创建多边形这样或重复违规的顶点与其他纹理坐标。

If you can, create the polygons that way or duplicate the offending vertices with other texture coordinates.

这篇关于球面上的纹理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆