Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Problem: How to prevent fuzzy texture from image?

Discussion in 'General Graphics' started by Kobus, Jun 20, 2018.

  1. Kobus

    Kobus

    Joined:
    Mar 27, 2015
    Posts:
    48
    I am trying to model an object that rotates about a single axis. The object has angle scale markers on a strip around its circumference so that a person can rotate it to whatever angle is required (See Picture A on the attached file). I would like to have this scale marker strip also on my model in Unity.

    I thought it would be easier to create the markers as an image and then place it as a texture on the object strip in Unity, but it appears fuzzy and not as crisp as on the image.

    I created the strip in Paint.NET (see Picture B) and zoomed in it looks nice and crisp (Picture C). However after I dragged the image onto the object in Unity it looks a bit fuzzy (Picture D).

    Is there a better way of accomplishing this?
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,248
    What resolution is the texture in picture B?

    Textures for real time graphics generally need to be powers of 2 resolutions. That means 4, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192. I start at 4 as many texture formats can't be smaller than that. If your x or y resolutions are not one of those Unity's default behavior is to rescale it to the closest match. Also note that Unity defaults to clamping the max resolution dimension to 4096. You can choose to disable this rescaling, but that may also disable texture compression and still lead to unwanted blurring with mip maps.

    One issue with doing something like the above dial is the number of markers may not fit evenly on a power of two texture. The solution is to use the next larger resolution and leave part of the texture blank, then remap the UVs on your model. This might seam wasteful, but many GPUs handle non-power of two textures by internally addressing enough memory to fit the texture inside of a power of two texture anyway. Plus if you can get your texture to use a compressed format you'll save far more memory than using a slightly smaller odd resolution uncompressed texture.
     
    Last edited: Jun 21, 2018
  3. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,887
    Picture B would have to be way higher resolution unless you disable mipmaps from the texture asset settings, and change to Point filtering from Bilinear.

    If you want it higher res, then you would have to split them onto multiple layers, instead of one long strip. Then use UV mapping.
     
  4. Kobus

    Kobus

    Joined:
    Mar 27, 2015
    Posts:
    48
    Thank you. Yes, I forgot about the power of 2 resolutions. I shall try to do it again and see how it looks.
     
  5. Kobus

    Kobus

    Joined:
    Mar 27, 2015
    Posts:
    48
    Thank you. I shall play with this and experiment more.