U V和S T纹理坐标的差值。

时间:2022-09-04 15:16:43

What's the difference between a U V texture coordinate vs. S T texture Coordinate?

U V纹理坐标和S T纹理坐标之间有什么区别?

I know that U V and S T are used in OpenGL.

我知道在OpenGL中使用的是U V和S T。

I also know that S T are also used in Java.

我还知道Java中也使用了S T。

4 个解决方案

#1


18  

They mean the same thing, it's just a different naming convention.

它们的意思是一样的,只是一个不同的命名约定。

U = S = x dimension
V = T = y dimension

#2


20  

Computer graphics principles and practice (Foley et al) defines the 2 as follows:

计算机图形学原理和实践(Foley等)将2定义为:

Texture mapping can be accomplished in two steps. A simple approach starts by mapping the four corners of the pixel onto the surface. For a bicubic patch this mapping naturally defines a set of points in the surface's (s,t) coordinate space. Next, the pixel's corner points in the surface's (s,t) coordinate space are mapped into the texture's (u,v) coordinate space The four (u,v) points in the texture map define a quadrilateral that approximates the more complex shape into which the pixel may actually map due to surface curvature. We compute a value for the pixel by summing all texels that lie within the quadrilateral, weighting each by the fraction of the texel that lies within the quadrilateral. If a transformed point in (u,v) space falls outside of the texture map, the texture map may e though of as replicated, like the patterns of Section 2.1.3 Rather than always use the identity mapping between (s,t) and (u,v), we can define a correspondence between the four corners of the 0-to-1 (s,t) rectangle and a quadrilateral in (u,v). When the surface is a polygon, it is common to assign texture map coordinates directly to its vertices.

纹理映射可以分为两个步骤。一种简单的方法是将像素的四个角映射到表面。对于一个双三次贴片,这个映射自然地定义了表面(s,t)坐标空间中的一组点。接下来,像素的角点在表面的(s,t)坐标空间被映射到纹理的(u,v)坐标空间中,纹理映射中的四个(u,v)点定义了一个四边形,这个四边形近似于一个更复杂的形状,由于表面曲率,像素实际上可能映射到它。我们通过对所有位于四边形内的纹理相加来计算一个像素的值,每一个像素都是在四边形内的。如果一个转变点(u,v)空间之外的纹理映射,纹理映射可能e虽然是复制,如2.1.3节的模式而不是总是使用身份之间的映射(s,t)和(u,v),我们可以定义一个对应的四个角落0到1之间(s,t)矩形和四边形(u,v)。当曲面是一个多边形时,通常将纹理映射坐标直接分配给它的顶点。

#3


4  

uv coordinates start from the upper left corner (v-axis is facing down).
st coordinates start from the lower left corner (t-axis is facing up).

uv坐标从左上角开始(v轴向下)。st坐标从左下角开始(t轴朝上)。

s = u;
t = 1-v;

I forgot to tell that textures in opengl should be loaded vertically flipped because the first element of the row data "corresponds to the lower left corner of the texture image" (see glTexImage2D). Only in that case, st and uv coordinates seems to be the same thing.

我忘了说opengl的纹理应该是垂直翻转的,因为行数据的第一个元素“对应纹理图像的左下角”(参见glTexImage2D)。只有在这种情况下,st和uv坐标看起来是一样的。

#4


1  

It's a matter of convention.

这是惯例问题。

Autodesk 3D Studio, Alias Maya, NewTek Lightwave and probably others used letters U and V for horizontal and vertical texture coordinates, respectively. DirectX follows the same convention.

Autodesk 3D Studio, Alias Maya, NewTek Lightwave,可能还有其他一些用字母U和V分别表示水平和垂直纹理坐标。DirectX遵循相同的约定。

Pixar's RenderMan however reserved the letters U and V for parameters in their parametric 3D primitives. So for texturing, they used S and T instead. OpenGL also used this convention for texture coordinates.

然而,皮克斯的RenderMan却保留了字母U和V作为参数的3D原语的参数。所以对于变形,他们用S和T代替。OpenGL还使用了这个约定用于纹理坐标。

So their meaning may be different in theory but, unless you work on some Hollywood movie special effects, they probably both mean texture coordinates.

所以他们的意思可能在理论上是不同的,但是,除非你在好莱坞电影特效上工作,他们可能都是指材质坐标。

#1


18  

They mean the same thing, it's just a different naming convention.

它们的意思是一样的,只是一个不同的命名约定。

U = S = x dimension
V = T = y dimension

#2


20  

Computer graphics principles and practice (Foley et al) defines the 2 as follows:

计算机图形学原理和实践(Foley等)将2定义为:

Texture mapping can be accomplished in two steps. A simple approach starts by mapping the four corners of the pixel onto the surface. For a bicubic patch this mapping naturally defines a set of points in the surface's (s,t) coordinate space. Next, the pixel's corner points in the surface's (s,t) coordinate space are mapped into the texture's (u,v) coordinate space The four (u,v) points in the texture map define a quadrilateral that approximates the more complex shape into which the pixel may actually map due to surface curvature. We compute a value for the pixel by summing all texels that lie within the quadrilateral, weighting each by the fraction of the texel that lies within the quadrilateral. If a transformed point in (u,v) space falls outside of the texture map, the texture map may e though of as replicated, like the patterns of Section 2.1.3 Rather than always use the identity mapping between (s,t) and (u,v), we can define a correspondence between the four corners of the 0-to-1 (s,t) rectangle and a quadrilateral in (u,v). When the surface is a polygon, it is common to assign texture map coordinates directly to its vertices.

纹理映射可以分为两个步骤。一种简单的方法是将像素的四个角映射到表面。对于一个双三次贴片,这个映射自然地定义了表面(s,t)坐标空间中的一组点。接下来,像素的角点在表面的(s,t)坐标空间被映射到纹理的(u,v)坐标空间中,纹理映射中的四个(u,v)点定义了一个四边形,这个四边形近似于一个更复杂的形状,由于表面曲率,像素实际上可能映射到它。我们通过对所有位于四边形内的纹理相加来计算一个像素的值,每一个像素都是在四边形内的。如果一个转变点(u,v)空间之外的纹理映射,纹理映射可能e虽然是复制,如2.1.3节的模式而不是总是使用身份之间的映射(s,t)和(u,v),我们可以定义一个对应的四个角落0到1之间(s,t)矩形和四边形(u,v)。当曲面是一个多边形时,通常将纹理映射坐标直接分配给它的顶点。

#3


4  

uv coordinates start from the upper left corner (v-axis is facing down).
st coordinates start from the lower left corner (t-axis is facing up).

uv坐标从左上角开始(v轴向下)。st坐标从左下角开始(t轴朝上)。

s = u;
t = 1-v;

I forgot to tell that textures in opengl should be loaded vertically flipped because the first element of the row data "corresponds to the lower left corner of the texture image" (see glTexImage2D). Only in that case, st and uv coordinates seems to be the same thing.

我忘了说opengl的纹理应该是垂直翻转的,因为行数据的第一个元素“对应纹理图像的左下角”(参见glTexImage2D)。只有在这种情况下,st和uv坐标看起来是一样的。

#4


1  

It's a matter of convention.

这是惯例问题。

Autodesk 3D Studio, Alias Maya, NewTek Lightwave and probably others used letters U and V for horizontal and vertical texture coordinates, respectively. DirectX follows the same convention.

Autodesk 3D Studio, Alias Maya, NewTek Lightwave,可能还有其他一些用字母U和V分别表示水平和垂直纹理坐标。DirectX遵循相同的约定。

Pixar's RenderMan however reserved the letters U and V for parameters in their parametric 3D primitives. So for texturing, they used S and T instead. OpenGL also used this convention for texture coordinates.

然而,皮克斯的RenderMan却保留了字母U和V作为参数的3D原语的参数。所以对于变形,他们用S和T代替。OpenGL还使用了这个约定用于纹理坐标。

So their meaning may be different in theory but, unless you work on some Hollywood movie special effects, they probably both mean texture coordinates.

所以他们的意思可能在理论上是不同的,但是,除非你在好莱坞电影特效上工作,他们可能都是指材质坐标。