uniform sampler2D texture_emissiveMap; uniform float uTime; vec3 getEmission() { // Dot the world space normal with the world space directional light vector float nDotL = dot(dNormalW, light0_direction); // Clamp it between zero and one float factor = clamp(nDotL, 0.0, 1.0); // calculate glow float glow = clamp(abs(sin(uTime * 0.1) * cos(uTime * 0.1)), 0.2, 1.0) * 30.0; // Scale the emissive map by the 'nighttime' factor return $texture2DSAMPLE(texture_emissiveMap, $UV).$CH * factor * glow * vec3(1.0,1.0,0.3); }