Home Unity

Help with flipped/mirrored objects

polycounter lvl 10
Offline / Send Message
Chris Bruin polycounter lvl 10
So I've encountered a problem in Unity, and have been unable to find a fix for this. You would think it'd be pretty simple, but maybe not...

x6jSADo.png

On the left half of that structure, the scaling of the object is X=-1 Y=1 Z=1
The right half is scaled normally, X=1 Y=1 Z=1

The shading of the object basically falls apart when flipping it along an axis, and for using modular parts, this is a really big blocker for me.

The only thing I've found on this topic are something to do with the vertex winding order, but any script I've found online hasn't worked.

I've tried multiple things to try and fix this issue, and all of these look the exact same as the image above:

1. Create half of the house as small prefab pieces (each post as its own object), create a larger prefab containing all of the parts, then setting X=-1 to flip it

2. Create each chunk of the structure in Maya, combine the whole thing, and in Unity set X=-1

3. Create each chunk of the structure in Maya, flip it in Maya, combine the whole thing, freeze the transforms, ensure that the normals are pointing outwards, and view it in Unity

You can try this for yourself too, with a very simple asset. In Maya, create a sphere. Delete half of the sphere, export the object as a .fbx to Unity. Duplicate the sphere in Maya, set X=-1, freeze the transforms, make sure the face normals are pointing the right way, export to Unity as a .fbx, and place them side by side. This is the result:

pynHVLa.png

It boggles my mind that Unity has such a hard time with such a simple action. And I'm at a loss to figure this out, I've been looking for the past couple of days for a solution but I haven't found anything.

Is there a script, piece of code, or just some checkbox that I'm totally missing that will fix this problem? It doesn't necessarily have to be in the scene view, if this is something that can be fixed during runtime that will be good enough for my needs.

Replies

  • SlyRipper
    Offline / Send Message
    SlyRipper polycounter lvl 6
    It should be fine if you use modifiers from the program you use, something like symmetry or mirror functions, and merge the vertices that overlap. That way you have a mirrored texture but no shading problems. At least it works for me usually. That straight shading line you get there is quite logical as 2 objects have different shadings, and the overlapping or ending vertices have different normals as if they were merged together.
  •  Chris Bruin
    Offline / Send Message
    Chris Bruin polycounter lvl 10
    Part of the idea of keeping the pieces of the building separate was to have a very modular house. Combining the assets in Maya is a work around, but reduces the ability to have a very modular scene built directly in Unity. The beams of the houses are used in many other areas of the house, there are many shared assets to increase the modular aspect of the building.

    For example, on the side of the house I have a window panel that has beams, wood, floor, etc all as one prefab. I want to take that prefab, and flip it to the other side of the house, or even mirror it so that then you view it side by side, they look different. That isn't possible due to these shading errors due.

    So, basically, there is no fix to get it looking perfect?

    I found one solution (sorta), where I export the chunk of house as a .fbx with Tangents+Binormals turned off, and let Unity calculate those. It worked to an extent, there is a visible seam but it can be covered up with more assets. That's the closest I've gotten to resolving the issue, and even so there are still problems persisting in the model.
  • Farfarer
    Have you ensured that the normals along the seam are set up so that they'll point the same way when mirrored?
  • Elyaradine
    Offline / Send Message
    Elyaradine polycounter lvl 11
    Yeah... as Farfarer said, if you're exporting half a sphere, the normals along the split won't be pointing in quite the same direction that they were before the split, so you're going to have a lighting seam there.

    Does it happen with a subdivided cube too?
Sign In or Register to comment.