投影变换 到 uv坐标 xy/w ---齐次坐标

本文详细解释了在计算机图形学中如何从经过world view proj变换后的齐次坐标转换为uv坐标,探讨了齐次坐标的几何意义,特别是其在处理无限远点和投影变换中的作用。通过将xy/w归一化到[0,1]区间,实现从三维空间到屏幕空间的映射。齐次坐标系统简化了变换表达,允许捕捉无限远的概念,并在曲线和曲面设计中发挥关键作用。" 113265297,10544041,MySQL连接与会话:实例、线程和数据库的关系解析,"['MySQL', '数据库', '连接管理', '会话管理', '线程']
摘要由CSDN通过智能技术生成

float3 vScreenPos = In.ClipPos.xyz;

vScreenPos /= In.ClipPos.w;

vScreenPos.xy += 1.f;

vScreenPos.xy *= 0.5f;

vScreenPos.y = 1.f - vScreenPos.y;

这个是shader里从vertex最后那个pos 里取 uv的算法

pos是指经过了 world view proj的变换得到的 齐次坐标(x,y,z,w)

我之前 一直不明白 为什么 要xy/w

后来 我认为是这样的  齐次坐标系 是为了 将 P‘=M1 *P+M2  (点P P' 变换矩阵M1 M2)

这种变换 统一到 一个矩阵里表示 就加了一维 使其 把变换统一到 相乘

进行 world view 变换时 w那里一直是一所以可以把 xyz1->xyz想成空间中的点  做各种变换

  但是 proj之后 w就不是1了   好像 world view 时M2的系数是1 proj时 M2的系数不是1了(这里表述不严谨 大体是这个意思)

   这样 就不能再把 点*Matrix的点当成 空间中对应位置的点 来想象 位置了 这步 就只是个计算 所以最后 要把w除去  以把P‘单独 提出来

/w只是计算中的一步 没有几何意义

理解起来 参见 齐次方程 x+y=0              (A)

               非齐次方程 x + y =b    (B)

B的解=A的通解+特解

为什么  x=xh/h  y=yh/h!!

http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/geometry/homo-coor.html

因为这里说的这些   符合在这样的 才能使 多项式成为齐次

再次感慨下 中文搜的东西 基本都雷同 技术资料只能找英文的!!!!!

One of the many purposes of using homogeneous coordinates is to capture the concept of infinity. In the Euclidean coordinate system, infinity is something that does not exist. Mathematicians have discovered that many geometric concepts and computations can be greatly simplified if the concept of infinity is used. This will become very clear when we move to curves and surfaces design. Without the use of homogeneous coordinates system, it would be difficult to design certain classes of very useful curves and surfaces in computer graphics and computer-aided design.

Let us consider two real numbers, a and w, and compute the value of a/w. Let us hold the value of a fixed and vary the value of w. As w getting smaller, the value ofa/w is getting larger. If w approaches zero, a/w approaches to infinity! Thus, to capture the concept of infinity, we use two numbers a and w to represent a value v,v=a/w. If <

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值