Bitmap RenderTarget Issue - 1px out

Feb 22, 2010 at 1:07 AM
Edited Feb 22, 2010 at 1:10 AM

Hi Bill,

I've noticed a problem that only ever occurs when using a bitmap rendertarget in Silversprite.  In certain cases the background texture in my game is one pixel out of position.

To recreate:  http://www.clarvalon.com/XAGE/games/Awakener/FB/  - once in-game, walk to the centre of the room by the cleric and switch between 'Medium' and 'High' quality settings.  The left half of the single background texture is out of position by one pixel on the x-axis (most noticeable by the lampost and the assassin's feet).  Oddly, when walking to the far left of the screen the texture resets itself to the correct position.

I'm pretty sure I've ruled out any problems with my game engine as this only occurs with silversprite bitmap rendertargets (Windows/Xbox implementations are fine, as are 'Low' and 'Medium' SL settings).  My engine only sends integer co-ordinates in the vectors for the SpriteBatch.Draw() calls, so I'm guessing it's not a rounding problem.  The problem also occurs regardless of the universal scaling applied.

Might this have to do with the bitmap rendering enhancements?  (your optimisations to only redraw parts of the screen that required it).

Coordinator
Mar 4, 2010 at 1:09 PM

Ok I think I've narrowed this down and was able to reproduce it. It has to do with position and width/height of what's being drawn not sitting on pixel boundaries. There is some work I can do to improve this, but in the meantime in your game if you make sure when you scroll the screen that you end up on an integer value for your scroll window and draw everything at integer positions it should look right. This will also reduce blurriness in "low quality" mode.