线性/非线性纹理映射扭曲的四边形 [英] Linear/Nonlinear Texture Mapping a Distorted Quad

查看:100
本文介绍了线性/非线性纹理映射扭曲的四边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的上一个问题中,可以确定当对四边形进行纹理处理时,面部分解成三角形,并以仿射的方式插值纹理坐标.

In my previous question, it was established that, when texturing a quad, the face is broken down into triangles and the texture coordinates interpolated in an affine manner.

不幸的是,我不知道该如何解决. 提供的链接很有用,但效果不理想.作者得出结论:请注意,图像看起来好像是一个长的矩形四边形,一直延伸到远处……由于它产生的错误的深度感知",它可能会变得相当混乱……".

Unfortunately, I do not know how to fix that. The provided link was useful, but it doesn't give the desired effect. The author concludes: "Note that the image looks as if it's a long rectangular quad extending into the distance. . . . It can become quite confusing . . . because of the "false depth perception" that this produces."

我想做的是使纹理保留纹理的原始缩放比例.例如,在梯形的情况下,我希望纹理像素的垂直间距是相同的(使用paint程序创建的示例):

请注意,由于垂直间距相同,但四边形具有明显的变形,因此纹理空间中的直线不再是世界空间中的直线.因此,我认为所需的映射是非线性的.

What I would like to do is to have the texturing preserve the original scaling of the texture. For example, in the trapezoidal case, I want the vertical spacing of the texels to be the same (example created with paint program):

Notice that, by virtue of the vertical spacing being identical, yet the quad's obvious distortion, straight lines in texture space are no longer straight lines in world space. Thus, I believe the required mapping to be nonlinear.

问题是:在固定功能管道中这是否有可能?我什至不确定确切的答案对于更通用的四边形是什么.我认为插值函数很快就会变得非常复杂,并且我意识到保留原始比例"并不是一种精确的算法.世界空间三角形在纹理空间中不再是线性的.

The question is: is this even possible in the fixed function pipeline? I'm not even sure exactly what the "right answer" is for more general quads; I imagine that the interpolation functions could get very complicated very fast, and I realize that "preserve the original scaling" isn't exactly an algorithm. World-space triangles are no longer linear in texture space.

顺便说一句,我真的不理解第3 rd 和第4 纹理坐标;如果有人可以指向我提供资源,那就太好了.

As an aside, I do not really understand the 3rd and 4th texture coordinates; if someone could point me to a resource, that would be great.

推荐答案

可以在Nathan Reed的博客中找到使用现代gpu-api的解决方案的最佳方法

The best approach to a solution working with modern gpu-api's can be found on Nathan Reed's blog

http://www.reedbeta.com /blog/2012/05/26/quadrilateral-interpolation-part-1/

但是您最终会遇到一个与原始问题类似的问题:(我尝试解决它,并在获得解决方案后发布解决方案.

But you end up with a problem similar to the original problem with the perspective :( I try to solve it and will post a solution once i have it.

这篇关于线性/非线性纹理映射扭曲的四边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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