SCHÖNI WIEHNACHTE!
//varying vec3 vUv;
//vec3 vNormal = vec3(1.0,0.0,0.0);
//varying vec4 vColor;
uniform vec3 u_color;
uniform vec3 u_specColor;
uniform vec3 u_ultraSpec;
out vec4 vertexColor;
vec3 lightdir = vec3(1.0,0.0,-1.0);
void main() {
//float d = abs(dot(normal,lightdir)/*-dot((modelViewMatrix*vec4(normal,1.0)).xyz,tocam))/2.0;*/);
vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);
vec4 modelTangent = modelViewMatrix * vec4(normal,0.0); // I just passed the tangent through the normal pathway
float s = 1.0 - abs(modelTangent.z - dot(modelTangent.xyz,lightdir))*0.5;
float d = s*0.7 + 0.3;
vertexColor = vec4(u_color*d + smoothstep(0.9,1.0,s)*u_specColor + smoothstep(0.99,1.0,s)*u_ultraSpec,1.0);
gl_Position = projectionMatrix * modelViewPosition;
}
in vec4 vertexColor;
void main() {
gl_FragColor = vertexColor;
}