Page 1 of 1

[0.15.x] Weird line artifacts in radar-world view

Posted: Sat May 20, 2017 11:36 pm
by r0mai
The lines are stationary, but they have the same "vibrating" effect as the rest of the radar screen.

It does not happen in non radar-world views.
It looks the same with and without vsync enabled.
The lines have been there since the first 0.15 release.

Spec:
OS: OS X 10.11.6
GPU: Intel Iris Pro 1536 MB

This is how it looks like (zoom in for better views):
Image

Graphics settings:
Image

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sun May 21, 2017 1:50 am
by Aeternus
Turn off "wait for vsync" and try again? Looks like the grain overlay is causing this.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sun May 21, 2017 11:34 am
by r0mai
Yes, that was my first guess too, but:
r0mai wrote: [...]
It looks the same with and without vsync enabled.
[...]

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Thu Jun 08, 2017 8:15 pm
by Harkonnen
We use this function for radar-view noise
return frac(sin(a * 12.9898 + b) * 43758.5453);

So I'd guess it is low precision 'sin' implementation inside Intel Iris or maybe bad tolerance for argument wrapped around 2*pi many times. Do those lines stay at the same place relatively to monitor edges when you scroll?

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Thu Jun 08, 2017 8:24 pm
by r0mai
yes, they stay at the same place relative to the monitor edges regardless of where I move or zoom the camera.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Thu Jun 08, 2017 8:49 pm
by r0mai
If that helps, I'm happy to compile and run some C++ code, to aid debugging this GPU.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Thu Jun 08, 2017 10:31 pm
by Harkonnen
You can play with Factorio/data/core/graphics/shaders/zoom-to-world.glsl

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Thu Jun 08, 2017 11:47 pm
by r0mai
I played with it a bit. I reproduced the problem on a constant color background and timer uniform's value hardcoded. I used the following noise function:

Code: Select all

vec3 getnoise3(vec2 p)
{
  return vec3(
    0.0,
    fract(sin(p.x + 50.0) * 10.0),
    0.0
  );
}
The issue is clearly visible, if you increase the 50.0 constant to let's say 50000000.0 (at least on my GPU).

In other words it only happens if timer value is too large (in the millions range). A quick workaround could be to reduce the domain to let's say [0, 50000]:

Code: Select all

vec3 getnoise3(vec2 p)
{
  return vec3(hash3(p.x, p.y, floor(mod(timer, 50000.0) / 3.)));
}
I hope this helps.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sat Jun 10, 2017 12:09 pm
by Harkonnen
Thanks, we'll check that :) Sorry for late reply with important thing, you can also start factorio with "--shader=runtime-reload" parameter - this way shaders will be reloaded with every frame, no need to restart the game. Though with directx version it will reload .cso, so you will have to run compile.bat after every attempt, or work directly with glsl version - it's reloaded by game from source without any intemediates. I.e. edit .glsl - hit Ctrl-S (or command-S probably in Mac), immediately see result. For that in case of windows start factorio with "--force-opengl" key, in case of mac/linux it's opengl anyway.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sat Jun 10, 2017 12:43 pm
by Harkonnen
I couldn't reproduce those lines in my GTX570M, but issue is clear - you had that being long into the game (big tick count) while I tested from the start. So if Intel decided to use half-precision for floats or something, that would lead to this kind of problems.

What if you use original shader code with a single change of

Code: Select all

return vec3(hash3(p.x, p.y, floor(mod(timer, 50000.0) / 3.)));
for noise function? if that solves the problem - we will put it this way into next release.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sat Jun 10, 2017 1:26 pm
by r0mai
Oh --shader=runtime-reload is good to know :)

What is timer equal to? Number of ticks since map start? Indeed the lines don't appear on a newly generated map.

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sat Jun 10, 2017 2:11 pm
by Harkonnen
Yes, looks like a tick number (actually posila wrote this code)

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sun Jun 18, 2017 6:58 am
by Harkonnen
Should be fixed in 0.15.21

Re: [0.15.x] Weird line artifacts in radar-world view

Posted: Sat Jun 24, 2017 11:55 am
by r0mai
Thanks, I don't see the lines anymore!