Sign in to follow this  

2D in 3D - Shaders to overcome pixel alignment?

This topic is 4098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I'm working on a 2D game engine (and have been for way too long) - I've always struggled with the issue of the sprite sheets bleeding extra pixels from their neighbours when the pixels don't properly align with the screen. I was wondering if rendering the sprites with a shader would improve this and I'm looking to get the thumbs up from someone who has already done it before I go about cutting up my rendering code. Thanks.

Share this post


Link to post
Share on other sites
I'm not entirely sure what your problem is, but it's _very_ unlikely that using shaders will fix it :P
Do you not have any spacing in your sprite-sheet?

Share this post


Link to post
Share on other sites
If the bleeding is from the edge of your texture, you could try enabling texture-clamping.
If it's from neighbouring sprites, a simple solution is to add a 1-pixel border on all sprites (and encompas for this in your uv-coords ofcourse).

Share this post


Link to post
Share on other sites
If you want to maintain a "pixel" look, you can simply disable bilinear filtering. This is great if you're not actually scaling your sprites as well (and faster on some older cards).

A shader wouldn't really help... anything it could do to help can be done with the fixed function pipeline.

Share this post


Link to post
Share on other sites
For those who are unclear on the problem:



I've managed to fix this by offsetting the final location of the sprite by 0.5 as suggested pretty much everywhere you look. I'd love an easier solution, if anyone has one. It's a lot of (trivial) extra calculations.

I'll try disabling bilinear filtering and remove the scaling.

Share this post


Link to post
Share on other sites

This topic is 4098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this