博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Perspective-Correct Interpolation
阅读量:5845 次
发布时间:2019-06-18

本文共 2143 字,大约阅读时间需要 7 分钟。

  

(quote from "Mathematics for 3D Game Programming and Computer Graphics Third Edition")

  As the figure above showing,correct interpolation across the face of a triangle is not linear since equally spaced steps taken on the projection plane correspond to larger steps taken on the face of a triangle as the distance from the camera increases.

  What follows in this passage will prove that the reciprocal of the z coordinate is correctly interpolated in a linear manner across the face of a triangle ,so is b/z( b is a vertex attribute value,like texcoord and so on).

  So hardware first linearly interpolate 1/z when rasterizing a scanline(obtain the depth of each pixel),then linearly interpolate b/z to obtain the perspective-correct interpolated value of any vertex attribute b. 

 

Proof:

  Depth Interpolation:

  Assuming that the segment(represent a triangle) does not belong to  a line that passes through the origin, so it is visible( imaging that put a setsquare edge-on in front of you, then you can not tell whether it is a line or a setsquare).Then we can describe the line with the equation

ax+bz = c,where c != 0( equation 1,reference to the figure above).

  Using similar triangles,we can derived the follow relationship.

(equation 2)

  Assume that we konw the two endpoints of the line segment{(x1,z1),(x2,z2)} and their image on the projection plane{(p1,-e),(p2,-e)}(correspond to pixel 1 and pixel 2).Let

p3 = (1-t)p1 + t*p2(0<=t<=1)    (eq 3)

conbining equation 1, 2 and 3, we can find the z coordinate of the point(x3,z3),where the ray cast through the point (p3,-e)intersects the face of the triangle.That is:

   (eq 4)

 

Vertex Attribute Interpolation:

    We would expect the interpolated attribute value b3 to form the same proportion with the total difference along the line segment as does the interpolated depth value z3. ( b1,b2 is the vertex attribute values of the two endpoints{(x1,z1),(x2,z2)} of the line segment )That is, the equation

 (eq 5)

  combining eq 4,5, we can finally get the equation

 

 

 

  PS:Perspective-Correct Interpolation is now implemented by hardware!!!

转载于:https://www.cnblogs.com/swdever/p/3360409.html

你可能感兴趣的文章
java自定义异常
查看>>
mysql分区表之二:MySQL的表的四种分区类型介绍
查看>>
ArcObject10.1降级至10.0
查看>>
【小型系统】简单的刷票系统(突破IP限制进行投票)
查看>>
55种开源数据可视化工具简介
查看>>
[Protractor] Protractor Interactive with elementor
查看>>
大写和小写转换
查看>>
ASP.NET Core的配置(4):多样性的配置来源[下篇]
查看>>
java—三大框架详解,其发展过程及掌握的Java技术慨括
查看>>
站点搭建从零開始(二)server空间
查看>>
css 动画
查看>>
一起talk C栗子吧(第一百一十二回:C语言实例--线程同步概述)
查看>>
Spring MVC的Controller统一异常处理:HandlerExceptionResolver
查看>>
python做量化交易干货分享
查看>>
redis 的hash数据类型
查看>>
『TensorFlow』专题汇总
查看>>
调用getChildFragmentManager时出现的Bug
查看>>
log4j日志输出级别变更
查看>>
STL Map和multimap 容器
查看>>
启动就加载(二)---通过配置文件加载的的静态文件
查看>>