Set Hue for data stage (and for control stage; and saturation and value)

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Set Hue for data stage (and for control stage; and saturation and value)

Post by eradicator »

darkfrei wrote:
Sat Jan 11, 2020 8:20 pm
The blender 3d needs much slower computer as you expected.
><((((*> No it doesn't. It's unusably slow without a proper graphics card/cpu if you want to do anything more than a bunch of white cubes and when you start using expensive effects like particles/smoke/raytracing/etc render times break the 10h mark easily even on high-end hardware. Also my computer is much slower than *you* expect so please keep on topic if you don't know what you're talking about.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 450
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Set Hue for data stage (and for control stage; and saturation and value)

Post by raiguard »

Bump. I would really like to at least be able to desaturate icons before tinting them. Have a look here:

desaturation comparison.png
desaturation comparison.png (399.55 KiB) Viewed 1038 times
On top is my current method - taking vanilla entities and tinting them purple. As you can see, the results can vary widely, and it doesn't look all that great.

On the other hand, the entities on the bottom had their sprites desaturated in an image editor, then tinted during the data stage. As you can see, it looks a lot better and more consistent. You don't have strange colors emerging from the combination of purple with whatever was there before.

If I want to be able to do this right now, I need to copy a ton of vanilla assets and desaturate them, and package them with my mod. For all of the items and entities that my mod uses, that is over 146 MEGABYTES of images. That is completely unacceptable for a mod, especially one whose latest release is only 364 KB.

So, please add an option to desaturate images? I know it's possible, because searching the crafting menu will grey out category icons when they run out of items... :D
Don't forget, you're here forever.

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Set Hue for data stage (and for control stage; and saturation and value)

Post by Mylon »

According to Posilla, it's possible to create a second layer of an image and use additive blending. I would love to see support for tints > 1, such that rgb = 2 would produce a white silhouette of the original image. It's not quite a HSL option, but it's close and would allow changing the color of a sprite without making it darker.

Changing the current mode to make 0-2 tints use the 0-1 scaling and 2-512 tints to use the 1-256 scaling shouldn't be too disruptive to previous mods.

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: Set Hue for data stage (and for control stage; and saturation and value)

Post by Mylon »

If anyone is still paying attention, I finally sat down to explore this and found success!

Image

Here's the code I used to achieve this result:

Code: Select all

local refurbisher = util.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-1"])
table.insert(refurbisher.animation.layers, 1, util.table.deepcopy(refurbisher.animation.layers[1]))
refurbisher.animation.layers[2].hr_version.tint = {r=0.8, g=0.8, b=0.8, a = 0.05}
refurbisher.animation.layers[2].hr_version.blend_mode = "additive-soft"
refurbisher.animation.layers[2].tint = {r=0.8, g=0.8, b=0.8, a = 0.05}
refurbisher.animation.layers[2].blend_mode = "additive-soft"
Note that alpha doesn't seem to actually do anything in this case. Lower values of rgb reduce the effect. (Kinda of what I expected alpha to do) I was unable to find parameters that would create a whiteout version, so options are somewhat limited, but hopefully this information is helpful to increase the recolor options for modders.

Post Reply

Return to “Modding interface requests”