The new light map textures

Place to get help with not working mods / modding interface.
Post Reply
AlveKatt
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun Apr 14, 2019 1:44 pm
Contact:

The new light map textures

Post by AlveKatt »

How does the new light map textures work exactly? I really need to make new ones for my locomotive since the ones for the original locomotive fit very badly for it.

( viewtopic.php?p=523443#p523443 )

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: The new light map textures

Post by Deadlock989 »

AlveKatt wrote:
Sun Nov 29, 2020 6:16 am
How does the new light map textures work exactly?
That's an extremely broad question. If you meant "What do I need to make?" then it's an additive layer. You have lots of options there. I make them in Blender by illuminating some part of the structure with no other environmental light, giving it a fuzz/glow in compositing, and then removing any black matte (any remaining dark fuzz around the edge doesn't matter because it's additive, but getting rid of the majority of the black background helps because Factorio automatically crops any transparent borders from sprite frames, saving atlas space / VRAM). Another way without needing any matting would be to have the lit objects on a separate layer masked off by the main layer.
Image

AlveKatt
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun Apr 14, 2019 1:44 pm
Contact:

Re: The new light map textures

Post by AlveKatt »

I attached one of the Light layer frames. I kind of want the windows brighter in the night than this version does it. Do they inherit a lot of the colour under the light layer?
Attachments
0048.png
0048.png (7.21 KiB) Viewed 1185 times

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: The new light map textures

Post by Deadlock989 »

AlveKatt wrote:
Wed Dec 02, 2020 11:04 am
Do they inherit a lot of the colour under the light layer?
It's an additive process. Additive layers are literally doing addition with the colour channels, adding the red, green and blue values together per pixel. The exact method depends on the blend_mode of the sprite layer. The formulae for the different blend modes are given here. For "additive" mode which is what the base game uses for most of its lights, you can see it's literally just background R + foreground R, backgroud G + foreground G etc. So if you add dark grey to dark blue, you get mid-blueish grey. Add white (1,1,1) to anything and you always get white. Add black (0,0,0) to anything and you always get the original.

The other difference with a light layer and other additive sprites is that it is always treated as having maximum illumination whereas otherwise the sprite would also be darkened by the current day/night cycle value. That way the light layers really "pop" at night, an effect that has been put to really good use in the recent 1.1 update (when the engine gained the ability to use light layers in almost any sprite definition instead of hardcoded specific cases).
Image

AlveKatt
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun Apr 14, 2019 1:44 pm
Contact:

Re: The new light map textures

Post by AlveKatt »

So if I have pretty much the same as the original, only a bit lighter, I mostly just double the colour values? Which, if I am thinking right, means you just make the colours deeper, with the way my lightmaps are right now? Should I just make the images grey scale?

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: The new light map textures

Post by Deadlock989 »

AlveKatt wrote:
Wed Dec 02, 2020 11:59 am
So if I have pretty much the same as the original, only a bit lighter, I mostly just double the colour values? Which, if I am thinking right, means you just make the colours deeper, with the way my lightmaps are right now? Should I just make the images grey scale?
Using greyscale light layers is maybe safer because it does make it easier to predict the effects. If you do want to try and get a coloured light effect then go with very unsaturated colours. It depends on the colours involved and the effect you want. If (as in your example sprite above) both the underlying base layer and the light layer are a dark blue, then you will just get a stronger blue as a result: (0.0, 0.0, 0.25) + (0.0, 0.0, 0.25) = (0.0, 0.0, 0.5).

For my lights I seemed to end up using a lot of very slightly tinted whites, i.e. low saturation but high value colours, as the light source - real world light sources are usually a mix of frequencies, otherwise it looks like a laser. So in that case, adding light blue to light blue means you end up with white: (anything over 0.1) + (0.9, 0.9, 1.0) = (1.0, 1.0, 1.0) because the values are capped.

I feel like I'm not explaining this very clearly. It gets easier with practice.
Image

AlveKatt
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun Apr 14, 2019 1:44 pm
Contact:

Re: The new light map textures

Post by AlveKatt »

Deadlock989 wrote:
Wed Dec 02, 2020 12:11 pm
I feel like I'm not explaining this very clearly. It gets easier with practice.
I appreciate it all the same! I'm gonna try rendering the windows with the material inverted, see what happens.

Post Reply

Return to “Modding help”