I have been learning about MT's lighting system and I struggle to understand what the lighting curve "light_LUT" does. It is defined in https://github.com/minetest/minetest/bl ... /light.cpp. If I compile the code without modification, I get the following:
However, If I zero "light_LUT", i.e. change the "set_light_table" function to:
Code: Select all
void set_light_table(float gamma){
// Lighting curve derivatives
const float alpha = g_settings->getFloat("lighting_alpha");
const float beta = g_settings->getFloat("lighting_beta");
// Lighting curve coefficients
const float a = alpha + beta - 2.0f;
const float b = 3.0f - 2.0f * alpha - beta;
const float c = alpha;
// Mid boost
const float d = g_settings->getFloat("lighting_boost");
const float e = g_settings->getFloat("lighting_boost_center");
const float f = g_settings->getFloat("lighting_boost_spread");
// Gamma correction
gamma = rangelim(gamma, 0.5f, 3.0f);
for (size_t i = 0; i < LIGHT_SUN; i++) {
float x = i;
x /= LIGHT_SUN;
float brightness = a * x * x * x + b * x * x + c * x;
float boost = d * std::exp(-((x - e) * (x - e)) / (2.0f * f * f));
brightness = powf(brightness + boost, 1.0f / gamma);
light_LUT[i] = 0;
if (i > 1 && light_LUT[i] <= light_LUT[i - 1])
light_LUT[i] = 0;
}
light_LUT[LIGHT_SUN] = 0;
}
What is happening here?
Does the lighting curve "light_LUT" only affect sort of ambient light?
What is the light source which appears to be centered on the player?
Thanks
ps:
What does light_LUT stand for?
Wouldn't it be great is instead of having a 20 line copyright header on every single file we had an actually useful description/summary of what that file does? I know copyright notices are important, but they could be moved to the bottom section of every file.