Sunday, November 13, 2005


Arrrrrrrrrg!

In my spare time I have (among other things) been trying to get a relativly small (at this point) isometric tile based map program running using Managed DirectX. And I got it working:



Until I started to try zooming in and out of the map. Then it looks like (with just a bit of zoom):



And I can not figure out how to get rid of those darn lines! Basically all I do is use a DirectX Sprite object to draw everything, tile by tile, and before I do any drawing I set up the transformation like so:
sprite.Transform = Matrix.RotationZ(0f) * Matrix.Scaling(viewZoom, viewZoom, 1.0f) * Matrix.Translation(0f);


And it almost works, but like we see in the pick I get those weirds lines around ever tile that I draw (I'm not even sure what to call them!). I have considered making an offscreen render target texture, then drawing to it and then finally updaing the screen with that (and doing the scaling there), but that is more complicated in a way since I can't create a texture big enough for doing zoom outs (zoom ins seem to be fine) and I might have to draw sections of the screen one at a time and then scale and draw them. I am not sure what else I can do...

Does anyone have any ideas as to what might be causing this? Or a way around it?

Comments:
That happens because the scaling algorithm doesn't take neighboring tiles into account, so it doesn't know how to seamlessly scale them. Perhaps you could render your tiles as quads and just move the camera in and out.
 
Thanks for your help, I did eventually figure it out :)
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?