pixies - sprites with zero filtering

Blitz3D Forums/Blitz3D Programming/pixies - sprites with zero filtering

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

His "magic trick" is twofold.

1. The sprite is at the same resolution as the size of the region it covers at a specific resolution. Ie, a 256x256 sprite covers a 256x256 pixel region, regardless of the screen resoltion. In other words, at higher resoltions, your HUD objects will be smaller.

2. He offsets the object by half a pixel towards the top left of the screen. The reason for this has to do with how bilinear filtering works. Unless you offset by half a pixel, then each pixel is actually displaying a point in the center of 4 pixels. So every pixel's getting averaged with the 4 colors that surround it. The result is that if you took a texture which is vertical or horizontal white and black lines, then unless you offset it like this, what you will actually see on the screen is a solid 50% gray square.

Of course there's one little problem with doing this, I think and that is that there may be a one pixel wide border outside your 640x480 region on the right and bottom of the screen. Though I have not actually tested this to see if that is what you get or not. I do know what if you offset towards the bottom right instea dof towards the upper left you get a border on the top and left sides of the screen.