Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot Screen Pixel Jitter. #41814

Closed
ghost opened this issue Sep 6, 2020 · 5 comments · Fixed by #43194
Closed

Godot Screen Pixel Jitter. #41814

ghost opened this issue Sep 6, 2020 · 5 comments · Fixed by #43194

Comments

@ghost
Copy link

ghost commented Sep 6, 2020

Godot version:
Godot 3.2.2 stable, and Godot 4.0
GLES 2,3 Vulkan

OS/device including version:

Windows 10 1909 , GTX 1070, I5 , 1360x780 screen.

Issue description:

Pixels snap randomly and offest and scaling isn't smooth and jitter, also screen differnets can snap the pixels randomly.
as8
as9

Pixel snap has no effect at all.
nor making the values smaller in godot source code.

Steps to reproduce:
Simply try to scale a sprite very slowly and you see line of tearing visible.
or change the viewport size while looking at your sprites.

Minimal reproduction project:
jitter.zip

@Calinou
Copy link
Member

Calinou commented Sep 6, 2020

There is nothing that can be done about this with sprites that have filtering disabled. You must ensure that the scaling ratio is always an integer factor to avoid scaling artifacts. (At higher scale factors, this becomes less noticeable but the base problem remains.)

Duplicate of #6506.

@Calinou Calinou closed this as completed Sep 6, 2020
reduz added a commit to reduz/godot that referenced this issue Oct 30, 2020
-Rename pixel_snap to snap_2d_to_vertices
-Added snap_2d_to_transforms which is more useful

Fixes godotengine#41814
Solves proposal godotengine/godot-proposals#1666
Supersedes godotengine#35606, supersedes godotengine#41535, supersedes godotengine#41534
@akien-mga akien-mga added this to the 4.0 milestone Oct 30, 2020
@AttackButton
Copy link
Contributor

AttackButton commented Dec 12, 2020

I don't think this issue should be closed. Because in Godot version 3.2.4-beta-4 it is not fixed as stated in the #43194 description, even with pixel_snap enabled, this still happening.

Test using the op MRP with the pixel_snap option:

godot-jitter-screen-3 2 4-beta-4

@mortarroad
Copy link
Contributor

The jittering when sprites are scaled while using point sampling is inherent to the process.
However, it can be mitigated with some filtering, which will smoothly transition between neighboring pixels, while still keeping them pixelated.
I wrote a shader for that.

It should work as a drop in replacement.

Example:
jitter
Both sprites on the left are scaled by the same amount.
The bottom one has the new filter on it.

I hope this is useful to someone.
jitter.zip

@Zireael07
Copy link
Contributor

@mortarroad: It would be awesome if you posted this shader on either https://godotshaders.com/ or Godot Assetlib or the Godot subreddit, so that people could find it easier.

@mortarroad
Copy link
Contributor

Done: https://godotshaders.com/shader/sub-pixel-accurate-pixel-sprite-filtering/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants