Different scene, toon shading and separate parameters for color input attachment

This commit is contained in:
saschawillems 2018-07-19 11:01:15 +02:00
parent bdb9af7ef7
commit 0fb88d5467
8 changed files with 74 additions and 31 deletions

View file

@ -1,11 +1,23 @@
#version 450
layout (location = 0) in vec3 inColor;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec3 inViewVec;
layout (location = 3) in vec3 inLightVec;
layout (location = 0) out vec4 outColor;
void main()
{
outColor = vec4(inColor, 0.0);
// Toon shading color attachment output
float intensity = dot(normalize(inNormal), normalize(inLightVec));
float shade = 1.0;
shade = intensity < 0.5 ? 0.75 : shade;
shade = intensity < 0.35 ? 0.6 : shade;
shade = intensity < 0.25 ? 0.5 : shade;
shade = intensity < 0.1 ? 0.25 : shade;
outColor.rgb = inColor * 3.0 * shade;
// Depth attachment does not need to be explicitly written
}