Page 1 of 1
How is each color LUT used?
Posted: Mon Apr 20, 2020 5:12 pm
by Tynach
According to a post in
this bug report, the difference between 'lut-night.png' and 'night.png' is that one is applied to how the world is normally rendered, and the other one is applied to a highly zoomed in map view. However, I can't see any changes when I supply my own variants of certain LUTs, such as 'lut-dawn.png', 'lut-sunset.png', 'orange-dawn.png', and so on. However, it does work to replace 'lut-night.png' and 'night.png'.
I can clearly see a difference between 'identity-lut.png' and 'lut-day.png', but replacing the latter with the former doesn't seem to make anything dimmer. There's also a subtle difference between 'lut-day.png' and 'orange-dawn.png', but as noted above nothing seems different if I replace 'orange-dawn.png' with a significantly different custom version.
So basically my questions are:
- How many of the LUTs are actually used by the game?
- How are they used?
- Is their disuse a bug, or am I doing something wrong (or expecting the wrong thing)?
Also, I'm sorry if this is the wrong forum section for these questions. I wasn't sure if replacing the LUTs would be considered 'modding' or not.
Re: How is each color LUT used?
Posted: Mon Apr 20, 2020 5:24 pm
by steinio
Good post. Sadly LUTs aren't explained at all in the wiki.
I just found out, if i set the dawn lut to night vision equipment, the night is bright like "dawn" probably.
Re: How is each color LUT used?
Posted: Mon Apr 20, 2020 5:31 pm
by Tynach
steinio wrote: Mon Apr 20, 2020 5:24 pm
I just found out, if i set the dawn lut to night vision equipment, the night is bright like "dawn" probably.
I haven't tested my replacement for 'nightvision.png' yet, as I'm not at a point in the game where I have night vision available. That said, I
have made one, and it's good to know it'll work once I get to that point in the game.
For anyone wondering, the LUTs are in the 'data/core/graphics/color_luts/' folder (starting from Factorio's root folder).
Re: How is each color LUT used?
Posted: Wed May 06, 2020 10:24 am
by Tynach
Re: How is each color LUT used?
Posted: Wed May 06, 2020 10:36 am
by posila
Only lut-night.png, night.png and nightvision.png ended up being used. Their usage is defined in utility-constants.lua and equipment.lua (just use find-in-files in your favourite text editor and you should find it).
At the moment, for non-nightvision mode, LUTs from nearest two defined daytime "key-frames" are linearly interpolated together and then transformed color for game view pixel is fetched from the new LUT, and then transformed color is linerly interpolated with original color using "non-ambient light intensity" at that pixel as ratio for the lerp (I am not sure if I explained it well, you can see this in game.frag or game.psh fragmen/pixel shader)
Re: How is each color LUT used?
Posted: Fri May 08, 2020 11:43 pm
by Tynach
posila wrote: Wed May 06, 2020 10:36 am
Only lut-night.png, night.png and nightvision.png ended up being used. Their usage is defined in utility-constants.lua and equipment.lua (just use find-in-files in your favourite text editor and you should find it).
At the moment, for non-nightvision mode, LUTs from nearest two defined daytime "key-frames" are linearly interpolated together and then transformed color for game view pixel is fetched from the new LUT, and then transformed color is linerly interpolated with original color using "non-ambient light intensity" at that pixel as ratio for the lerp (I am not sure if I explained it well, you can see this in game.frag or game.psh fragmen/pixel shader)
Aah, ok. Thanks for the pointer to look at utility-constants.lua, I've now plugged in the values to use the dawn and sunset LUTs!
By the way, I noticed that the values for the map screen (zoom_to_world_daytime_color_lookup) follow the day/night cycle detailed in the comment above that section.. But the other set of values for normal in-game use (daytime_color_lookup)
don't follow said 'default day/night times', except for the 'fully night' portion (between 0.45 and 0.55). Is this on purpose to blur the boundary between day and night a little more, or a mistake?
Also, I've not yet looked at it, but it's cool to hear that the fragment shader is actually a separate file instead of baked into the executable!