"\n"
"layout (std140) uniform ub_world_lighting\n"
"{\n"
+" vec4 g_cube_min;\n"
+" vec4 g_cube_inv_range;\n"
+"\n"
" vec4 g_light_colours[3];\n"
" vec4 g_light_directions[3];\n"
" vec4 g_ambient_colour;\n"
" int g_light_preview;\n"
" int g_shadow_samples;\n"
"\n"
+" int g_debug_indices;\n"
+" int g_debug_complexity;\n"
+"\n"
" // g_time ?\n"
"\n"
" //vec4 g_point_light_positions[32];\n"
" return pow(max(dot( halfview, specdir ), 0.0), exponent);\n"
"}\n"
"\n"
-"vec3 newlight_compute_quadratic( vec3 wnormal, vec3 halfview, \n"
+"vec3 newlight_compute_quadratic( vec3 wnormal, float max_dist,\n"
" vec3 light_colour, vec3 light_pos )\n"
"{\n"
-" vec3 light_delta = (light_pos-aWorldCo) * 10.0;\n"
+" vec3 light_delta = light_pos-aWorldCo;\n"
"\n"
-" float quadratic = dot(light_delta,light_delta);\n"
-" float attenuation = 1.0f/( 1.0f + quadratic );\n"
-" attenuation *= max( 0.0, dot( normalize(light_delta), wnormal ) );\n"
+" float dist2 = dot(light_delta,light_delta);\n"
+"\n"
+" float quadratic = dist2*100.0;\n"
+" float attenuation = 1.0f/( 1.0f + quadratic );\n"
+" attenuation *= max( dot( normalize(light_delta), wnormal ), 0.0 );\n"
"\n"
-" return light_colour*attenuation;\n"
+" float falloff = max( 0.0, 1.0-(dist2*max_dist) );\n"
+" return light_colour * attenuation * falloff;\n"
"}\n"
"\n"
"vec3 newlight_compute_spot( vec3 wnormal, vec3 halfview, \n"