码迷,mamicode.com
首页 > 其他好文 > 详细

使用RampTexture来控制diffuse shading

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

标签:style   blog   http   color   io   使用   ar   strong   for   

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

标签:style   blog   http   color   io   使用   ar   strong   for   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!