首页 > 其他 > 详细

使用RampTexture来控制diffuse shading

时间:2014-09-18 13:04:43      阅读:351      评论:0      收藏:0      [点我收藏+]

RampTexture

  RampTexture(渐变纹理),可以是1D/2D纹理.

  This allows you to accentuate the surface‘s colors to fake the effects of more bounce light or a more advanced lighting setup. You see this technique used a lot more for cartoony games, where you need a more artist-driven look to your Shaders and not so much of a physically-accurate lighting model. 

  首先需要一张渐变纹理:

  bubuko.com,布布扣

  在Half Lambert的基础上,使用RampTexture来控制diffuse shading:

  bubuko.com,布布扣

  The following is the result you will see after running the code: 

  bubuko.com,布布扣

How it works

  We take the re-mapped diffuse values from the Half Lambert operation and pass them into float2() to create the lookup values for the texture. When a value of 0 is set as the hLambert variable, the tex2D function looks up the pixel value at the UV value of (0,0). In this case it‘s the subtle peach color from the ramps gradient. When a value of 1 is set for the hLambert variable, the tex2D function looks up the pixel at the UV value of (1,1), or the white color. 

  

使用RampTexture来控制diffuse shading

原文:http://www.cnblogs.com/tekkaman/p/3978942.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!