Home Technical Talk

Mirrored geometry/inverted UVs and Marmoset

polycounter lvl 12
Offline / Send Message
Zyth polycounter lvl 12
OK, noob question. I’m new to this whole process (maybe I should have started with an easier project) so bear with me. I’ve checked this forum and Google but I couldn’t quite find what I was looking for. My problem is that I have mirrored geometry that share UV space with its non-mirrored counterpart. The mirrored geometry’s UVs are inverted. Max displays all mirrored geometry properly. Marmoset does not. It only became noticeable to me when I added the specular map. As you can see there is weird specularity going on with all mirrored (inverted UVs) geometry:

R2D2_3dsMax01_zpse76dd0bc.jpg

R2D2_Marmoset001_zps509c0d2e.jpg

Is this dependent on the 3d app/game engine whether or not it can display mirrored UVs properly? Am I doing something incorrectly or that isn’t standard practice? Do I need to provide unique UV coordinates for all mirrored geometry? For instance, I mirrored the left leg to the right. The right leg is sharing UV coordinates with the left leg but they are inverted. Do I need to provide unique UV coordinates for the right leg and mirror the UV coordinates so they are right side up? It would be a shame since I save texture space by sharing UVs.

Ideally I’d like to keep my UVs as they are but I’ll change them if what I’m doing isn’t standard practice or is not possible.

R2D2_LegUVs002_zps4e470ca9.jpg

I’m using version 1.10 of Marmoset.

Replies

  • Zyth
    Offline / Send Message
    Zyth polycounter lvl 12
    Just wanted to update this in case anyone else has this problem. If you mirror things properly (using the symmetry modifier) you won't have this problem.
  • Deadly Nightshade
    Offline / Send Message
    Deadly Nightshade polycounter lvl 10
    Common problem. Depending on what software you are using, there are different ways to solve this. You posted the solution to this for Max, so I'll cover the other base: Maya.

    Un-instancing and freezing geometry in Maya will cause the faces on that mesh(es) to point in the opposite direction of the normal. In the viewport, things usually don't look faulty, but when toggling face normals one will find out that they are inverted.

    Here you might think that you just select the faces and go to Normals > Reverse. Wrong! That doesn't solve the issue. The faces will still point in the opposite direction.

    So to bypass this somewhat annoying issue, I wrote this MEL-script (it works on instances objects as well):

    proc string[] getShapes(string $mesh[])
    {
    string $shapes[];
    $shapes = `listRelatives -fullPath -shapes $mesh`;

    return $shapes;
    }

    proc string getXform(string $shapes[])
    {
    string $xform;

    for ($obj in $shapes)
    {
    if ( "transform" != `nodeType $obj` )
    {
    string $parents[] = `listRelatives -fullPath -parent $obj`;
    $xform = $parents[0];
    }
    }
    return $xform;
    }

    ///////////////

    string $mesh[], $shapes[], $xform;

    // Un-instance
    convertInstanceToObject;

    // Freeze
    makeIdentity -apply true -t 1 -r 1 -s 1 -n 0;

    // Invert normals
    polyNormal -normalMode 0 -userNormalMode 0 -ch 1;

    // Get mesh name, then shape name, then transform node
    $mesh = `ls -sl`;
    $shapes = getShapes($mesh);
    $xform = getXform($shapes);

    // Turn off double sided, flip the face and turn on double sided again
    setAttr ($xform + ".doubleSided") 0;
    setAttr ($xform + ".opposite") 0;
    setAttr ($xform + ".doubleSided") 1;
  • MBauer17
    Offline / Send Message
    MBauer17 greentooth
    @Deadly Nightshade

    hey dude, I know this post as old AF but you just saved me so much headache. Thank you to your past self for this script.
Sign In or Register to comment.