Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I wrote a Camera class that contains Matrix (for zooming and moving around). When I zoomed it with any zoom scale other than 1, some isometric grids becomes visible on each of my isometric tile.

//Camera.cs
//Producing the matrix from previously set Zoom and Location 
        public static void Update()
        {
            Transform =         Matrix.CreateTranslation(Location.X, Location.Y, 0) *
                                Matrix.CreateScale(Zoom,Zoom,1);
            InverseTransform =  Matrix.Invert(Transform);
        }






//Game.cs
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.InverseTransform);

                /* Some Drawing */

            spriteBatch.End();

PS: Actually, I really want these grids to be visible for zoom scale of 1.0f too. Having these grids make my game looks more like a tile-based game.

Before Zoom (Scale = 1.0f): enter image description here

After Zoom (Zooming in): enter image description here

After Zoom (Zooming out): enter image description here

Zooming very close (Grid line appears to be more than one pixels): enter image description here

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Could be aliasing, I mean that at some magnifications the sampling of the grid just happens to skip over the lines you want.

Is it possible to make your grid line thicker than one pixel?

share|improve this answer
    
I'll try anti-aliasing and see the result. For grid line thicker than one pixel, I am not sure about that, but it seems to be more than one pixel as I zoom in very close. –  user1542 May 13 '12 at 15:36
    
I see! The separating line isn't a line you're drawing but the gap between tiles. If you can move your tiles just a wee bit further apart that will do the same thing if my idea is correct, it will give you a wider line so that when rendering it doesn't get skipped. –  Patrick Hughes May 13 '12 at 15:37
    
I post a close zoom one, so can you try inspect it and give a comment on it. thanks. –  user1542 May 13 '12 at 15:41
    
I think I drew it such that there is no gap left over (on normal zooming, ofcourse) but I don't know if the transformation does anything to my setup. –  user1542 May 13 '12 at 15:43
1  
@user1542, When you start scaling textures up and down, they'll sample the colors around the pixels to know which color to use. This leads to the scaling sampling the transparent pixels you have around the actual tile. You can try and change the sampler to use something like LinearClamp or PointClamp. PointClamp will give you a more pixelized look, but it should take care of the problem. Either that, or you need to draw everything to a rendertarget and then up or down scale that rendertarget, that'll fix the issue as well. –  William 'MindWorX' Mariager May 13 '12 at 16:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.