+ vec4 light_pos = light_sources[index].position;
+ vec3 rel_pos = light_pos.xyz-world_pos*light_pos.w;
+ float d = length(rel_pos);
+ 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)
+{
+ float lod = (2-roughness)*roughness*(textureQueryLevels(environment_map)-1);
+ return textureLod(environment_map, env_world_matrix*direction, lod).rgb;