• Off-topic
  • Question about sharpening up textures in XNA.

Hello, firstly well done on creating such an awesome tool, it works like a charm! I wasn't sure where to pose this question so feel free to move it to another part of the forum.

I've been getting some slightly blurred results on certain images, changing the settings to not be linear and to use better sampling in the tool itself results in the images looking crisp as I would like however when the exported data reaches XNA it reverts back to being a little blurred.

The exported atlas is crisp so I was wondering if there is any way in XNA to improve the sampling to match that of the tool's? Also how do the "Runtime Settings" in the export atlas settings affect things?

Interestingly enough if I change the image from 18x45 to a square one (45x45) it seems to sharpen it up, are there any best practises I should be aware of to get the best results?

I've attached an example of what happens.
A. Is the blurred version in the tool using linear sampling.
B. Is the same texture with linear sampling turned off (and what I see when I convert to a square).
C. Is how the actual image looks itself (the atlas version also looks this way).

Cheers!

Alex

Related Discussions
...

Awesome, that is exactly what I needed. Thanks for that!

Out of genuine interest what do the Runtime Settings affect? Are those settings ignored by some run-times?

Oh, sorry I forgot to answer that. Most runtimes don't use those, AFAIK only libgdx does. The data is in atlas and loaded, runtimes could use it if they wanted. Stuff like wrap mode is more useful for general atlas usage, not for Spine.

Ok, that makes sense. I can pretty much ignore those settings then, cheers Nate.

You probably don't really want point filtering. Nearest-neighbor looks terrible in motion. Some blurring is to be expected, because blending is required if you draw at non-integer positions, or use rotation or scaling.

For example, look at the tentacle tree here. You can see how terrible it looks in point filtering. (Also, how awesome is a tentacle tree? My wife/artist is awesome.)
Linear:
https://dl.dropboxusercontent.com/u/959 ... /trees.png
Point:
https://dl.dropboxusercontent.com/u/959 ... _point.png

You mention twice that if the texture is a square that it looks better. I wonder if that's part of the problem. Are you using the texture packer built into Spine? If so, make sure you're using the options to pad to pow2 and square, and see how that looks.

I expected a little blurring yeah but the strange thing is that some images are noticeably more blurred than others when there is no rotation or scale being applied and positions are at whole integer values.

Your tree definitely looks much better with linear filtering however my stuff generally comes out better with the point filtering on at the moment so I'm very glad Nate was able to point that out to me. There are some slight artefacts on the arms when I rotate them but it's not too bad.

I am indeed using the texture packer built into Spine and have tried toggling the power of two and square options to check to see if this makes any difference, unfortunately it doesn't.

I don't think the issue lies with the texture atlas itself but rather the shape of the cropped texture, polygon and UV layout that's used when drawing the spine elements. It so far seems that by using a square aspect ratio source image this improves the linear filtering at run-time because the polygon being drawn is of a square aspect ratio, though I would need to conduct more research to make a concrete judgement on that.

I've attached an example to show how it ends up looking:

The first character is the art in Spine, as you can see the torso and head is slightly more blurred than the rest and doesn't sit too well, funnily enough the legs at that point are a square aspect ratio so they are sharper.

The second row of characters is in-game with linear filtering, the guy on the right looks tip top but the left ones legs and torso suffers from the blurring.

The final row is with point filtering, everything looks nice and sharp.