   float weight = 0.0;
 
   vec2 tileOffset = 2.0 * tileSize * tileCoord;
-  float denom     = 2.0 * tileSize * 16.0;
+  float denom     = 2.0 * tileSize * tileCount;
 
   for(int dx=0; dx<2; ++dx) {
     for(int dy=0; dy<2; ++dy) {


uniform float tileSize;
uniform sampler2D tileMap;

varying vec3  normal;
varying vec2  tileCoord;

  float light = ambientOcclusion + max(0.15*dot(normal, vec3(1,1,1)), 0.0);
  
  gl_FragColor = vec4(color.xyz * light, 1.0);
}
