-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Scaled centred sprites are skewed with pixel snap #60443
Comments
Have limited time today, but this seems to have been the behaviour back to at least 3.2, possibly since GPU snap was first added. I was kind of guessing that possibly the snap was being done before the scale was applied, but that doesn't seem to be the case in the shader (I may be missing something though). Anyone else that wants to look into this is welcome BTW. EDIT: Ah there is also a snap in the CPU code it looks like from #42985 . Maybe this issue should be closed as a duplicate? |
I think this shouldn't be there at all: Lines 102 to 104 in 3ba9803
GPU pixel snapping should be applied after all transformations are applied (so in the shader), there's no point to apply it locally ( r_dst_rect in Sprite::_get_rects is local). Transforms are applied later when drawing (by the VisualServer based on the CanvasItem passed to Texture::draw_rect_region ):Lines 118 to 133 in 3ba9803
|
Godot version
3.4.4
System information
Arch Linux
Issue description
Related #42985
quality/2d/use_pixel_snap=true
2d/snapping/use_gpu_pixel_snap=true
Import a 1x1 sprite
centred=true
scale=(1, 1)
As expected.
centred=true
scale=(32,32)
Is this intended behaviour? The sprite origin is on the bottom right of the sprite instead of the centre of the scaled sprite. I expected the 32x32 sprite to be centred, with sprite origin at it's centre i.e. the sprite should be centred after being scaled.
This issue does not happen with textures with even dimensions.
Steps to reproduce
N.A.
Minimal reproduction project
TestPixelSnap2.zip
The text was updated successfully, but these errors were encountered: