No Description

attachmentwrite.frag 629B

1234567891011121314151617181920212223
  1. #version 450
  2. layout (location = 0) in vec3 inColor;
  3. layout (location = 1) in vec3 inNormal;
  4. layout (location = 2) in vec3 inViewVec;
  5. layout (location = 3) in vec3 inLightVec;
  6. layout (location = 0) out vec4 outColor;
  7. void main()
  8. {
  9. // Toon shading color attachment output
  10. float intensity = dot(normalize(inNormal), normalize(inLightVec));
  11. float shade = 1.0;
  12. shade = intensity < 0.5 ? 0.75 : shade;
  13. shade = intensity < 0.35 ? 0.6 : shade;
  14. shade = intensity < 0.25 ? 0.5 : shade;
  15. shade = intensity < 0.1 ? 0.25 : shade;
  16. outColor.rgb = inColor * 3.0 * shade;
  17. // Depth attachment does not need to be explicitly written
  18. }