bumpmapping_fp.cg 532 B

1234567891011121314151617181920
  1. struct v2f
  2. {
  3. float2 Position : POSITION;
  4. float2 TexCoord1 : TEXCOORD0;
  5. float2 TexCoord2 : TEXCOORD1;
  6. float3 LightVector : COLOR0;
  7. };
  8. float4 main(v2f IN,
  9. uniform sampler2D tex1,
  10. uniform sampler2D tex2, uniform float4 lightcolor) : COLOR
  11. {
  12. float4 Color1 = tex2D(tex1,IN.TexCoord1);
  13. float3 bumpNormal = ((tex2D(tex2,IN.TexCoord2))-0.5)*2;
  14. float3 lightVector = ((IN.LightVector)-0.5)*2;
  15. float light = dot(bumpNormal,lightVector);
  16. return Color1*light*lightcolor*2;
  17. }