vec4 light_pos = light_sources[index].position;
vec3 rel_pos = light_pos.xyz-world_pos*light_pos.w;
float d = length(rel_pos);
- return IncomingLight(rel_pos/d, light_sources[index].color);
+ float attenuation = 1.0/dot(vec3(1.0, d, d*d), light_sources[index].attenuation);
+ return IncomingLight(rel_pos/d, light_sources[index].color*attenuation);
}
virtual vec3 get_environment_sample(vec3 direction, float roughness)