texel是什么?texel概念和自己理解的texel

来源:互联网 发布:淘宝刻假章警察会查吗 编辑:程序博客网 时间:2024/06/05 10:02

以前在学opengl的时候就对texel一知半解,以为是另一种像素,后来在实际项目中开始觉得这个概念越发重要

texel(纹理元素 可以称为纹素)不仅会在学图像学时被莫名其妙偶尔来一句,还会在引擎优化或者离线渲染的时候提到这个东西


先简要说说像素和纹素区别

像素是排列在屏幕上的点阵,是图片基本单元,是屏幕空间的基本单元,大部分情况下是方的,而纹素是纹理图片空间的基本单元,可以看成是纹理的组成“像素”,这里让它区别于像素,主要是为了强调它的应用方式。而且像素一般是平面的(当然有体素这个),纹素则因为纹理可以是多维(一般1~3维),所以纹素是也可以是多维的
当3d纹理物体最终绘制到屏幕上的时候,纹素会被转换成屏幕的像素最终呈现出来。而纹素与纹素之间会以texture filtering里的规则进行填充,

所以纹素也并不是指代一个点,它具体代表什么还要分情况

在屏幕上可以说它指代的是屏幕上一块区域(不一定是方的),最终呈现的是其转换成的像素来显示的

在三维物体上,它是贴图纹理的最小单元,可以是原文纹理里的多个像素,也可以小于一个像素

在物体uv空间,它会呈现和像素一样方式的排列,不过它的不以像素为单位,而是用uv位置表示


如果上面比较抽象又比较绕的话,具体可以参考下面两幅图

图片摘自 参考地址http://www.adobe.com/devnet/flashplayer/articles/mipmapping.html


图片摘自http://dmtamakuwala.blogspot.fr/2013/07/pixel-vs-texel.html


下面是wiki上关于Texel更具体的解释

因为担心自己解释有误所以附上原文对照

texel(纹理元素的简写)是纹理图形的基本单位,用于定义三维对象的曲面。3D 对象曲面的基本单位是纹理,而 2D 对象由像素组成。


在计算机图形学当中,纹素(纹理元素)代表了映射到三维表面的二维纹理的最小单元,纹素和像素(图像元素)很相似因为都代表了图像的基础单元,但是在贴图中的纹素和图片中的像素在显示的时候是有区别的,在特殊的3D映射情况下,纹素和像素可以一一对应,但大多数情况下,他们并不能直接映射。
包含3D纹理的对象靠近观看者时纹素看起来相对较大,每个纹素可能存在好几个像素,并且容易看出纹理样式。当相同的纹理对象被移到更远的距离时,纹理映射图案看起来越来越小。最终,每个纹素可以变得小于像素。然后平均采用会被用来组合几个纹素成为一个像素。如果对象足够远,或者其中一个小面与观看视线夹角形成锐角,那么纹素可能变得如此之小,使得图案的本质在观察图像中丢失。

In computer graphics, a texel (texture element) represents the smallest graphical element in two-dimensional (2-D) texture mapping to "wallpaper" the rendition of a three-dimensional ( 3-D ) object to create the impression of a textured surface. A texel is similar to a pixel (picture element) because it represents an elementary unit in a graphic. But there are differences between the texels in a texture map and the pixels in an image display. In special instances, there might be a one-to-one correspondence between texels and pixels in some parts of the rendition of a 3-D object. But for most, if not all, of a 3-D rendition, the texels and pixels cannot be paired off in such a simple way.

When a 3-D texture-mapped object appears close to the viewer so that the texture elements appear relatively large, there may be several pixels in each texel and the pattern of the texture map is easy to see. When the same 3-D object is removed to increasing distances, the texture-map pattern appears smaller and smaller. Eventually, each texel can become smaller than a pixel. Then an averaging process must be used; several texels are combined to form each pixel. If the object becomes distant enough, or if one of its facets appears at a sharp angle with respect to the viewer, the texels may become so small that the essence of the pattern is lost in the observed image.



当纹理化3D表面或其他表面(称为纹理映射过程)时,渲染器将会把纹理映射成适合输出图片大小的像素。现在,该操作一般在显卡上完成。

纹理映射从空间中开始,纹理位置可以在世界空间,但实际应用中它一般在模型空间中,以便纹理随模型移动。投影函数将三维向量映射为具有从零到一(uv)值的二维向量。这些值乘以纹理的分辨率可以获得纹素的位置。如果纹素不在整数位置上,纹理过滤(texture filtering)会被启用。

When texturing a 3D surface or surfaces (a process known as texture mapping), the renderer maps texels to appropriate pixels in the output picture. On modern computers, this operation is accomplished on the graphics processing unit.

The texturing process starts with a location in space. The location can be in world space, but typically it is in Model space so that the texture moves with the model. A projector function is applied to the location to change the location from a three-element vector to a two-element vector with values ranging from zero to one (uv). These values are multiplied by the resolution of the texture to obtain the location of the texel. When a texel is requested that is not on an integer position, texture filtering is applied.


当然这些概念不光是引擎上有,渲染器也有的

比如纹素密度这个概念就会在渲染等等优化上面有所体现,比如统一距离物体的纹素密度统一在合适的大小就能提高质量,减少渲染时间

引擎优化和渲染场景优化都是这个道理

包括unity或ue4的光照烘焙和纹理精度等等


其他参考网址

http://slideplayer.com/slide/7050222/

http://www.glprogramming.com/red/chapter09.html

http://www.gamasutra.com/view/feature/1812/creating_a_postprocessing_.php?print=1

https://msdn.microsoft.com/en-us/library/windows/desktop/cc308049(v=vs.85).aspx

0 0
原创粉丝点击