Amitm Posted June 15, 2018 Share Posted June 15, 2018 Hi All, I have encountered a strange problem. I am creating two sprites from the same image. For one anchor is default 0 and for another it is set to 0.5,0.5. The sprite with anchor set to 0.5 looks blurry. For both the sprites x and y set to whole number. Now for the blurry sprite if I add .5 to both x and y position it looks sharp again. But my other images goes a bit blurry if I add 0.5 to x or y position. What might be the issue? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Exca Posted June 15, 2018 Share Posted June 15, 2018 Is the texture width or height an odd number? That would explain the situation. If that's the case then I know few ways to fix it. - Use pivot point with x:Math.round( width/2), y:Math.round(height/2) instead of anchor. - Calculate anchor point so that no half pixels are needed: x: Math.round(width/2)/width, y: Math.round(height/2)/height. Quote Link to comment Share on other sites More sharing options...
Amitm Posted June 15, 2018 Author Share Posted June 15, 2018 Hi Exca, The image is 800 x 1100. So that's not the reason. I have tried all different options and not able to find the root cause. Regards, Quote Link to comment Share on other sites More sharing options...
Exca Posted June 15, 2018 Share Posted June 15, 2018 If you get the bounds of the blurry one does it have any of the values with decimals? (card.getBounds()) Quote Link to comment Share on other sites More sharing options...
Amitm Posted June 15, 2018 Author Share Posted June 15, 2018 For the second image here are the values : Position :: x = 580 :: y = 258 :: bounds == {"x":386.5,"y":-0.5,"width":387,"height":517,"type":1} though x and y are in whole number the bound x and y are in decimal. How to fix this, any idea? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 15, 2018 Share Posted June 15, 2018 you are downscaling it more than 2 times. You should not do that, or you have to use mipmapping which enables by default for any texture that has power-of-two size. Quote Link to comment Share on other sites More sharing options...
Megabyte Posted June 24, 2018 Share Posted June 24, 2018 I faced same problem couple of days ago. It was odd texture's size. In your case too, regarding bounds you provided. Maybe any textures packer crops transparent fields and makes your image odd sized? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.