Brak opisu

123456789101112131415161718192021222324252627282930
  1. #version 450
  2. layout (binding = 1) uniform sampler2D samplerColorMap;
  3. layout (location = 0) in vec3 inNormal;
  4. layout (location = 1) in vec3 inColor;
  5. layout (location = 2) in vec3 inLightVec;
  6. layout (location = 0) out vec4 outFragColor;
  7. void main()
  8. {
  9. vec3 color;
  10. vec3 N = normalize(inNormal);
  11. vec3 L = normalize(inLightVec);
  12. float intensity = dot(N,L);
  13. if (intensity > 0.98)
  14. color = inColor * 1.5;
  15. else if (intensity > 0.9)
  16. color = inColor * 1.0;
  17. else if (intensity > 0.5)
  18. color = inColor * 0.6;
  19. else if (intensity > 0.25)
  20. color = inColor * 0.4;
  21. else
  22. color = inColor * 0.2;
  23. // Desaturate a bit
  24. color = vec3(mix(color, vec3(dot(vec3(0.2126,0.7152,0.0722), color)), 0.1));
  25. outFragColor.rgb = color;
  26. }