Export Modified Normals to FBX for Unity?

Export Modified Normals to FBX for Unity?

acornbringer
Enthusiast Enthusiast
10,184 Views
37 Replies
Message 1 of 38

Export Modified Normals to FBX for Unity?

acornbringer
Enthusiast
Enthusiast

In order to have interchangeable elements on my character model for use in game, I have separated my single body mesh into parts. For example, the head has been extracted from the main body mesh so it can be replaced with different head models.

 

To match the vertex normals at the edged of each mesh, I took them and averaged them out so they point in the same direction. In Maya, the seam is completely hidden but when I export to .fbx and bring into Unity, the edge vertex normals change back and show the seam. (Check out the attachment for a visual of what I'm seeing) I've also noticed that importing the .fbx back into Maya yields the same result - the edge vertex normals are no longer averaged and show a seam.

 

Is there something I'm missing when exporting to .fbx? It seems like with the way I'm going about it now, the locked normals aren't being carried over.

 

I'd really appreciate any input on this! Thanks 🙂

 

LockedNormals.png

0 Likes
10,185 Views
37 Replies
Replies (37)
Message 21 of 38

acornbringer
Enthusiast
Enthusiast

@sean.heasley Sorry about the late reply! About the blend shapes not appearing, I had a similar issue from me bringing the mesh into the scene before changing the scale factor. It would just show as invisible for some odd reason. Might not be the same issue you were seeing but if it was, you just need to delete the one in the scene and create another one after changing the scale.

 

Aside from that, I just did a bunch of other options tests for exporting that someone suggested in the Unity forums. The tests didn't give me any more new information so I'm really thinking this is just that Unity issue and I'll need to find a workaround or rethink my workflow.

 

That thread is here if you were curious: Maya Locked Normals In Unity

 

Did you happen to find anything from your tests?

0 Likes
Message 22 of 38

sean.heasley
Alumni
Alumni

Hi @acornbringer

 

Yes! Sorry for the delayed response, was out of the office due to the Noreaseter that smashed Boston yesterday Smiley Tongue

 

So, I actually went ahead and exported everything you sent into UE4 instead of Unity and I didn't see any issues with seams or animation.

 

I'm still looking to see if I can get the blendshapes set up because I haven't done much UE4 work like this before.

 

Unfortunately however I believe this means this is an issue with Unity and therefore out of my hands Smiley Sad

 

 

Please let me know if this helps at all or if anything has changed on your side!

 

 

If one or more of these posts helped answer your question, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

 

Kudos are greatly appreciated. Everyone likes a thumbs up!

Message 23 of 38

acornbringer
Enthusiast
Enthusiast

@sean.heasley Thanks for trying it out in Unreal! Knowing it works in there and after all that testing, I'm pretty certain this all comes down to one of Unity's shortcomings and not something on Maya's side.

 

I appreciate the help and hope all is well up there in Boston! I'm no stranger to the New Englad weather so I know how wild it can be.

 

Take care 🙂

Message 24 of 38

Anonymous
Not applicable

Hi I'm getting exactly the same issues as you have. When I export Maya loses the edited Normals.
Don't you get the seam after you import the FBX back into maya?

And yeah, It only happens when I have blendShapes enabled. Specifically blendShapes that will also affect the seam.

neck Issue.jpg

0 Likes
Message 25 of 38

acornbringer
Enthusiast
Enthusiast

Hi @Anonymous

 

It's been a little while since I was dealing with this issue so I can't quite speak for more recent versions of Unity but from what I gathered before was that there is an issue with Unity where when you import an fbx it ignores the modified normals if the mesh also includes blend shape data. I stumbled on a ticket in the Unity Issue Tracker explaining this exact problem: Unity Issue Tracker - Blendshapes Do Not Update Normal Directions. If you want to vote on the ticket, there is a small chance they will get around to fixing it but otherwise, I'm afraid we are all out of luck.

 

Also, after reading back through my comments, it would seem that the same thing happens when the fbx is brought back into May as well but that could be an export settings issue.

 

Take care!

Message 26 of 38

Anonymous
Not applicable

So this isn't a Unity Import issue at all, right? 

Since You get this issue when you reimport it back to maya.

Can you please mark this issue as unresolved?

 

Message 27 of 38

sean.heasley
Alumni
Alumni

Hi @Anonymous 

 

The issue is technically on both parties. Maya is weird when it comes to exporting modified normals and that has been logged with development but Unity as well (at least the version @acornbringer  worked with) has an issue with importing said modified normals.

 

 

0 Likes
Message 28 of 38

Anonymous
Not applicable

Thanks, Sean. 

But what is the solution? How can we have seamless objects?

I have created a new thread about this as well

0 Likes
Message 29 of 38

sean.heasley
Alumni
Alumni

Hi @Anonymous 

 

At the moment you need to make sure your Unity is up to date and/or check the Unity updates to see if they have resolved this on their end.

 

Aside from that, deleting the non-deformer history before exporting as worked in some cases and if you are using normal maps on your model as well you may need to check that it is in the right format (DirextX/OpenGL).

 

Otherwise you may need to wait until Unity fixes their issue as we are working on it as well but I can't say when a fix will be implemented.

 

 

0 Likes
Message 30 of 38

acornbringer
Enthusiast
Enthusiast

@Anonymous We established that this is an issue with Unity that - as far as I can tell - has yet to be resolved. You can follow the bug report from the Unity Issue Tracker as previously linked - Blendshapes Do Not Update Normal Directions.

 

"Imported normals/tangents in meshes with blendshapes do not update when the mesh is blended, resulting in bent normal directions. If using calculated normals/tangents, normals are updated, but meshes don't respect "hard edges" aka it is unusable with component-based character meshes where you separate pieces of the character and have the border edges locked to match between meshes."

 

As to why the FBX imports back into Maya with the same issue; that likely has to do with your Maya .fbx export/import settings. Try experimenting with the "Include > Geometry check boxes" while exporting your .fbx. I believe disabling the "Smoothing Groups" option will retain the edited normals on export from what I remember.

 

This issue was marked as resolved because there is nothing more that can be done about it until addressed by Unity. If you are finding the issue persisting in your Unity project, you may need to find a workaround or not use component-based character meshes with blendshapes.

0 Likes
Message 31 of 38

Anonymous
Not applicable

 Hi Sean and Acornbringer.

 The issue remains with Autodesk, not Unity, as the issue is very apparent when the FBX is reimported back into Maya, without importing into Unity. It is an FBX exporting issue, regardless of what FBX export settings you use.
The problem that I, and I assume everyone else in the world is getting is as follows:
Two meshes sharing an edge with the edges' Vertex normals the same will look like there is no seam. When Exported and imported back into a fresh maya, the seamless 'single' object remains and looks good. 

However if there is a blendShape or even skinning applied to either or both of the objects, a seam will be present when you reimport it back into maya. Since the Normals get unlocked when exporting with FBX when there is a skinCluster or blendShape added.

No Seam. Two ObjectsNo Seam. Two ObjectsMatching Normal along edgeMatching Normal along edgeChanged Normals After importChanged Normals After importSeam showsSeam shows

Message 32 of 38

sean.heasley
Alumni
Alumni

Hi @Anonymous and @acornbringer 

 

Just an interesting note from a developer if you are working with blendshapes and having this issue.

 

If the blendshape targets are not in the scene anymore (the data is retrieved from the plug) then the FBX Maya plug-in will put all normals to 0 since it cannot retrieve them from the plug. So, 1) make sure they have not deleted the shape targets from the scene.

2) the FBX SDK only stores deltas so if vertices in the targets do not move relative to the base, their normals will not be written since they are assumed to be the same as the base  - unfortunately, it they are not, the FBX SDK will not handle the case.

There is no "lock" normals concept in the FBX SDK.

 

 

 

 

0 Likes
Message 33 of 38

acornbringer
Enthusiast
Enthusiast

@sean.heasley I remember importing a .mb straight into my unity scene before and saw some success but that can be super inefficient. @Anonymous Maybe give that format a try and see how it works for you seeing as how .fbx doesn't handle that type of data.

 

Another method I can think of is to use a surface shader that averages the normals at the UV edges or something. Or - something I'm just now thinking of - if you want to get really arts-and-crafts, you can extrude the seams from each mesh segment across the seam and line it up exactly with the overlapping geometry. Then you can use a transparent material or cutout shader to hide those faces. This way the normals are calculated regularly and the actual edges of the seam are hidden.

Message 34 of 38

Anonymous
Not applicable

Hello   and @acornbringer

 

We have been having exactly the same problem as @acornbringer.

When we modify normals in Maya and export an fbx to Unity that includes Blendshapes. If the model does not include animation or blendshapes, the modified normals carry over to the fbx, but if there is any animation or blendhshapes, the normals get recalculated when exporting to fbx. Is there an update to this problem? AMaybe an alternate way to export the model to unity?

Message 35 of 38

hansyuan.yang
Contributor
Contributor

I bump into the same issue. Is there any way to solve it now? 

0 Likes
Message 37 of 38

hansyuan.yang
Contributor
Contributor

In the end, I found out it's only happened when I import the .fbx model to Maya. If I fix the normal direction on the seam, export to the game engine with .fbx/.obj/.ma, it will be fine.  So I just make one-way export and not bring it back to Maya.... 

0 Likes
Message 38 of 38

Anonymous
Not applicable

https://forums.autodesk.com/t5/maya-programming/a-bug-still-in-maya2022-zhi-daomaya2022dou-mei-you-x... 

 

A model, I changed this Vertex Normal, And lock Normal, Then Export FBX, When I Import the FBX, The Vertex Normal is also Locked, It's Fine!

 

BUT, If I rigging any bones with the Model, Then Export, When I import the FBX, The Vertex Normal not Locked, It's Bad!!!

 

I try that on 3dsMax, It's same BUG on 3dsMax!!!

No rigging or skin, It's OK, Has rigging or skin, It's Bad!