每天30分钟看Shader--(2)《Shaders for Game Programmers and Artists》Chapter4 Getting Started, Your First Shaders

每天30分钟看Shader--(2)《Shaders for Game Programmers and Artists》Chapter4 Getting Started, Your First Shaders
Seeing Double

一图解千言

就是在第2个pass里面加了个位移

每天30分钟看Shader--(2)《Shaders for Game Programmers and Artists》Chapter4 Getting Started, Your First Shaders_第1张图片



Exercise 1: ANIMATING A TEXTURE

纹理真的动起来了耶! ^_^

每天30分钟看Shader--(2)《Shaders for Game Programmers and Artists》Chapter4 Getting Started, Your First Shaders_第2张图片


Exercise 2: BLENDING TWO TEXTURES
混合两张纹理,现在像经历过硝烟

每天30分钟看Shader--(2)《Shaders for Game Programmers and Artists》Chapter4 Getting Started, Your First Shaders_第3张图片

注意事项:
       1)VS_INPUT里面只有一个纹理坐标,没有TEXCOORD1;
      
pixel shader
sampler2D Texture0;
sampler2D Texture1;

struct  PS_INPUT 
{
   float2 Texcoord : TEXCOORD0;
   float2 Texcoord1 : TEXCOORD1;
};

float4 ps_main( PS_INPUT Input ) : COLOR0
{
   
return tex2D( Texture0, Input.Texcoord ) *  tex2D(Texture1, Input.Texcoord1);
   
}

两个颜色乘起来就行了



你可能感兴趣的:(每天30分钟看Shader--(2)《Shaders for Game Programmers and Artists》Chapter4 Getting Started, Your First Shaders)