Unity: Image resizing experimentsFeb-28-09, 5:22 pm by HanfordFile under: Video games, Unity, tech I've been creating all my object texture sheets at 1024 by 1024 and using Unity's Max Texture Size setting to reduce them in the game based on quality and memory. I think this is a great technique because it allows you to make quality and memory decisions interactively throughout the development of your project. It's a lot easier to find the smallest texture size that still looks good directly inside of Unity rather than having to bounce between shrinking-and-saving in Photoshop and checking it out in Unity. Beyond that, you can keep them all at 1024 by 1024 during development, then change settings based on your target download footprint for beta. But yesterday I noticed something with a text graphic (warning! programmer art). Here's the original on the model at 1024 by 1024:
Now here it is with with the Max Texture Size set to 256: ![]() This looks to me to fall below my smallest-size-while-still-looking good test, and normally what I'd do is kick it back up to 512. But the text itself looks pretty gnarly here, and it got me wondering: why is it really that bad? Is it the nature of 3d textures? is 256 by 256 really that nasty? I took the original 1024 image, resized it in Photoshop down to 256, saved it, and applied it to the model:
Not only is the Photoshop-scaled version significantly cleaner than the Unity-scaled one, it actually appears to be a higher-resolution. The Unity version does a better job at preserving the text's original color and brightness, and I think it may be doing this by applying a sharpen filter to it, but if that's the case, Unity's filter is too heavy and is unnecessarily pixelating the text. I can apply a sharpen filter in Photoshop with a bit more percision to help fix color brightness issues. I decided to see what Photoshop could do at the 128 by 128 level, to compare it to Unity's 256 by 256. Here's what Photoshop did:
To me this version is too low res to ship, but I'd take it over Unity's 256 by 256 scale. It's clearly at a lower resolution but it's not as jarring to the eye; it's still not as pixelated. ConclusionI will still be using Unity's Max Texture Size setting to adjust textures during pre-beta development as it's just too damn handy to do in-engine, but I'm going to be taking a closer look at their quality, and I plan on using Photoshop during an optimization round towards the end of beta cycles. I think it's fair to say that Photoshop scaling can get you smaller, better looking textures than Unity alone.(Note: I'm a new user to Unity, and I don't know if I'm using the Max Texture Size setting correctly, but regardless it would be ideal to be able to use it this way) Feedback - 5 responsesDisplayed newest to oldest. Leave a comment.inexpensive dental insurance braces wrote: 3 days ago, 6:41 pm That i enjoy reading such posts which give knowledge based information like this blog. Thank you sharing it around. wrote: Feb-3-10, 5:35 am hm, it's not a sharpening filter, but it seems with "Max Texture Size", Unity uses no sampling/interpolation (e.g., bilinear), but instead just point samples the texture when reducing its size, which is the reason why it looks ugly. unfortunately, I don't know whether Unity can be forced to do interpolation when scaling down textures, since I'm a Unity newbie, too :-/ (you should be able to reproduce this in Photoshop if you disable any filtering/sampling/interpolation/whatever-it's-called-in-photoshop when scaling your image there) (BetaComment) Gordon wrote: Mar-5-09, 4:49 pm Also check out whether Unity will compress your texture - which it only does when you make a build. This can throw you because it's been displaying a crisp texture throughout your testing, but then you get something smudgy and nasty in the build. PVRTC is particularly nasty in this regard... Yilmaz Kiymaz wrote: Feb-28-09, 6:03 pm Thanks for sharing this. Even thought I won't be using those settings any time soon, it's good to know such behaviors of a game engine when you intend to use it for a long time, which is true in my case. This also inspires me to do Unity tests that I can publish on my blog. Leave a commentComments are displayed on posts and visible to all site visitors. |
|
I make things. From consumer electronics, to video games, to theme park attractions. Perhaps I can make things for you! Check out my portfolio. When I'm not making things for other people, I'm usually experimenting.
Follow me on Twitter. Message me on Facebook. Email me using my contact form.
|
|
I usually enjoy reading such posts which provide knowledge based information such as this blog. Thank you for sharing it with us.