Page 1 of 1

Pixels of the weapon sprite being distorted during movement

Posted: Sat Jul 21, 2018 9:06 pm
by Sinael
in GZDoom with texture filtering turned off, whenever a weapon sprite moves on screen its pixels become inconsistent in size, and instead constantly resize and realign, as if sprite image is being resampled differently every frame. This results in "wobbliness", "distortion waves" and other nasty effects. They are generally miniscule, but are far more noticable on larger sprites, however when you do notice it, you can not "unnotice it" again, kinda like "you are now aware you are breathing" thing (sorry by the way).

It is most noticeable in high resolutions (like 1600x900), but same effect happens at lower resolutions as well. Also much less pronounced in software, the slight "distortion wave" can still be seen.

I'm not sure how to explain it better, so here's some comparison videos. Videos have been taken from 1600x900 footage, cropped to the gun (BFG in this case) then doubled in resolution with integer scaling to make the matter more clearly visible.

This is how it looks in glBoom+ (no distortions): https://my.mixtape.moe/yljwuu.webm

This is GZDoom software mode (distortions most visible in the horizontal lines): https://my.mixtape.moe/bgirpo.webm

This is GZDoom OpenGL mode (distortions allover the place) https://my.mixtape.moe/spgehb.webm

This happens at any resolution.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Jul 29, 2018 2:55 am
by _mental_
Links to videos are broken, got '404 Fire not found!' on all of them.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Tue Jul 31, 2018 8:47 am
by wildweasel
The links seem to work fine for me.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Fri Nov 01, 2019 9:49 am
by phantombeta
Not a bug as far as I know. This is an unfortunate artifact of non-integer nearest-neighbour scaling and movement.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Fri Nov 01, 2019 1:19 pm
by Enjay
_mental_ wrote:Links to videos are broken, got '404 Fire not found!' on all of them.
It could be because the website security certificate is expired. Firefox blocks it with a message saying as much.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 1:54 pm
by sinisterseed
phantombeta wrote:Not a bug as far as I know. This is an unfortunate artifact of non-integer nearest-neighbour scaling and movement.
Bumping this up since I wanted to post about this as well, but I remembered this topic exists already.

I've recently noticed the same issue (playing in 1080p, though I don't think it actually matters), and indeed, it is one of those things that you can't unsee once you've noticed them. I'm no programmer, so in this case, could you explain why this would be the case? GZDoom is virtually the only port I'm using that exhibits this behavior - Choco, Crispy, PrBoom, Eternity, none of them appear to suffer from this.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 2:20 pm
by phantombeta
lowskill. wrote:I've recently noticed the same issue (playing in 1080p, though I don't think it actually matters), and indeed, it is one of those things that you can't unsee once you've noticed them. I'm no programmer, so in this case, could you explain why this would be the case? GZDoom is virtually the only port I'm using that exhibits this behavior - Choco, Crispy, PrBoom, Eternity, none of them appear to suffer from this.
As far as I know, those are all software-rendered ports. Vanilla Doom's software renderer can't really exhibit this behaviour as far as I know. GZDoom draws screen elements (the statusbar, weapon, menus, etc.) with the selected backend, and it does nearest neighbour resizing at non-integer scales instead of trying to force it to integer scales.
GZDoom also has interpolation for the weapon bobbing (and weapon/PSprite offsets) with non-integer coordinates, which also causes this issue.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 2:41 pm
by sinisterseed
phantombeta wrote:
lowskill. wrote:I've recently noticed the same issue (playing in 1080p, though I don't think it actually matters), and indeed, it is one of those things that you can't unsee once you've noticed them. I'm no programmer, so in this case, could you explain why this would be the case? GZDoom is virtually the only port I'm using that exhibits this behavior - Choco, Crispy, PrBoom, Eternity, none of them appear to suffer from this.
As far as I know, those are all software-rendered ports. Vanilla Doom's software renderer can't really exhibit this behaviour as far as I know. GZDoom draws screen elements (the statusbar, weapon, menus, etc.) with the selected backend, and it does nearest neighbour resizing at non-integer scales instead of trying to force it to integer scales.
GZDoom also has interpolation for the weapon bobbing (and weapon/PSprite offsets) with non-integer coordinates, which also causes this issue.
PrBoom isn't, it also has a GL 2.1 renderer, and the issue isn't present there either.

It looks like GZDoom is kind of the odd one here with this unique anomaly.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 3:38 pm
by Redneckerz
lowskill. wrote: PrBoom isn't, it also has a GL 2.1 renderer, and the issue isn't present there either.

It looks like GZDoom is kind of the odd one here with this unique anomaly.
''Stop right there, criminal scum! You have violated the law.'' :wink:

I kid, i kid. But since you bumped this topic, there is some information needed.
  • What version of GZDoom are you using?
    Do you have any mods/wads/pk3's loaded up?
    When does this incident most often occur?
Lastly:
Can you post a CFG as to how your GZDoom is configured? This will help with the maintainers and contributors of GZDoom to determine your issue.

This is assuming you know how to post a CFG. If not, then a Community Guide member may help you out with this.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 3:44 pm
by Graf Zahl
The issue is known, the cause for the issue is known, the main problem is that making the needed change may cause secondary issues.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 3:47 pm
by sinisterseed
Graf Zahl wrote:The issue is known, the cause for the issue is known, the main problem is that making the needed change may cause secondary issues.
I'm interested.

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 3:52 pm
by phantombeta
lowskill. wrote:PrBoom isn't, it also has a GL 2.1 renderer, and the issue isn't present there either.
It looks like GZDoom is kind of the odd one here with this unique anomaly.
No, PrBoom isn't. GlBoom is. GlBoom also seems to not be using non-integer coordinates, which would mean it wouldn't get the artifacts GZDoom does.
However, you can see artifacts from non-integer upscaling. Take a look at this screenshot of the pistol:
Image
Notice how the upscaled pixels aren't all the same size - that's an artifact of nearest-neighbour upscaling at non-integer scales.

There's also a pretty easy solution for anyone with a decent amount of VRAM - if you enable NormalNx upscaling at >= 3 and set filtering to (bi/tri)linear, you won't get these artifacts. This is what I do, and the game looks just fine:

Re: Pixels of the weapon sprite being distorted during movem

Posted: Sun Dec 29, 2019 4:01 pm
by sinisterseed
phantombeta wrote:
lowskill. wrote:PrBoom isn't, it also has a GL 2.1 renderer, and the issue isn't present there either.
It looks like GZDoom is kind of the odd one here with this unique anomaly.
No, PrBoom isn't. GlBoom is. GlBoom also seems to not be using non-integer coordinates, which would mean it wouldn't get the artifacts GZDoom does.
However, you can see artifacts from non-integer upscaling. Take a look at this screenshot of the pistol:

Notice how the upscaled pixels aren't all the same size - that's an artifact of nearest-neighbour upscaling at non-integer scales.

There's also a pretty easy solution for anyone with a decent amount of VRAM - if you enable NormalNx upscaling at >= 3 and set filtering to (bi/tri)linear, you won't get these artifacts. This is what I do, and the game looks just fine
That's what I meant, should've been more clear I guess (although I think you can change the render in both executables, not just glboom, but whatever).

That's an interesting artifact to be honest, but it's hard to notice (needs some eagle eyes). This however isn't, once spotted, the warping becomes somewhat hard to ignore (even if I focus on something else on the screen I can still see them warping with the corner of my eye).