Factorio needs to be brighter (w/ images and source code)

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Factorio needs to be brighter (w/ images and source code)

Post by Moosfet »

I suggested this a year ago, and so far the developers have ignored it, so let's try again...

To see exactly what I mean, look at these examples: https://imgur.com/a/C5PNs

Seeing them side-by-side, Factorio's current appearance is just crazy dark. Even in the middle of the day it's difficult to see because there isn't enough light. It looks like it does when you're outside and it's all dark and cloudy because it's about to start raining. That's as bright as the game ever gets.

I got the brighter images simply by modifying the game's graphics files, something the game itself could easily do as it loads them. The same modifications work for both day and night, so this is very easy to fix.

EDIT: Later in this thread I post a link to a Windows program I wrote that can do what this code does automatically.

Here's the complete source code for the utility I made to modify the graphics. It also needs "stb_image" library which is available on the internet, but of course if this were integrated into Factorio, it would just use whatever Factorio presently uses to load graphics, and it wouldn't need to save the graphics afterwards.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"

int main(int argc, char **argv) {
  if (argc < 3) {
    fprintf(stderr, "Please supply input and output file names.\n");
    exit(1);
  };

  // load the input image

  int width, height, channels;
  unsigned char *image = stbi_load(argv[1], &width, &height, &channels, 4);
  if (image == NULL) {
    printf("Failed to load '%s': %s\n", argv[1], stbi_failure_reason());
    exit(1);
  };

  // There're only 256 possible inputs, so to
  // speed things up, store the results of
  // the brightening calculations in a table.

  unsigned char old_to_new[256];
  for (int i = 0; i < 256; i++) {

    // remove gamma curve
    float t = powf((i + 0.5f) / 256.0f, 2.2f);

    // apply a brightening formula
    t = 0.25f * sqrtf(t) + 3.0f * t;
    // Generally it makes it 3x brighter, but it
    // also brightens the darks a little more.

    // apply gamma curve
    int o = 256.0f * powf(t, 1.0f / 2.2f);

    // clip the values
    if (o < 0) o = 0;
    if (o > 255) o = 255;

    // save in table
    old_to_new[i] = o;

  };

  // modify all the pixels

  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      for (int c = 0; c < 3; c++) {
        int t = *(image + (y * width + x) * 4 + c);
        t = old_to_new[t];
        *(image + (y * width + x) * 4 + c) = t;
      };
    };
  };

  // save the output image

  stbi_write_png(argv[2], width, height, 4, image, width * 4);

  stbi_image_free(image);

};
This program as written modifies only one graphics file. I use a shell script to run it on every graphic in the "entity," "icons," decorative", and "terrain" folders under the "data/base/graphics" folder. Modifying the graphics in the other folders won't help the appearance of the game. What the game looks like afterwards is shown in the imgur album linked above.

I (and I assume everyone else) would really appreciate it if the developers could integrate this code into Factorio itself. The game is just crazy dark by default, and even though I have this solution for myself, the darkness still annoys me. I can only update the game with the original files in place. Since there are updates seemingly every day, that means I have to quit the game, put the old graphics files back, run the game, do the update, quit the game, re-run this code to brighten the graphics, then run the game again. What's worse, I now want to help out a friend by making his game brighter too, but the thought of explaining to him how to do this is a bit much. In particular, the script I use in my Linux won't work in his Windows, and I can't write a script for him that does because I don't have Windows and so I can't test it. ...and the thought of trying to do so seems silly when this is something the game ought to be able to fix for itself.

Please, please, make Factorio brighter. Even having my own fix for this problem, it still tortures me. I can't imagine how much it tortures the average player who can't fix it for themselves. I really don't understand how it doesn't torture the developers, unless maybe they all play the game in total darkness to compensate for the game's darkness. If I were a Factorio developer, this would be my #1 priority as it is the most conspicuous defect in the game and incredibly easy to fix.
Last edited by Moosfet on Tue Mar 06, 2018 2:09 am, edited 1 time in total.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by eradicator »

If you're already scripting and replacing every graphics file you might as well auto-generate a mod for the graphics. Just replicate the core/base graphics structure 1:1 in your mod, then walk through data.raw and replace every file path instance of "__core__" or "__base"__ with "__yourmod__". Also didn't someone somewhere (FFF?) mention that some future version (0.17?) would have moddable shaders?

That said i do agree that a "gamma" graphics slider setting like every other game has would be quite nice to adjust the brigtness, also accodring to IRL outside/room brightness.

+1
Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Moosfet »

The gamma curve seems to be fine. The problem here is simply one of brightness.

When people render 3D images, they have to choose how bright the rendered image is, either by changing the lighting or by changing the exposure. However, many people make a mistake in choosing the exposure, in that they try to avoid bright spots clipping to maximum brightness, and turn down the exposure in an effort to avoid it. The problem is that our monitors can only emit light up to a certain brightness. Anything brighter than our monitor's maximum brightness has to be clipped to that maximum. That's the problem in Factorio: Lights and reflections of the sun should be clipped to the maximum brightness, because these things are brighter than anything our monitors can display, but the exposure seems to have been chosen so that the brightest parts of the graphics don't clip. To find the ideal exposure, you have to ignore the brightest parts of the image and focus on the parts people actually want to be able to see. Its unfortunately that any part of the brightness curve has to be clipped, but until we have sunlight-strength back-lights in our monitors (and 48-bit color to go with them) that's just the reality of computer graphics.

A more minor problem I found was that the darker parts of images were too dark. This probably came from a combination of the rendering process not sufficiently accounting for reflected light and black objects being made too black. When you're outside on a sunny day, nothing outside of a very deep hole is really black, because there's so much light that some of it gets everywhere. Even indoors, look at anything that is "black" and you'll see that you can clearly see its details because it is actually reflecting a fair amount of light. What we decide to call "black" has more to do with how much light it emits relative to other nearby objects than it does with the absolute amount of light it emits. When we really see black, we assume we're not seeing anything at all, because we're looking into darkness. So if you want to make a 3D render of something that is black, in reality it should probably reflect 5% of the light that hits it rather than the 0% you might normally think of as black, and indeed, black surfaces are often glossy, and so at certain angles they should reflect 100% of the light that hits them. This affects not only the appearance of the black object, but also the appearance of anything nearby that should be illuminated by the light reflecting from the black object.

This is where the formula I use comes from. For the most part it just triples the brightness of every pixel while preserving the existing gamma curve. To a smaller degree it also brightens the darker parts of each image a little more than the rest to make up for the fact that the darker parts are rendered too dark, but it does this in a way that the very darkest parts continue to be just as dark since some things actually should be the very darkest black. This is a much smaller effect though, as the main problem is just the overall brightness.

The only reason the program deals with gamma at all is because it isn't correct to just triple the RGB values. The RGB values in images use a gamma of 2.2. So it removes that gamma to get values on a linear scale, then calculates the new brightness on that linear scale, then re-applies the gamma before saving the images.

Anyway, here's the script that I use to run the program above, which I compiled as "brightener":

Code: Select all

#/bin/bash

rm -r factorio-brighter
cp -a factorio factorio-brighter

cd factorio/data/base/graphics

for i in `find entity icons decorative terrain -name "*.png"`; do
  echo $i
  ../../../../brightener $i ../../../../factorio-brighter/data/base/graphics/$i
done
To make things easier on myself, some of the folders and files in my "factorio" folder are symlinks, so that when this script is run again, I don't lose all of my settings and save games.

I'm hoping a developer will just try it. I'm like 101% certain that anyone who tries it for a day will be unable to tolerate the game at its original brightness ever again.
Caine
Fast Inserter
Fast Inserter
Posts: 213
Joined: Sun Dec 17, 2017 1:46 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Caine »

I still think your modifications look unpleasantly bright. I hope this idea does not happen.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by bobingabout »

I don't think the game is too dark, in fact your modification looks crazy bright.

Try changing your gamma settings for Factorio, that might help
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Deadly-Bagel »

Looking at your screenshots they look washed out and pale, this coming from someone heavily colourblind. The default game is fine.

Though nightvision could stand to turn on a bit earlier, whipped up a quick mod and found ~ 0.2 darkness is ideal (default is 0.5).
Money might be the root of all evil, but ignorance is the heart.
Skeletpiece
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Sat Jul 08, 2017 6:26 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Skeletpiece »

bobingabout wrote:I don't think the game is too dark, in fact your modification looks crazy bright.

Try changing your gamma settings for Factorio, that might help
+1

Images for me are ok. I dont like it too bright
Jap2.0
Smart Inserter
Smart Inserter
Posts: 2378
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Jap2.0 »

Deadly-Bagel wrote:Looking at your screenshots they look washed out and pale, this coming from someone heavily colourblind. The default game is fine.

Though nightvision could stand to turn on a bit earlier, whipped up a quick mod and found ~ 0.2 darkness is ideal (default is 0.5).
Didn't they recently change that, or was that just for lamps?
Also, I agree that it's fairly good as is.
There are 10 types of people: those who get this joke and those who don't.
wvlad
Fast Inserter
Fast Inserter
Posts: 217
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by wvlad »

+1 for brighter version, I use SweetFx (beside factorio.exe)
Before:
Image
After:
Image
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by eradicator »

wvlad wrote:+1 for brighter version, I use SweetFx (beside factorio.exe)
Looks oversharpened on those pictures, but otherwise ok.
Mind replacing that link by a link to the official page? Not everyone likes downloading from some dubious private link.
Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Moosfet »

I'm really at a loss to understand how anyone can think the original brightness is better, other than simply being in shock at seeing something different than what they're used to. I didn't start out with it that bright, but after I got used to my first smaller increase in brightness, it clearly needed even more than that. A 3x increase is where I ended up in the end.

Here's the histogram of the first image in that gallery:

Image

99% of the pixels are below 70%, but that's on a 2.2 gamma curve. After applying the gamma, 99% of the pixels are below an absolute brightness of 46%.

That was a screen capture from the middle of the day. It's as bright as the game is ever going to get, yet still essentially no part of the image emits even half of the light my monitor is capable of emitting. When the day comes that monitors are capable of replacing light bulbs, a histogram like that will make sense, but we're not there yet. Monitors are still so dim that we often type text on backgrounds of the brightest white that our monitors are capable of producing.

The game is just too dark. It's an indisputable fact.
Jap2.0
Smart Inserter
Smart Inserter
Posts: 2378
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Jap2.0 »

Moosfet wrote:I'm really at a loss to understand how anyone can think the original brightness is better, other than simply being in shock at seeing something different than what they're used to. I didn't start out with it that bright, but after I got used to my first smaller increase in brightness, it clearly needed even more than that. A 3x increase is where I ended up in the end.
You're used to it brightened. We're used to it at the normal brightness. People are remarkably good at adjusting to things. Just because you can adjust to something doesn't mean it's good - and as we can easily adjust to either of these brightnesses, so even if that was a good argument, it would apply equally well to the base brightness.
Moosfet wrote:Here's the histogram of the first image in that gallery:

Image

99% of the pixels are below 70%, but that's on a 2.2 gamma curve. After applying the gamma, 99% of the pixels are below an absolute brightness of 46%.

That was a screen capture from the middle of the day. It's as bright as the game is ever going to get, yet still essentially no part of the image emits even half of the light my monitor is capable of emitting. When the day comes that monitors are capable of replacing light bulbs, a histogram like that will make sense, but we're not there yet. Monitors are still so dim that we often type text on backgrounds of the brightest white that our monitors are capable of producing.
Just because our monitors can produce light which is much brighter than this doesn't mean that we need them to. Early in the morning and late at night I often turn the brightness on my laptop down as low as it will go, and sometimes still consider it to be too bright. As for the fact that we usually type on a white background: first, Factorio isn't a word processor, second, I'm typing this on a grey background, and third, that may have something to do with the fact that we were writing with ink on paper for a little while prior to inventing computers.
Moosfet wrote:The game is just too dark. It's an indisputable fact.
No. That is your opinion - and I doubt it can be proven one way or another. Google defines indisputable fact as such:

in·dis·put·a·ble
/ˌindəˈspyo͞odəb(ə)l/
adjective
unable to be challenged or denied.

fact
/fakt/
noun
a thing that is indisputably the case.

I literally just challenged and denied your position. So no, by its very defenition, that is neither indiputable or fact.
There are 10 types of people: those who get this joke and those who don't.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by eradicator »

Moosfet wrote: I didn't start out with it that bright, but after I got used to my first smaller increase in brightness, it clearly needed even more than that.
Now i have this image in my head of some shady drug dealer selling BRIGHT (5 bucks per pill) :P.
Moosfet wrote: Here's the histogram of the first image in that gallery:

Image

99% of the pixels are below 70%, but that's on a 2.2 gamma curve. After applying the gamma, 99% of the pixels are below an absolute brightness of 46%.
Well, the biggest problem i see there, if i'm interpreting this right (and if it can be interpreted by a single picture), is that factorio is wasting half the potential brightness range which means less overall contrast, which is bad. The total amount of dark vs brigth sounds like an odd thing to compare (factorio does have an overall darkish/brownish theme), but wasting range like that is like... buying a high-tech HDR capable TV for 5000€ and then watching black-and-white tv from 50 years ago on it, a very obvious waste of capabilities. That said @Moosfet you should consider that people here play on various types and ages of monitores, with a highly variable capability to produce the "intended" representation of the game. That, and technical changes of that kind have a high resistance (see the 24fps vs 60fps discussions on various movie forums, or vinyl vs cd) before being accepted.
wvlad
Fast Inserter
Fast Inserter
Posts: 217
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by wvlad »

eradicator wrote:
wvlad wrote:+1 for brighter version, I use SweetFx (beside factorio.exe)
Looks oversharpened on those pictures, but otherwise ok.
Mind replacing that link by a link to the official page? Not everyone likes downloading from some dubious private link.
I had to download it from another private link so... ;) Just check it with antivirus.
Caine
Fast Inserter
Fast Inserter
Posts: 213
Joined: Sun Dec 17, 2017 1:46 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Caine »

Moosfet wrote:I'm really at a loss to understand how anyone can think the original brightness is better, other than simply being in shock at seeing something different than what they're used to. I didn't start out with it that bright, but after I got used to my first smaller increase in brightness, it clearly needed even more than that. A 3x increase is where I ended up in the end.
As you say, you did not start out that bright yourself. Your eye adapts. The brightness in your pictures actually hurts my eyes. Even if they did not, I cannot believe that you think they actually look any good. On my displays I have brightness set fairly low and I utilise f.lux to soften the colours at the edges of the day.
The game is just too dark. It's an indisputable fact.
The game is on the darker side according to the histogram. Is that too dark? Well, that is an opinion. You can use to same histogram to argue that it is too dark at night. Brightness during the day depends on weather conditions and position, distance and brightness of the planets star.

It is interesting that there are only a couple of people who have issues with the darker game. Any biologists around? Does brightness perception differ strongly between individuals?
User avatar
Aprillion
Inserter
Inserter
Posts: 34
Joined: Sun Apr 16, 2017 10:43 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Aprillion »

Moosfet wrote:Image
as clearly visible on the histogram, the whole range is used (few pixels on full black, few on full white - such as the lamp)

the average can be adjusted by gamma, so what is the fuss about? ¯\_(ツ)_/¯
in the brighter version, notice the decreased contrast between shadows vs. light sources (lamp, would be same for flames) + reflections (tree bark, metallic texture on accumulators)
producing a flatter (less 3D) impression (well, a real world sun washed scene looks flat too, but that is hardly pleasant to the human eye)
wvlad wrote:+1 for brighter version
Before: https://i.imgur.com/ZNyH38E.jpg
After: https://i.imgur.com/yCjtBLr.jpg
and this is a NIGHT scene (with night-vision) - could you even tell from the "after" image?!?

thank you for highlighting it for me, I didn't realize how well adjusted are the actual in-game graphics - it must have been a lot of work getting it this nice!!
Jap2.0
Smart Inserter
Smart Inserter
Posts: 2378
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Jap2.0 »

Also, just a note, in the Imgur post, you say, "It looks like it is about to rain."

You do realize that Factorio has clouds?
There are 10 types of people: those who get this joke and those who don't.
Moosfet
Long Handed Inserter
Long Handed Inserter
Posts: 71
Joined: Fri Jun 10, 2016 1:50 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by Moosfet »

To help out my friend, I wrote a Windows utility to brighten Factorio. Afterwards he told me "in your screenshots i didn't like it but here it i do." So maybe everyone just needs to see it in-game.

My Factorio Brightening Utility: http://www.ecstaticlyrics.com/secret/brighten.zip

You have to run it from an Administrator Command Prompt. If you just double-click it, all that will happen is Windows will claim to have protected your computer, and even if you click through that, it still won't do anything. You have to give it two numbers on the command line to tell it how much you want the game to be brightened.

Code: Select all

brighten.exe 3.0 0.25
The first number is the overall brightness adjustment factor, where 1.0 means to keep the original brightness, and 3.0 means to make it look like my screenshots. You can do anything in-between if you like, but I encourage you to try 3.0 first. The second number is the extra bonus that applies to darker colors more than brighter colors. If you don't like that effect then you might want to just change it to 0 since it isn't necessary.

To restore the original files (which you have to do before updating the game) run it like this:

Code: Select all

brighten.exe 0 0
Brightening the images takes 7.5 minutes on my computer, as it has to make back-ups of a gigabyte of images, then modify all of them and save the modifications. The restore process only takes like 30 seconds. Due to the way it is written, the restore should always work, even if the program was previously interrupted half-way through brightening or restoring, but if for some reason it doesn't, all of the back-ups are written alongside the original files, so you can always get things back like they were by deleting and reinstalling Factorio.
Jap2.0 wrote:Also, just a note, in the Imgur post, you say, "It looks like it is about to rain."
You do realize that Factorio has clouds?
Yes, but if your argument is that Factorio simply takes place on a planet where it is always about to rain, then may I suggest that we be able to craft always-on lights that are capable of bringing the game up to a light level suitable for human vision?

Also, WTF is with so many people suggesting that I adjust the gamma? Factorio does not have a gamma adjustment. Do I have to post a screenshot?

Image
...and besides, as I said before, this isn't a gamma problem. You could probably call it "contrast" as someone else did, which is usually what it ends up being called in T.V. settings menus, but it definitely isn't gamma.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by eradicator »

Moosfet wrote:You could probably call it "contrast" as someone else did, which is usually what it ends up being called in T.V. settings menus, but it definitely isn't gamma.
Well, your approach sounds pretty much like what is called "-contrast-stretch" in imagemagick, the effect would probably look something like this?
m2OxYhg.png
m2OxYhg.png (2.86 KiB) Viewed 7941 times
hreintke
Fast Inserter
Fast Inserter
Posts: 115
Joined: Mon Sep 04, 2017 6:52 pm
Contact:

Re: Factorio needs to be brighter (w/ images and source code)

Post by hreintke »

Nice utility, will use it as I agree with the darkness

Pitty that it does not effect the map screen
Post Reply

Return to “Ideas and Suggestions”