Tekkaman

导航

 

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. 

  首先需要一张渐变纹理:

  

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

  

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

  

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. 

  

posted on 2014-09-18 11:58  Tekkaman  阅读(1732)  评论(0编辑  收藏  举报