iKest

Wrong render sprite from spritesheet if x,y is not an integer

Recommended Posts

The position of a sprite will make no difference to the frame being rendered. What the above looks like is just standard canvas anti-aliasing because you're using sub-pixel values, so it interpolates the pixels for you, producing those nasty side-effects.

The solution? Round your pixels.

Share this post


Link to post
Share on other sites

Thx for explanation. Rounding course is the most obvious solution. It's just not very easy if you dinamically creating a lot of sprites. And where better to do rounding, in update, prerender of render?

Share this post


Link to post
Share on other sites

During motion it doesn't matter so much, it's when it comes to a stop you will notice it.

The renderer has a roundPixels flag, which will round most (but not all) things for you automatically. You can enable it with:

game.renderer.renderSession.roundPixels = true;

 

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.