Question about MT light source

Post Reply
crazy_baboon
Member
Posts: 96
Joined: Sat Oct 17, 2015 10:47

Question about MT light source

by crazy_baboon » Post

Hi,

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:

Image

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;
}
I still get some light which appears to be centered on my character and moves with it. I was expecting everything to be dark (notice as well: the axe as gone black):

Image

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.
Last edited by crazy_baboon on Tue Aug 21, 2018 14:19, edited 1 time in total.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Question about MT light source

by rubenwardy » Post

LUT means look up table

The copyright licenses at the top is a legal requirement
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Question about MT light source

by paramat » Post

There isn't light moving with the player, all you're seeing is fog turning black.
The light curve defines the visual brightness that results from each of the possible node light values 0-15.

crazy_baboon
Member
Posts: 96
Joined: Sat Oct 17, 2015 10:47

Re: Question about MT light source

by crazy_baboon » Post

paramat wrote:There isn't light moving with the player, all you're seeing is fog turning black.
The light curve defines the visual brightness that results from each of the possible node light values 0-15.
Thanks paramat!

I presume that the light curves only affect the fog.

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Question about MT light source

by paramat » Post

No the light curve affects the visual brightness of all nodes.
Fog colour is determined by sky or skybox colour so that it always blends into the distance. So i expect you made some kind of mistake.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests