return love.graphics.newShader[[ #define fog vec4( 0.85, 0.85, 1.0, 1.0 ) #define fogHigh vec4( 1.0, 1.0, 0.85, 1.0 ) #define sunDir 0.1 * vec3( 0.9, 0.2, 0.5 ) varying float depth; varying float height; varying float instanceColor; #ifdef VERTEX //per instance: (uniform) scale and xz position attribute vec4 bellInstance; attribute vec3 vertexNormal; uniform mat4 view; uniform mat4 proj; vec4 position( mat4 _, vec4 pos ){ instanceColor = bellInstance.a; pos.xyz *= bellInstance.r; pos.xz += bellInstance.gb; height = pos.y; vec4 eye = view * pos; depth = -eye.z; return proj*eye; } #endif #ifdef PIXEL vec4 effect( vec4 color, Image tex, vec2 texuv, vec2 scruv) { vec4 icolor = mix( vec4(1.0,1.0,1.0,1.0), vec4(0.5,0.0,0.0,1.0), instanceColor ); vec4 texel = Texel( tex, texuv ); vec4 bellColor = icolor * (texel + (1.0 - texel.a)); return color * mix( mix( bellColor, fog, clamp( depth / 80.0, 0.0, 1.0)), fogHigh, clamp( height / 20.0, 0.0, 1.0)); } #endif ]]