- Home /
Blurry Texture at large size.
Hey all,
I'm looking for a hand by any of you artistic types. I'm currently working on an In-Game Store and have mocked up nearly all of my menus, buttons, and textures in Photoshop prior to bringing into Unity.
The display I'm creating in based off of my desired screen size of 1920x1080, but the actual menu I'm creating has dimensions of 1700x1200. Obviously it's a fairly large image, and when created in Photoshop it looks really crisp and clean. However when I import into Unity I can't seem to keep the image from blurring. The borders blur into the fill, and the test looks like it drawn by a three year old.
I'm using an orthographic camera to render my HUD/UI elements so the depth should be an issue(is think), and I've tried nearly every setting available for the texture after importing it.
Is there a best practice when importing larger textures in order to mimic the quality of your texture from Photoshop.
Any help is really appreciated. Cheers!
maybe it is the fileformat you save in PhotoShop, jpg gets compressed automatically, choose png it is loseless.
Answer by Wolfram · May 25, 2011 at 02:28 PM
The magic keyword here is mipmapping.
Mipmapping increases smoothness and decreases aliasing artifacts if a texture is rendered at a smaller size than its actual pixel resolution. However, even if displayed exactly at pixel resolution, it will introduce some amount of blurryness in Unity. In addition, several parameters influence how a mipmapped texture appears on the screen.
Essentially, you have two options:
To achieve a crisp rendering of your texture, set the Texture Type to "Advanced", disable MipMapping, and disable non-power-of-two scaling (otherwise you will introduce another level of blurring due to rescaling). The disadvantage is, you'll get aliasing artifacts, if you zoom out.
To achieve a smooth display of your texture at any viewing distance, enable mipmapping, use "ToNearest" power-of-two scaling (sometimes even "ToLarger" might be better), and set the Filter Mode to "Trilinear" (This is important! Otherwise MipMap interpolation will not work). The disadvantage is some level of blurryness in your texture rendering.
Note also that for certain types of textures, DXT-compression creates heavy artifacts, so you can try to set the Texture Format to "Automatic Truecolor" and see if that increases the readability of your text.
Obviously, you should increas the Max Size to at least 2048, if your texture width is 1700.
EDIT: further Info for Unity >=4.x: In Unity 3.5 it is IMPOSSIBLE to get a 1:1 texture representation for non-power-of-two (NPOT) textures, since Unity is internally unavoidably rescaling to POT (The only exception: objects of type "GUITexture" (and possibly OnGUI()). Your only chance is to "pad" your textures with a transparent border, so that the texture will already be POT.
This "bug" was fixed in Unity 4.x, so here you CAN get truly 1:1 pixel-exact rendering for your screen-aligned textures, providing your screenspace placement (scaling and positining) is correct:
NOTE for orthographic cameras, you can adjust your objects in a pixel coordinate system if you create an empty GameObject, reset the transform, and set its scale to 2*(ortho size)/(target screen resolution height). Then add another GameObject to that, reset its transform, and shift it by 0.5/0.5 (i.e., half a pixel). This offset is essential due to an intrinsic pixel/texel/camera offset.
Any object attached to that 2nd GameObject (and aligned to the camera plane) is placed and sized in pixel space. Note you should only use integer coordinates or set the texture filtering to Point, otherwise it will once again be blurred.
Worked very well for me. Truly, mipmapping was the magic keyword.
whoa, all i needed to do was increase the max size. wasn't obvious to me! :p
Answer by AngryOldMan · Apr 19, 2011 at 01:53 AM
what size is your image? have you checked the texture settings? such as texture size and power of two settings in advanced settings?
Edit
have you tried switching off the power of two settings all together as well as switching of mip mapping, turning up aniso level and changing the wrapping settings.
If that doesnt work then I suggest using a texture that is already a power of two such as 2048x512
or
sizing your picture to be of the full screen size then draw your HUD where you want it to appear on screen and delete everything else on it, save it as a png and set it on the HUD to be full screen size.
or
sizing your GUI to be the same size as your picture (1700x600)
1700x600.
I have played around in the texture setting for a fair amount of time. I've made sure that the texture size isn't getting scaled down (is at a max potentila higher than it's size), and also tried using the power of two settings to no avail.