How is each color LUT used?

Place to get help with not working mods / modding interface.
Post Reply
Tynach
Inserter
Inserter
Posts: 31
Joined: Sun Aug 21, 2016 9:22 pm
Contact:

How is each color LUT used?

Post 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:
  1. How many of the LUTs are actually used by the game?
  2. How are they used?
  3. 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.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: How is each color LUT used?

Post 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.
Image

Transport Belt Repair Man

View unread Posts

Tynach
Inserter
Inserter
Posts: 31
Joined: Sun Aug 21, 2016 9:22 pm
Contact:

Re: How is each color LUT used?

Post 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).

Tynach
Inserter
Inserter
Posts: 31
Joined: Sun Aug 21, 2016 9:22 pm
Contact:

Re: How is each color LUT used?

Post by Tynach »

I really hate doing this, but it's left the first page without any helpful responses... So bumping.

May as well also share the LUTs I generated for this (make sure if you try these out, first rename the existing files to something like 'name-bak.png'):
  • lut-dawn.png
    lut-dawn.png (2.81 KiB) Viewed 1384 times
  • lut-day.png
    lut-day.png (213 Bytes) Viewed 1384 times
  • lut-night.png
    lut-night.png (3.07 KiB) Viewed 1384 times
  • lut-sunset.png
    lut-sunset.png (2.81 KiB) Viewed 1384 times
  • night.png
    night.png (3.18 KiB) Viewed 1384 times
  • nightvision.png
    nightvision.png (3.39 KiB) Viewed 1384 times
  • orange-dawn.png
    orange-dawn.png (3.22 KiB) Viewed 1384 times

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: How is each color LUT used?

Post 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)

Tynach
Inserter
Inserter
Posts: 31
Joined: Sun Aug 21, 2016 9:22 pm
Contact:

Re: How is each color LUT used?

Post 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!

Post Reply

Return to “Modding help”