Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Using mirrored mesh, UVs and texture on organic models

Discussion in 'General Discussion' started by janpec, Aug 9, 2011.

  1. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    I have one technical question about mirroring of organic models. I am aware that you can use mirrored model where you also mirror UVs and texture, which saves you half of UV space for texture. Now since models even organic are the same on both sides (except some characters), i am wondering why this technic isnt used in gaming industry in general?
    What are the hidden dissadvantages of using it?
     
  2. ChaosWWW

    ChaosWWW

    Joined:
    Nov 25, 2009
    Posts:
    471
    People do sometimes do this, when they don't it's usually for some reason like the fact that they want asymmetrical details which are almost always useful as anything organic usually has asymmetrical elements especially when you bring clothing into play. However, if you think that it's worth just mirroring it then you can do that.
     
  3. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    722
    Well, you would still have to have a full mesh when you import into a game engine.

    but that's not really what you meant...

    I think it would be kind of obvious if you had a mirrored texture and mesh on like a rock or something, and it looks unrealistic. For characters, you would want some textures to be different on both sides, to give it a realistic look. And also you can't very well animate a mirrored mesh, at least while its still a modifier and not applied.

    So in some cases, yes it would be a good idea to do this, but not for most objects in the scene.
     
  4. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Yeh rocks and other non-organic objects arent in my interest. Its pretty obvious that you shouldnt mirror rock, what i am more curious are some organic models except characters. For example horse would be first from top of my head.
     
  5. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    The big problem with mirrored UVs is that your normals on one side get inverted unless your engine/shader knows that the UVs are mirrored and accounts for that, or you can adjust the normals of the faces on one side to account for it.
     
  6. Schlumpfsack

    Schlumpfsack

    Joined:
    May 30, 2010
    Posts:
    608
    1. model one half of your character with the mirror modifier on
    2. unwrap one half of the character
    3. apply or collab the morror modifier
    4. put the mirrored UVs 0-1 out of the UV map
    5. bake normals and AO from your high poly (X-normal works pretty good to not getting seams )
    6. paint you texture like always
    and there are not really problems with normal maps if you bake it with x-normal and if you really have some problems just paint it out See here
    and have a look Here
    it is still common to use mirrored UVs. the body can be mirrored easily, if you want assymmetrical detail in the face just unwrap it full. good tutorial and example you can find here.

    i would really use this technic for mobile games and even for my standalone game (that will take another 50 years to be finished) i mirror UVs to save textures.
     
    Last edited: Aug 9, 2011
  7. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Oh ok good to know that there arent any issues about it. However i would suggest you easier pipeline:

    1.start with high poly model
    2.retopo low poly mesh, use symetry and then delete half of model
    3. unwrap it
    4.bake textures normaly without any issues (topogun preffered)
    5. mirror half of model in 3ds max with symetry modfier
     
  8. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    The first link you posted even says that that tutorial doesn't fix the lighting issues that arise due to the inverted normals, just how to smooth the transition. The second basically has you not normal map the mirrored portion at all by moving them out of the 0-1 UV area. The third link you posted doesn't talk about normals at all, just bumpmaps, which don't have the problem that normal maps have.

    I'm not saying that using mirrored UVs is bad. If you can get away with it, and don't require normal mapping, then it's a great way to save texture space. It's especially great for mobile platforms where you often won't use normal maps anyways, or where you don't need normal maps on the mirrored portion.

    This attached image demonstrates the problem. The left side is a normal map (applied as a diffuse texture to a plane) that is not mirrored. The right side is a normal map that is mirrored, applied to a plane with mirrored UVs. Because the normal map, unlike a bump map, encodes direction information, mirroring it will cause lighting calculations to be incorrect.
     

    Attached Files:

  9. Schlumpfsack

    Schlumpfsack

    Joined:
    May 30, 2010
    Posts:
    608
    yes...i start with the high poly model and retopo it, sorry i forgot that because i think it is standard these days :)

    i know that the lightning is of, but honestly: do you notice it really often? Even i don't notice it very often if i play games and many people don't even know that this problem exist ;)
     
  10. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Yeah, you can probably get away with it in many cases. But, I don't think you'd have to compromise. I haven't tested in Unity, but if the UV coordinates aren't translated to the 0-1 UV space in the shader, then you could place the mirrored objects in the 1-2 UV space and have the shader invert the relevant channel if it's in 1-2. Would probably have to deal with a seam down the center of your model, but you can fix that up using the techniques you linked to.

    Anyways, it's just something you should be aware of when using mirrored UVs, but not an insurmountable problem.
     
  11. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    @niosop I really cant see any difference in lighting on those normal maps o_O
     
  12. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    @niosop I can easily see the problem and it amazes me that people think they wouldn't notice it.

    A vertical line that sticks out, will become a vertical indentation, the exact opposite of what you want.
     
  13. Schlumpfsack

    Schlumpfsack

    Joined:
    May 30, 2010
    Posts:
    608
    no, your normals wouldn't be flipped if you do it right. don't bake you whole model only bake half of it and everything will be good.
    mirrored normal-maps are not the same as inverted normals or flipped UVs. i do it the whole time in a workflow with blender and x-normal (don't have 3d max on my private comp) but with 3d max it works the same.

    and did you saw those inverted stuff in games? it is just more work to fix but you get less textures and more detail. everyone has to think about it more work = optimization.
    noone says you have to do it that way, but it is possible.
     
    Last edited: Aug 10, 2011
  14. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    @ Schlumpfsack

    I've seen the problem in Ogre3D games.

    Getting the problem depends on how the shader interprets the normals when it samples them from the texture. If it can tell that the triangle is a flipped one based on the UVs of it's verticies being the wrong way round (so the triangle's normal pointing into the screen rather than out of the screen in texture space), then it can just invert the red channel of the sample and get a correct normal.

    I think this is how it's done in games to fix the problem.
     
  15. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Take a look at the second picture, middle 'M' shape. The red color on the inside of the 'M' indicates that the surface slopes inwards. So using the mirrored one would cause the left side to be raised from the surface, while the right side would be an indentation.

    I'll take a shot at modifying the default Bumped Diffuse shader to account for it and post that and a webplayer that demonstrates the problem.
     
  16. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Oh yea i noticed it now on left picture that colors are swaped. I would be very interested to see your webplayer.