Jump to content

The infamous Linux lighting glitch, and a potential fix.


Recommended Posts

Hello, fellow duplicants !

Today, i would like to tell everyone about a glitch that has annoyed countless users running on non-windows operating systems.

You most likely saw it in screenshots, I'm of course talking about the inverted lighting issue !20210627153137_1.thumb.jpg.6fe665c005ad4c9ecc31f6721101acb7.jpg

Do you notice anything wrong ? Look closer. That's right: The Biome lighting is all wrong ! Oh noes !

20210627153215_1.thumb.jpg.05050b6c463b19b2c5244f90f30a06ef.jpg20210627153222_1.thumb.jpg.209458520f1a496bf804b18acd1f1461.jpg

Pink space and grey jungle, interesting !

 

For long, i thought that this glitch was completely random, but it turns out that it's not. Look closely at the three images, the colors and all lighting for that matter are all flipped along the Y axis ! The X axis is fine though.

Now that we know what the glitch is, why isn't this posted on the bug tracker ? Well, quite simply because i think that i found out what it is and how to fix it. This is more so of a discussion rather than a bug report. Here's something interesting : https://www.khronos.org/opengl/wiki/Common_Mistakes#y-axis

The Y axis under OpenGL (and Vulkan too) is "flipped" compared to other rendering libraries (Mainly DirectX). Now, i don't know much about the internals of ONI, so this might not be the issue, but it's a more than possible theory. I would love for technical players to correct me on that if I'm wrong.

But here's the fun part : If I'm correct about the issue coming from the rendering engine's coordinate system, we might have a way to fix it relatively easily. After looking at modding docs, it seems that it's possible to de-compile the game for personal use. I'll try to look into that myself and maybe make a mod or something that simply :

  • Check for the operating system the user is running on at startup
  • If it returns any Windows version or anything running DirectX : Do nothing
  • If it returns any Linux/Darwin OS or either Vulkan or OpenGL : invert all the lighting calculations on the Y axis

This doesn't sound that hard, but hey maybe there's a reason why it's not already implemented officially.

So yup ! That's it for my research for now. I'll probably come back either when I'm laughed at for being terribly wrong or when I'll be done learning Harmony to make that mod happen.

On that note, stay safe and have a pleasant day everyone !

Link to comment
Share on other sites

Just now, Coolthulhu said:

Unity even has a specific macro for whether Y axis is positive or negative on buffers. No need for specific directx/opengl/vulkan checks.

Now this just makes everything easier, thanks a bunch! If we don't get a bug fix with an update this makes such a mod so much easier to develop.

Link to comment
Share on other sites

  • Developer

Oxygen Not Included's rendering path is a little convoluted and it's easy to get turned around on which things need how much flipping where. The person who did the Linux and OSX ports used to sit next to me and I remember for a long time watching him try to play the game with large percentages of the world rendered upside-down. :) Often they'd go back to being upside down as he found another place in the code that it looked like it needed to be flipped in, and accidentally flipped it too many times. :) 

When the team get a chance to look at this there's notes on what the cause is, but as I said it can be a bit of a hunt to find the right spot to flip sometimes.

Link to comment
Share on other sites

27 minutes ago, nome said:

When the team get a chance to look at this there's notes on what the cause is, but as I said it can be a bit of a hunt to find the right spot to flip sometimes.

"Lit tile" modifier/overlay:

In base, regolith "spikes" are more visible, but in DLC, smaller maps make it easier to notice that the weird "bottom backlight" mirrors the light blocking tiles on top of the map.

Link to comment
Share on other sites

1 hour ago, Coolthulhu said:

In base, regolith "spikes" are more visible, but in DLC, smaller maps make it easier to notice that the weird "bottom backlight" mirrors the light blocking tiles on top of the map.

Shh! I wanted to believe it was the light emitting effect of magma. Unsee juice does not restore innocence.

Link to comment
Share on other sites

10 hours ago, nome said:

When the team get a chance to look at this there's notes on what the cause is, but as I said it can be a bit of a hunt to find the right spot to flip sometimes.

It looks like we should be happy we got a Linux/OSX port in the first place then, haha !

I'll do my best to mess arround with the code, i may find something to do but i'm just another amateur in a bedroom afterall. Cheers and thanks on the work put into the game !

Link to comment
Share on other sites

55 minutes ago, klei.ruby said:

Dropping by to mention that we're testing a fix on this end.

Ahh i was gonna make a note on the bug tracker with what i found but i suppose i'll wait and see :).

For comparison, what i changed was inverting two textures:

  • SubworldZoneRenderData.colourTex a.k.a. _WorldZoneTex, which although correct is applied upside down resulting in the biome tint weirdness
  • PropertyTextures.externallyUpdatedTextures[Property.ExposedToSunlight] which is also correct but applied upside down resulting in the sunlight-at-the-bottom-of-the-world weirdness

The ExposedToSunlight one also appears to have fixed the "permanent crazy flickering after reloading once" issue.

Link to comment
Share on other sites

Mods sort of fixing the issue until a proper fix gets released:

Linux Sunlight Fix

No Zone Tint

Fixing the biome tinting via mod actually causes another tint-related problem (either buildings and debris will tint correctly or tiles will tint correctly but not both). So the second mod just removes the biome tinting effect entirely. Well it's not really a fix but everything looks good so i call it a win.

The sunlight fix one actually is a fix, and as it turns out also fixes the permanent crazy flickering you get after reloading the game once.

Link to comment
Share on other sites

On 9/16/2021 at 7:40 AM, klei.ruby said:

Try this update and let us know how it goes!

 

 

The sunlight looks great :)

I'm still having some weirdness with buildable tiles. Bug report filed here. Buildings, background tiles, debris, and most importantly natural tiles all look good!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...