Header image

ND2D – Pixel Bleeding

August 30th, 2011 | Posted by lars in Molehill / Stage3D | ND2D | OpenGL | Talk - (9 Comments)

This post is more a note to myself, but you might find that interesting.

There was a bug that was annoying me for a while in ND2D, but I didn’t had the time to fix it: When you use spritesheets and the sprites are packed without any space between them like this one:

It’s likely that you run into issues where the GPU is drawing the pixels of another sprite around your sprite. This looks like this then (The lower image is the fixed version):

If you use mip-mapping it get’s even worse, but that’s another story…

This happens, because OpenGL / DirectX needs to have the center of uv-coordinates on the pixel and not on the edge of the pixel. The solution is pretty simple: Instead of calculating the uv-coordinates from 0 to screenwidth, you’re technically supposed to calculate from 0.5 to screenwidth – 0.5. This way the edge pixels are “cropped” out and the bleeding stops :)

Operation successful, patient alive & breathing. Nurse, I need a drink, cheers!

iPhone App: FluidToy released

April 11th, 2010 | Posted by lars in Cocos2D | iPhone | OpenGL - (1 Comments)

Good news everyone. My first iPhone App got released to the AppStore: FluidToy, a little toy that turns your device into an interactive fluid simulation and helps you to relax ;). Enjoy: