precision mediump float; uniform vec4 color; varying vec3 vertexNormal; void main() { vec3 normal = normalize(vertexNormal); float lambert = max(0.0, -normal.y); float rim = 1.0 - lambert; rim *= rim * rim; gl_FragColor = rim + (0.4 + 0.4 * lambert) * color; }