Home Technical Talk

How to fix UV distortion on low poly objects?

When working with low poly models I've found that they're prone to heavy distortion like in the image above, even though it's UV map is square and clean (IMO), simple objects like this distort heavily along where they're being triangulated. However when I subdivide the exact same model the UV map's distortion is fixed, I assume because of the extra polys? Why does this happen? and is there anyway I can fix this distortion without subdividing/increasing the polycount. Any help would be greatly appreciated! :)

Replies

  • gnoop
    Offline / Send Message
    gnoop polycounter
    only by adding extra vertexes  , one way or another .   By splitting UV  in  that middle section and unwrapping  in  more trapezoid way.   Or adding extra loops .   

    Or just doesn't put any vertical details in its texture . A perfect solution for mobile game.
  • RN
    Offline / Send Message
    RN sublime tool
    That face on the mesh is trapezoidal, its UV mapping is rectangular, so they're not the same.



    I don't know how to fix that, but a quick test that you can do is to align the view to that face (Shift + Numpad_7 on Blender 2.79), then U -> Project From View, and in the operator settings turn on 'Orthographic'. The mapping becomes perfect because now the mesh and UV have the same shape.


  • Noors
    Offline / Send Message
    Noors greentooth
    There's no way to "fix" that. The uv coordinates are linearly interpolated between the 3 vertices of each triangle (and meshes are only made of triangles under the hood). It's just structural. Either you make your uv's closer to the geometry shape with a relax for instance, or by splitting them (which would be less optimal for perfomances and texture seams). Real time CG is about compromises.
    Or you keep it this way, which is fine, with not much texture space wasted, paint in a 3d software, and don't bother about it. Just check that the softwares you use for painting/baking and final display are triangulating polygons the same way or you'll get issues. Hence it is advised to force the triangulation before exporting.
  • c0rn_fl4k3s
    Noors said:
    There's no way to "fix" that. The uv coordinates are linearly interpolated between the 3 vertices of each triangle (and meshes are only made of triangles under the hood). It's just structural. Either you make your uv's closer to the geometry shape with a relax for instance, or by splitting them (which would be less optimal for perfomances and texture seams). Real time CG is about compromises.
    Or you keep it this way, which is fine, with not much texture space wasted, paint in a 3d software, and don't bother about it. Just check that the softwares you use for painting/baking and final display are triangulating polygons the same way or you'll get issues. Hence it is advised to force the triangulation before exporting.
    thanks for the explanation :), and like you said I had to make compromises, in this case I had to create more vertical seams & not straighten them, sacrificing UV space and creating more seams which makes texturing harder, but at least it fixes distortion 
  • Noors
    Offline / Send Message
    Noors greentooth
    Ok, but just keep in mind that this creates more vertices (1 vertex can hold only 1 UV coordinate. UV split = new verts) and that a bit of distortion is fine (and most of the time unavoidable) , especially if you use a 3d painting/projection software. I would unfold it like your previous object, unless you have specific needs and you know what you're doing.
  • Klunk
    Offline / Send Message
    Klunk polycounter
    you can "fix" it by baking the distortion (or the correction for it) into the texture
    though it will look nasty !



    though the best easiest and quickest solution is to avoid textures that make the shearing in these situations look too obvious ie avoid checks ;) Things like low poly hair show up this kind of mapping issues a lot.

  • RN
    Offline / Send Message
    RN sublime tool
    Klunk said:
    you can "fix" it by baking the distortion (or the correction for it) into the texture
    though it will look nasty !
    That's actually genius @Klunk , once the asset is finished and everything's ready, you can use some shader to distort the texture so it looks correct on the mesh.
    I haven't thought much on how you would do that, something like:

    • Go through each texture pixel {
      • On this pixel {
        1. Find the triangle picked by the UV coordinates of the pixel (it's a point-in-polygon test in UV space).
        2. Project the mesh 3D triangle onto its own plane, giving a 2D triangle with the exact same shape.
        3. Using the same vertex order in both the UV triangle and this 3D-projected triangle, find the 2D transformation matrix (ref 1, ref 2) that maps from the UV triangle to the 3D-projected triangle.
        4. Sample the texture by transforming the pixel UV coordinates with that matrix and grabbing the color in whatever is that new location.
        }
      }
  • poopipe
    Offline / Send Message
    poopipe godlike master sticky
    You're effectively doing a projection bake from one set of UVs to another there - which isn't something you'd generally find done at runtime

    Even with some one time preprocessing (2nd uv generation and render to texture) your best case is doubling UV memory cost and doubling your texture reads,  


  • c0rn_fl4k3s
    Noors said:
    Ok, but just keep in mind that this creates more vertices (1 vertex can hold only 1 UV coordinate. UV split = new verts) and that a bit of distortion is fine (and most of the time unavoidable) , especially if you use a 3d painting/projection software. I would unfold it like your previous object, unless you have specific needs and you know what you're doing.
    Thanks for the suggestion! smart idea ;)
  • poopipe
    Offline / Send Message
    poopipe godlike master sticky
    splitting UVs really isn't a practical concern when you're dealing with low-poly objects on semi-modern hardware (as in post ps2) so I absolutely wouldn't let that stop me doing anything that made things look better. 

    I still wouldn't lay the object out like that unless was supposed to look faceted,  just chuck some more geometry at it
  • Noors
    Offline / Send Message
    Noors greentooth
    Yeah there's little resource impact, especially on such a low poly object but still, it could matter in the end for a mobile or mobile VR project. Maybe i'm getting old, but wasting resources for no gain feels a bit sloppy.
    The main issue with the seams here is that they could be visible with a small texture resolution + mipmaps leaking when you don't have aniso filtering for instance.
    Anyway, just don't add seams everywhere just to avoid a slight distorsion.
Sign In or Register to comment.