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

Mip levels changing on stretched mesh [Spine]

Discussion in 'General Graphics' started by Nosgoroth, Aug 12, 2015.

  1. Nosgoroth

    Nosgoroth

    Joined:
    Apr 12, 2014
    Posts:
    2
    This might be a bit of an esoteric issue, I don't know, please read it :(

    We're developing a 2D game using Spine for animation, with an artstyle that uses a lot of straight lines and animations with lots of rotations, which means that texture anti-aliasing is kind of a big concern for us. We managed to get somewhere satisfactory using custom mipmaps (nearest neighbour scaledown. yes. it makes sense here.) for the first two levels and then the default linear mipmaps that Unity generates further back. And we were happy. This happy:


    And then, disaster. Sort of.

    We also use Spine mesh deformation for some animations, and it turns out that sometimes, when we're happily deforming a texture, Unity changes its mip level, causing blurriness. Have a look at the following image:



    As you can see in that screenshot of the Unity scene up there, the deformed mesh has jumped mip levels and its true nature as a linear mipmap is showing: it's blurry and it's not aligning well. Blurry things are fine, we need them to hide aliasing, but when we have a section that's considerably more blurry than the rest, it jumps out. Have a look at the same thing with the Unity mipmap level viewing mode on. That red polygon is the thing.

    Do any of you have any idea of how we might be able to solve this? We tried asking in the Spine forums, but they weren't able to help us. I really don't know how to approach this.

    Thanks for reading!

    (BTW, this thing is called Twindergarten)
     
  2. emilmeiton

    emilmeiton

    Joined:
    Apr 8, 2014
    Posts:
    15
    Maybe make a custom shader (and thus applying your own control over mip maps)?
    I'm assuming you only need it to switch mip maps when zooming out or in? If so then this would definitely work.

    Otherwise maybe anisotropic mip mapping could work?.., I'm not sure how that stuff work exactly but I'm guessing it helps with avoiding blurring in all directions...
     
  3. Nosgoroth

    Nosgoroth

    Joined:
    Apr 12, 2014
    Posts:
    2
    Yes, I only need the mipmaps for zooming, perhaps that would work. I'll need to research shaders then! Thanks!

    Aniso does nothing for me, though, I'm afraid.
     
  4. emilmeiton

    emilmeiton

    Joined:
    Apr 8, 2014
    Posts:
    15
    ok, send me a pm if you need help with the shaders.., should be a relatively easy thing to do :)