Sign in to follow this  
FictionJVR

XNA, weird behaviour in the corner of tiles

Recommended Posts

Okay, so I'm having this really annoying little bug, but altough it's small it's easily noticable and it gets even worse when I add a day/night cycle to the map, since then the little corners stand out like little lights.

This is a screenshot of the exact same tiles/tileset in c++ with SDL. (I copy'd the exact tileset over to be sure, and it stays the same).

As you can see, altough it could use some small tweaking, it looks allright, but this is mainly a programming exercise, so I can live with this result:
http://imageshack.us/photo/my-images/268/problem3x.png/

And this is a screenshot off the same tiles/tileset in C#/XNA.
http://imageshack.us/photo/my-images/810/problem2d.png/

As you can see, it's the bottomright corner's.

Zoomed in image:
http://imageshack.us/photo/my-images/607/problempd.png/
(I basicly just did a 1pixel gap between the tiles for visibility)

They are both equal in the rectangle they take from the tileset and the position they draw to the screen.


I have compared the tileset and the zoomed in version, and I thought maybe there was maybe a color there that XNA saw as a color to make transparant.
But the pixels are actually different shades of green.

I have used the tileset as png with transparancy around the tile, and the tileset without any transparancy at all, I used the original BMP version, doesnt make any different at all.

I used a spritebatch with all the different sorts of alphablends, tried it without any parameters at all, and it stays the same?

Any idea's on what could be causing this?

Share this post


Link to post
Share on other sites
Strange. You are using the exact same images for the tiles, right? It's not like you've got XNA linked to an older version of the tile image or something?

Share this post


Link to post
Share on other sites
yes, I even doublechecked just now.

I completely removed it, and added it again, same thing again (and yes I did update it with basicly the original correct version that hasn't been touched and works fine with sdl).
And then to be 200% sure I opened up the file in PS, drawed a + on one of the tiles, and it showed up as soon as I started debugging again.

Share this post


Link to post
Share on other sites
I'm still having trouble spotting what the difference is. I'm guessing it is something to do with texture filtering. When you say you tried all sorts of combinations of alpha blending, etc. did you try changing any of the texture filtering/wrapping settings?

If you've got a texture sampler state set up, try something like:

this.GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

(exact code will vary, depending on variable names, etc.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this