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

Fix blurry player skin #49

Merged
merged 1 commit into from
Jul 14, 2020
Merged

Fix blurry player skin #49

merged 1 commit into from
Jul 14, 2020

Conversation

saibotk
Copy link
Collaborator

@saibotk saibotk commented Jul 14, 2020

This commit fixes the weird blurry textures for player heads, as seen in #48

To fix the blurry images, we first need to set the requested width / height in the image constructor and also set the smoot parameter to false, which can only be set, when using the constructor.
As we just want a small part of the image (only the head), we need to scale the whole image by 16x, so that we can later extract the head with a resolution of 128 pixels, that will be scaled correctly (pixel-perfect, without smoothing).
The scaling without smoothing, seems to only work this way, as the "smooth" parameter cannot be set/changed when using another constructor/later.
Another option would be sampling the image with the PixelReader and creating a new Image with the PixelWriter by hand.

More information can be found here: https://stackoverflow.com/a/16092631

This commit fixes the weird blurry textures for player heads, as seen in #48

To fix the blurry images, we first need to set the requested width / height in the image constructor and also set the smoot parameter to false, which can only be set, when using the constructor. 
As we just want a small part of the image (only the head), we need to scale the whole image by 16x, so that we can later extract the head with a resolution of 128 pixels, that will be scaled correctly (pixel-perfect, without smoothing).
The scaling without smoothing, seems to only work this way, as the "smooth" parameter cannot be set/changed when using another constructor/later.
Another option would be sampling the image with the PixelReader and  creating a new Image with the PixelWriter by hand. 

More information can be found here: https://stackoverflow.com/a/16092631
@saibotk saibotk requested a review from piegamesde July 14, 2020 01:01
@saibotk saibotk linked an issue Jul 14, 2020 that may be closed by this pull request
@piegamesde piegamesde merged commit eec1499 into master Jul 14, 2020
@saibotk saibotk deleted the fix-blurry-player-texture branch August 4, 2020 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

blurry faces
2 participants