Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question UV Area Error and Angle Error

Discussion in 'General Graphics' started by Wattosan, Aug 18, 2021.

  1. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    459
    Hello,

    I was reading the Unity docs about automatically generated mesh UVs and didn't quite understand what area error and angle error are used for?

    Descriptions for both start with "The maximum possible deviation of UV...". Why is there any deviation at all? Why would and how are the triangles in UV space different from the triangles in the original geometry? What does it mean?

    For both it's written how these should be used but I'd be interested in how these things work?

    Thanks!
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    UVs are the triangles and vertices of your mesh arranged in two dimensions.

    Imagine you have a basketball that you want to make it from a round object to a completely flat object.

    You take some scissors and cut it. Would you really be able to make the two pieces completely flat? Or would there be a lot of bulges, that aren't quite able to be flat and to get it somewhat flat, maybe you would have to pull it and stretch it etc.

    (here is an image with various ways of how to unwrap a sphere)

    upload_2021-8-18_14-35-51.jpeg

    So since distortion is a inherent to the process, every UV generation algorithm needs some leeway in how much they can distort the UVs compared to the original.

    I haven't used Unity's UV generation in years, but I'm assuming that if things go over the limits you set, it cuts the UVs in smaller pieces, so they can place them on the 2D plane with less distortion.

    (in the basketball example, imagine you cut the basketball in 50 small pieces, I think you can imagine you could get those be very flat with very minimal stretching, but cutting in small pieces is also bad so there has to be a balance).

    And now that I've said all that:

    DO NOT use Unity's Generate Lightmap UVs feature.

    When they introduced the feature 9 years ago, it was kinda outdated, and since then it has only minimally changed and in some ways it has become worse.

    It produces horrible and inefficient results while there have been multiple strides in the area from other software and open source project.

    It's a horrible feature, Unity should be embarrassed for having it (but I guess, to be able to sell Collaborate as a product, you must be unable to feel embarrassment).

    Here are the lightmap UVs in the HDRP sample project that Unity gives to users as an example.

    These are absolutely inefficient. Maybe Unity doesn't know what good UVs look like, which is why they are okay with the Generate Lightmap UVs feature.

    Just make your own UVs in whatever 3d software you use.
     
    Wattosan likes this.