add new signal RGB (Friday Facts #388)

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

se-m
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Jan 28, 2024 6:43 pm
Contact:

add new signal RGB (Friday Facts #388)

Post by se-m »

TL;DR
New "RGB" signal works as normal color signal, but when used in device with "Use Color" checkbox (e.g. lamp) device will use it value (with clamp [0, 0xFFFFFF]) to set custom rbg color.
What ?
Add new kind of color signal which can be used as RGB color value for specific devices (with "Use Color" option).
As I see it, this change don't break any existing logic.

You can set this value directly (in hex, or new smart number format) or use combinators.

Example how to convert individual Red Blue Green signals into RGB with combinators:
constant -> (BLUE, RED, GREEN)
arifmetic (* and 255) -> (BLUE', RED', GREEN')
arifmetic (GREEN' << 8) -> GREEN''
arifmetic (RED' << 16) -> RED''
arifmetic (GREEN'' + RED'') -> YELLOW
arifmetic (YELLOW + BLUE') -> RGB

Same way HSV signal can be added, for those who prefer that color model.
Why ?
After "Friday Facts #388" many people asking to set rbg color with logic network.

pleegwat
Filter Inserter
Filter Inserter
Posts: 275
Joined: Fri May 19, 2017 7:31 pm
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by pleegwat »

It would make more sense to add an option to the lamp to make it treat a user-picked signal (or three) as RGB or HSV values.

camela_camera
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jan 11, 2024 4:38 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by camela_camera »

for the love of love, use hcl rather than hsv: it looks good. the conversion formula to rgb is pretty simple, although i wouldn't want to implement it as combinators: https://en.wikipedia.org/wiki/HCL_color_space

will send short, clean code for this via pm if asked, specifically the popular CIELChuv

coppercoil
Filter Inserter
Filter Inserter
Posts: 482
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by coppercoil »

camela_camera wrote:
Sat Feb 10, 2024 12:23 pm
for the love of love, use hcl rather than hsv: it looks good.
This is an important point. RGB is unnatural hardware level color representation, it's a shame that people still use it. People used to use RGB and nobody cares this is an evil colorspace.
Once you are familiar with HCL and CIELAB, have a look at Oklab colorspace, even Photoshop uses it.
I vote for HCLᵒᵏˡᵃᵇ

Illiander42
Filter Inserter
Filter Inserter
Posts: 514
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Illiander42 »

Voting to trust the colour nerds on this.

But also give us an option for RGB, because familiarity has value, even if it's a bad system.

Qon
Smart Inserter
Smart Inserter
Posts: 2150
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Qon »

coppercoil wrote:
Sat Feb 10, 2024 12:56 pm
camela_camera wrote:
Sat Feb 10, 2024 12:23 pm
for the love of love, use hcl rather than hsv: it looks good.
This is an important point. RGB is unnatural hardware level color representation, it's a shame that people still use it. People used to use RGB and nobody cares this is an evil colorspace.
You didn't understand the point. camela was talking about hcl vs hsv and didn't mention RGB.

It's not a shame that people use RGB, and it's not evil. It isn't the best for interpolating or picking color/component values. But it is what displays output and a common format for stored files. It's technically simple and the natural go-to format for storing and outputting color as. Yes it's hardware level color representation, but that doesn't make it unnatural. Our natural hardware, our eyes, have RGB channels. If you want to use another color space, you are allowed to compute the RGB values in whatever format you like. But it has to become RGB in the end so obviously you can't skip the most important color space. If you want to copy a .bmp file into factorio combinators and display it on lamps then it is RGB data in the file that you want your lamps to match so they can output accurate color to your RGB display.

But after adding RGB, adding alternatives seems like a good idea.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

camela_camera
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jan 11, 2024 4:38 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by camela_camera »

coppercoil knows where it's at. looks like oklab is also super simple https://github.com/Evercoder/culori/blo ... bToLrgb.js ; thx u, i will use this in my projects

vote HCLᵒᵏˡᵃᵇ! vote!

qon say truth also, that we shouldn't forbid rgb; it's an existing standard like 32 bit ints or unicode, ah well

evil and shame are ways of seeing and relating, not objective facts of things. rah team seeing fitting people into machine boxes as bad!

heck, even if we only had 3 narrower channels, imagining that we are RGB perceivers would be another way of molding people into machines; this time, with concepts rather than technical interfaces

did you know we have a 4th channel? check out 1980's modeling of spectral absorption curves https://en.wikipedia.org/wiki/File:Cone ... nce-en.svg. this channel is balanced differently than the other 3, so you only get full 4-dimensional color vision at certain light levels wherein you probably and also me for sure are not accustomed to engaging in complex, artistic color vision, so it's easy to not have noticed it

when artists talk about colors of shadows in ways that don't seem to make sense, often they're talking about this

coppercoil
Filter Inserter
Filter Inserter
Posts: 482
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by coppercoil »

Qon wrote:
Sat Feb 10, 2024 9:24 pm
It's not a shame that people use RGB, and it's not evil. It isn't the best for interpolating or picking color/component values. But it is what displays output and a common format for stored files. It's technically simple and the natural go-to format for storing and outputting color as.[..]
But after adding RGB, adding alternatives seems like a good idea.
I agree that RGB must be kept because it is very popular. Though the popularity does not mean it is natural. Try this thing: choose some green color shade and turn it to red while keeping the same lightness and colorfulness. Good luck.
There are more natural things that RGB cannot do.

People used to use RGB because colorpickers do not offer different solutions (HSL is 80% evil too). This is because software developers are lazy and have no clue about color science (or because they have tight deadlines and strict project managers). I know, this will never change, like JPG will never die. Some evils will last forever.

Qon
Smart Inserter
Smart Inserter
Posts: 2150
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Qon »

coppercoil wrote:
Sun Feb 11, 2024 12:52 pm
Qon wrote:
Sat Feb 10, 2024 9:24 pm
But [RGB] is what displays output and a common format for stored files. It's technically simple and the natural go-to format for storing and outputting color as.
I agree that RGB must be kept because it is very popular. Though the popularity does not mean it is natural.
I didn't say it was "popular", and I didn't say it was natural because of popularity. This is a strawman which you probably hallucinated. Frankly, I don't think you read my post at all, which is very weird since you decided to quote me. It being a common format is not a "popularity" argument, it is common in image formats because it is natural. The causal connection is in the opposite direction. Our eyes and brains use RGB, that is the natural part that our technology is pretty much forced to end up at. The physical frequencies of color are also natural, but hardware and wetware (receptors in biological eyes) can't really be made to input and output any and all frequencies independently.

sRGB format is one RGB format. You could have other RGB formats. But for Factorio you would have a format with much less bits per color channel rather than expanding sRGB.
coppercoil wrote:
Sun Feb 11, 2024 12:52 pm
Qon wrote:
Sat Feb 10, 2024 9:24 pm
[RGB] isn't the best for interpolating [...] values.
Try this thing: choose some green color shade and turn it to red while keeping the same lightness and colorfulness. Good luck.
Further proof you didn't bother to read what I said.
Though browsers are getting gradients in other color spaces, safari and chrome now supports "in oklab" among others
https://developer.mozilla.org/en-US/blo ... e-level-4/

Code: Select all

background: linear-gradient(to right in oklab, rgb(255 0 0), rgb(0 255 0));
So you don't even need to learn how to specify colors in each color space. You can use a color picker in any color space your software supports, copy the sRGB hexcode values from the oklab colorpicker into your website and still interpolate just fine in oklab color space.
coppercoil wrote:
Sun Feb 11, 2024 12:52 pm
There are more natural things that RGB cannot do.
Irrelevant.
coppercoil wrote:
Sun Feb 11, 2024 12:52 pm
People used to use RGB because colorpickers do not offer different solutions (HSL is 80% evil too). This is because software developers are lazy and have no clue about color science (or because they have tight deadlines and strict project managers). I know, this will never change, like JPG will never die. Some evils will last forever.
Sounds more like you have no clue about software development.
Also, JPG is an excellent format that has lasted for decades and still is competitive with modern formats and beats them in some categories. JPEG-XL is a new modern image format that basically surpasses all other formats in all categories it seems. But needs browser support.

GIF is actually a bad format for what it is used for today if you need to hate on something.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

pleegwat
Filter Inserter
Filter Inserter
Posts: 275
Joined: Fri May 19, 2017 7:31 pm
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by pleegwat »

Qon wrote:
Sun Feb 11, 2024 2:43 pm
Our eyes and brains use RGB
That's not true, it's just a useful fiction. We have (most commonly) three kind of colour receptors (cones) each of which is sensitive to different (but overlapping) parts of the visual spectrum; RGB is simply a reasonable approximation of displaying all colours. Light intensity however we mainly observe through a different type of receptors commonly called rods.

Qon
Smart Inserter
Smart Inserter
Posts: 2150
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Qon »

pleegwat wrote:
Sun Feb 11, 2024 3:18 pm
Qon wrote:
Sun Feb 11, 2024 2:43 pm
Our eyes and brains use RGB
That's not true, it's just a useful fiction. We have (most commonly) three kind of colour receptors (cones) each of which is sensitive to different (but overlapping) parts of the visual spectrum; RGB is simply a reasonable approximation of displaying all colours. Light intensity however we mainly observe through a different type of receptors commonly called rods.
Well obviously our eyes don't follow the sRGB technical specification exactly. But it's true enough. Everything is just a more or less useful fiction, but that is bit reductive. Do you have any example of these details being useful to the discussion though?

You can build (annoyingly flickering but still, set game speed to 100x and use a high refresh rate monitor to improve results a bit) RGB displays in Factorio now with red, green and blue lamps and PWM. The simplicity of the color space is a technical strength.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

Qon
Smart Inserter
Smart Inserter
Posts: 2150
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Qon »

coppercoil wrote:
Sat Feb 10, 2024 12:56 pm
Once you are familiar with HCL and CIELAB, have a look at Oklab colorspace, even Photoshop uses it.
I vote for HCLᵒᵏˡᵃᵇ
Kind of weird to request oklab but not oklch (same space but cylindrical coordinate system). Oklab is better for straight interpolation while oklch works better for color picking and palettes. (Edit: Does "I vote for HCLᵒᵏˡᵃᵇ" mean you want a oklch model for lamps instead? )

Oklab/oklch is great, but even sRGB seems like overkill with 8 bits per color channel. We don't need P3 colors if lamps can't even display sRGB. Lamps are many different colors, it's not like they fill their tile with #f00 just because you sent a red signal.

I'm not even sure a color picker like https://oklch.com would make sense for things like replacing color picker for character, spidertrons and trains in game. sRGB is fairly simple to me, but for non-technical people a HSL picker would be the simplest. The color picker currently doesn't even choose the color you select, it actually very noticably ignores your actual picked sRGB color and desaturates and lightens it a lot. Try to make a pitch black spidertron/train with the color picker.
It is possible to set much more saturated colors to entities with the mod interface.
Look at my mod Broodmother as an example.
Image
Broodmother_1.1.1/control.lua:65 wrote:

Code: Select all

mother.color = {r = 1, g = 0, b = 0}
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

coppercoil
Filter Inserter
Filter Inserter
Posts: 482
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by coppercoil »

Qon wrote:
You're right, you didn't say it was "popular". It *IS* popular regardless of who said what. Do you see the forest through the trees (not a question). I'm sorry I quoted you, let's start with my "sRGB is unnatural".

Our color perception (not eye's RGB sensitivity) is very different than sRGB. It is obvious for everyone who tried to choose more than one color using RGB, like I described. By the way, you can select CMYK color very easily too (and some people do), this is not related to our analog sensors, just matter of practice. We just haven't had the opportunity to get other types of practices.

CSS settings do not count here. Just open random software that has some color in the settings and you get system color window with RGB + HSL. This is what most people know about colors. oklch.com looks too geeky and should be improved/simplified for everyone use.

Can we go back to voting? :)

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2767
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by FuryoftheStars »

I'd like to see rgb added.

As for the rest (hsv vs hcl, etc), I don't care about it so long as none of it is at the exclusion of the simpler system that most non-graphic artists are familiar with. (And I know that no one has actually said that, yet, but I'm just putting it out there.)
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics

Qon
Smart Inserter
Smart Inserter
Posts: 2150
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Qon »

coppercoil wrote:
Sun Feb 11, 2024 6:42 pm
let's start with my "sRGB is unnatural".

Our color perception (not eye's RGB sensitivity) is very different than sRGB. It is obvious for everyone who tried to choose more than one color using RGB, like I described.
I said RGB when I meant "color models with separate channels for red, green and blue" and sRGB when I meant the specific 8-bit/channel standard RGB technical specification named sRGB.
coppercoil wrote:
Sun Feb 11, 2024 6:42 pm
By the way, you can select CMYK color very easily too (and some people do), this is not related to our analog sensors, just matter of practice. We just haven't had the opportunity to get other types of practices.
I did not make the argument that my ability to fairly easily read and write sRGB was because of its naturalness. That is very much an experience thing. So on that I agree.
coppercoil wrote:
Sun Feb 11, 2024 6:42 pm
CSS settings do not count here. Just open random software that has some color in the settings and you get system color window with RGB + HSL. This is what most people know about colors.
So you agree and vote for RGB + HSL then?
coppercoil wrote:
Sun Feb 11, 2024 6:42 pm
oklch.com looks too geeky and should be improved/simplified for everyone use.
Writing oklch/oklab colors is not "easy" in the sense that knowing what values are available in your gamut is not easy at all. It's basically oklch.com while closing your eyes so you can't even see the graphs showing what settings are valid. HSL is the simplification, oklab space and oklch are inherently complicated. You could probably make a simpler picker that doesn't expose all the intricacies but then you kind of also lose the benefits of using the oklab space in the first place, except for p3 color gamut. But you can have that with RGB and extended HSL.

HSL is much easier to specify highly saturated colors with if that is your goal (it is often mine). I don't care about perceived lightness when I want a nice looking blue and a nice looking yellow. But oklab is great for interpolating between them and oklch is great for making sufficiently contrasting text on top of my HSL picked color theme.
coppercoil wrote:
Sun Feb 11, 2024 6:42 pm
Can we go back to voting? :)
HSL with H/L as x/y axis gives all the saturated colors, makes for a quick color picker that is easy to understand.
Image
And a saturation slider added next to it for completeness.

For lamps, I don't think we will be able to notice the difference between a 4-bit per channel RGB gradient vs an oklab 32 bit gradient, so it seems kind of pointless and overkill to add that. HSL (with reduced bits as well maybe) would be nice for doing animated rainbows though so I'm for that.

oklab/okhcl are amazingly great color spaces, but I don't see how they would improve factorio lamps or vehicles. We have 1 bit (if expressed in RGB) color now for lamps, and even that is not really fully represented with the vanilla lamp graphics making it hard to distinguish white from black... I have installed Schall Lamp Contrast for actually readable lamp displays
Image

So my vote is RGB + HSL, for lamps (8 bit/channel or lower). And color picker as well, but I don't really need a color picker personally so it's whatever to me.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

coppercoil
Filter Inserter
Filter Inserter
Posts: 482
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by coppercoil »

Qon wrote:
Sun Feb 11, 2024 9:04 pm
So my vote is RGB + HSL, for lamps (8 bit/channel or lower). And color picker as well, but I don't really need a color picker personally so it's whatever to me.
Thank you for your vote.

Well, do we want full color signals, whatever encoding? :)

camela_camera
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Jan 11, 2024 4:38 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by camela_camera »

using rgb/hsv instead of hcl is like living in a world where proportional fonts never were popularized by system designers, and our web browsers, phones, etc displayed text in monospace, with proportional fonts relegated to the output of tools like photoshop and publishing tools

did you know that actually almost happened?

Qon
Smart Inserter
Smart Inserter
Posts: 2150
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Qon »

coppercoil wrote:
Sun Feb 11, 2024 9:24 pm
Well, do we want full color signals, whatever encoding? :)
Full colour is a term which means inidivdual colours are achieved by blending four primary colours (Cyan, Magenta, yellow and black) and is sometimes referred to as CMYK or full colour process.
No, CMYK is for printing, why would I want that? Factorio lamps don't output to physical paper.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser

Koub
Global Moderator
Global Moderator
Posts: 7454
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by Koub »

Qon wrote:
Sun Feb 11, 2024 9:04 pm
HSL with H/L as x/y axis gives all the saturated colors, makes for a quick color picker that is easy to understand.
Image
And a saturation slider added next to it for completeness.
I like that. It's something I can naturally understand how to use, despite being the ultimate noob to anything color related.
Personal note : I don't even know what a saturation slider does without googling it, and the color palette seems quite complete, so I'm under the impression I could even do without the saturation slider.

And as an end-user, I don't really care if it makes sense from a graphist standpoint, just this and a pipette, I need nothing more.
Koub - Please consider English is not my native language.

coppercoil
Filter Inserter
Filter Inserter
Posts: 482
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: add new signal RGB (Friday Facts #388)

Post by coppercoil »

camela_camera wrote:
Mon Feb 12, 2024 5:43 am
using rgb/hsv instead of hcl is like living in a world where proportional fonts never were popularized by system designers.
There is a subtle difference: color picker is a tool for creating colors, not for looking at. Once color was chosen (or proportional font was created), everyone are happy. HCL is for color designers. In Factorio nobody gives a sheet how good bad are their colors.
On the another hand, even engineers can use pro tools for choosing colors. The problem is, they have never seen such tool, therefore, they don't know how/why/when to use it. The good color picker should come first, then people will start thinking it is good.

I'm not sure if I want to go deeper to this interesting (off?)topic. Let's get full color signals first :)
Last edited by coppercoil on Mon Feb 12, 2024 11:10 am, edited 2 times in total.

Post Reply

Return to “Ideas and Suggestions”