Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
107 stars 83 forks source link

Nearest sampling - low quality - incorrect rendering in chrome #6447

Closed avishaymizrav closed 1 year ago

avishaymizrav commented 1 year ago

Problem description

Using nearest sampling with low quality fullscreen render incorrectly in Chrome v109.0.5414.120 (Firefox seems to work fine). Anther odd thing is that I get different line breaks when I run as a chrome app than in the browser.

Attach a .c3p

nearRenderBug.zip

Steps to reproduce

  1. Run layout and see result.

Observed result

Some lines are breaking.

Expected result

Lines render correctly.

More details

Affected browsers/platforms: Chrome

First affected release: r328

System details

View details PASTE HERE
avishaymizrav commented 1 year ago

In case it matters, I'm using a GeForce GTX 1060, drivers are up to date.

AshleyScirra commented 1 year ago

I can't see anything wrong on my system. Can you provide a screenshot of what you see (the observed result) and what you were expecting to see (the expected result)?

avishaymizrav commented 1 year ago

@AshleyScirra Sure here it is on chrome: nearBugChrome

And here on firefox: nearBugFirefox

avishaymizrav commented 1 year ago

P.S. In the editor window I don't get this bug, it only happens when previewing the layout.

AshleyScirra commented 1 year ago

I think it's just the fact you have letterbox scaling set in the project. That allows it to use fractional scale values, which can cause pixel art to resize badly. Does it work better if you use letterbox integer scale and resize the window large enough so it is rendering at least at 100%+ scale?

FWIW it's a long standing and documented fact that pixel art is not guaranteed to appear correctly unless you use nearest sampling, pixel rounding, and letterbox integer scale.

avishaymizrav commented 1 year ago

@AshleyScirra Yes, it happens with integer and also with inner and off modes! It does not happen in outer though. It renders the same no matter what size the window is, even in full screen. Pixel rounding also has no effect on each of the modes.

Isn't it weird that in firefox it doesn't happen? Is there anything different in the rendering there?

avishaymizrav commented 1 year ago

@AshleyScirra Another strange thing, if I shift crop all the frames, the breaks appears in other place, like so: nearBugChrome2

Then when I undo the crop, it changes again to this: nearBugChrome3

Then if I close the project (without saving) and open it again, it shows the same breaks as in the first capture I sent you.

avishaymizrav commented 1 year ago

@AshleyScirra Another strange thing I noticed, depending on where the sprite is located the breaks are different. If I leave the initial sprite in place without destroying it, it renders correctly, though the position is not on a round number 153.903171, 98.934741 If I round up the position to 154,99, it shows up broken again.

If I add a drag and drop behavior and move it around, it seems to always render correctly, no matter where I drop it.

It seems to mostly render incorrectly with round position numbers.

If I add pixel round and drag around, it is always broken.

AshleyScirra commented 1 year ago

With letterbox integer scale, nearest sampling, and pixel rounding enabled - the only settings that guarantee pixel-perfect rendering - it looks fine for me. I'm afraid there's not much we can do unless we can reproduce the problem. It might be a weird graphics driver issue or something... but I'm testing on a NVIDIA GeForce GTX 1070, which is a very similar GPU model to yours, so I suspect it uses the same driver. So basically I'm afraid I have no idea what might be going on here. Perhaps you could find a more reliable way to reproduce the problem? Please note this will only be investigated with letterbox integer scale, nearest sampling, and pixel rounding, as those are the only settings where pixel-perfect rendering is guaranteed.

image

avishaymizrav commented 1 year ago

@AshleyScirra Ha, I noticed the sprite X origin point was set to 67.5, I changed it to 67 and it renders fine in all fullscreen modes and without pixel rounding enabled and no matter where I position the sprites.

This solved the issue for me, I hope it can help you better understand what was going on.

AshleyScirra commented 1 year ago

I think that's just an issue with fractional rendering with pixel art then, so closing.