环境贴图

   以前自己看过shader,最近因为被客户逼着搞效果,只能自个儿捣鼓shader。好友把我深深鄙视一番。只好自己单独写篇环境贴图的文章,来小总结一下。

   环境贴图(Environment Mapping)又叫反射贴图(Reflection Mapping),在曲面上对反射效果进行很好的的近似。示意图如图所示:

未命名

   所有的EM方法都从一束来自视点的射线出发,到反射体的一个点终止,然后这束光线以这个点处的法线为基准进行反射。环境贴图近似假设进行反射的光源与物体都位于很远的位置,同时反射体不会反射自身。如果这些假设成立,就可以将反射体周围的环境看成围绕他的一个二维投影。

   EM的算法步骤如下:(摘自Real time rendering)

  Generate or load a two-dimensional image representing the environment.

  For each pixel that contains a reflective object, compute the normal at the location on the surface of the object.

  Compute the reflected view vector from the view vector and the normal.

  Use the reflected view vector to compute an index into the environment map that represent the incoming radiance in the reflected view direction.

  Use the texel data from the environment map as incoming radiance .

目前环境贴图应用的方法有Blinn和Newell方法、立方体贴图和球面贴图。具体的方法可以参考实时计算机图形学。

使用立方体贴图实现的效果如下:

IT@B90K{XAYJBI6L}L2_39X

转载于:https://www.cnblogs.com/cg_ghost/archive/2012/01/05/2313472.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值