Ludeon Forums

RimWorld => Bugs => Topic started by: balloon on February 17, 2017, 10:46:43 PM

Title: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: balloon on February 17, 2017, 10:46:43 PM
http://i.imgur.com/Wq9xezA.jpg (http://i.imgur.com/Wq9xezA.jpg)

How to replicate: Open RimWorld in a window, then (possibly?) load a save. Then simply leave the game in the background (ex. I opened Chrome on a different monitor and browsed for ~15mins) and do not interact with the game. Interacting with the game and making it the 'active' application returns the game into a normal state.

EDIT: fixed the buggy image.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: nccvoyager on February 17, 2017, 10:50:58 PM
For me, I often see rain building up until the screen is nothing but the UI and rain.
This seems to just be a quirk with the way Unity handles windows losing focus in this case.
Looks weird, but shouldn't cause anything other than temporary visual issues.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: Xav on February 18, 2017, 10:10:43 AM
+1 for experiencing the same event/result multiple times.

Activating the Rimworld window does force the colors to revert back to normal, though.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: Tynan on March 09, 2017, 04:42:11 PM
Possibly because the camera doesn't "clear" between frames? Usually it doesn't matter because the whole frame is redrawn but if it's not, as in some window-dragging cases, the colors seem to just get added on top of each other until they saturate.

Ison or Zorba should look at this.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: ison on March 13, 2017, 10:08:29 AM
It's because when the application is inactive then nothing is drawn, but for some reason the color correction curves filter is still applied every frame. And because our color correction curves make some colors a little bit brighter, they build up and eventually become saturated.

Not sure if there's any way to fix this. Maybe somehow detect when the application is inactive and disable the color correction curves filter?
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: ison on March 20, 2017, 06:04:32 AM
So I've tried to reproduce it to no avail. Are there any specific repro steps which always lead to this problem? Does anyone else experience similar issues?
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: nccvoyager on March 20, 2017, 07:42:51 PM
If I run RimWorld in windowed mode (or borderless windowed mode) then the rain will "stack" if RimWorld loses focus for any reason.
(Most common is clicking on something on my second monitor.)

I'm unsure if this is the same issue, a different issue, or a different issue that is related to the same cause.
(I say this since I never actually run into this issue with any other "filters" except rain.)

I'm running with a GTX 650 Ti BOOST in multiple-monitor performance mode, and with all global NVIDIA Control Panel options set to the high performance settings.
I also have the maximum pre-rendered frames set to 1.

(Video driver is probably a few months out of date, but I have noted this issue occurring over several driver versions, and several RimWorld release versions.)

Edit:
So, did a little poking at the game in order to test whether or not I could actually reproduce the issue reliably.
Here's what I came up with.

-Open two non-RimWorld windows. (Two notepad windows work well for the reproduction.)
-Run Rimworld in windowed or borderless windowed mode. (Easiest to reproduce in below-native-resolution windowed. D3D9 "exclusive" fullscreen does not allow visibility of the issue since the window minimizes when focus is lost.)
-Make sure that the RimWorld window is visible beside the other windows. (Make sure you can see the RimWorld window, really. Having it on a primary screen and other windows on a secondary screen works well for this.)
-Make sure "Run In Background" is disabled. (If run in background is enabled, nothing weird happens really, as the simulation continues as it should.)
-Load a game where it is raining, or force rain weather. (Other weather/conditions may result in the same behaviour, though I can guarantee I can reproduce the issue with rain.)
-Change focus to one non-RimWorld window.
From that window, change focus to another non-RimWorld window.
-Weird visual artifacts should now be occurring in the RimWorld window.
-Additional switches back and forth between non-RimWorld windows result in visual artifacts becoming more apparent.
-Switching focus to the RimWorld window will remove these artifacts.
-Moving non-RimWorld windows around will also add to these artifacts.

It should also be noted that this issue does not occur if the simulation is paused before clicking out of the RimWorld window.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: DariusWolfe on March 28, 2017, 01:34:37 PM
I saw this problem ALL the time when I was streaming Rimworld. If I needed to click over to my streaming software, or the chat window, any mouse movement once it had lost focus would cause the over-saturation issue. If I switched focus, but didn't move the mouse (say, if I just typed) then the over-saturation issue would not occur.

nccvoyager's setup steps seem to be about right, though I never specifically noticed any weather-related effects.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: nccvoyager on April 10, 2017, 04:44:25 PM
So, any other information required ison?
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: ison on May 05, 2017, 09:47:43 AM
Thanks for the info. I tried these repro steps but I couldn't reproduce the issue (I tried both the Steam version and stand-alone), so it seems that it depends on the GPU. I definitely remember it happening a while ago, but the inability to reproduce it makes it difficult to debug. Maybe Tynan or Zorba will be able to reproduce it.
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: ison on May 10, 2017, 09:36:49 AM
bump
Title: Re: Leaving RimWorld in windowed mode and in the background causes visual trippiness
Post by: Tynan on May 11, 2017, 03:45:34 PM
I've set the camera clear flag to fill the screen with solid color, which should solve this issue. It may change to a solid color, but it won't look all crazy.