Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. struct fsOutput {
  2. float4 color : COLOR;
  3. };
  4.  
  5. uniform sampler2D color_texture : TEXUNIT0;
  6. uniform sampler2D normal_texture : TEXUNIT1;
  7.  
  8. fsOutput FS_Main(float2 colorCoords : TEXCOORD0,
  9. float2 normalCoords: TEXCOORD1)
  10. {
  11.  
  12. fsOutput fragm;
  13.  
  14.  
  15. float4 anorm = tex2D(normal_texture, normalCoords);
  16. float3 normal = normalize(anorm.rgb * 2.0f - 1.0f);
  17. float3 light_pos = normalize(float3(1.0f, 1.0f, 1.5f));
  18. float diffuse = max(dot(normal, light_pos), 0.0);
  19. float3 color = diffuse * tex2D(color_texture, colorCoords).rgb;
  20. fragm.color = float4(1.0f,1.0f,1.0f,1.0f);
  21. return fragm;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement