A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
Export Sub-D to Unity
Posted: 11 December 2017 09:10 PM   [ Ignore ]  
Total Posts:  25
Joined  2008-03-16

Is it possible to export Sub-D to Unity? I had been using Sub-D in a character animation of a dog that needs to be exported to Unity. I found this link on the Unity website: https://answers.unity.com/questions/1323004/import-c4d-model-with-subdivision-surface-into-uni.html , but when I try to export using these settings I get weird “spikes” deformations in my model. I’ve attached an image of what it looks like.

The other option I am considering is baking out the animations to PLA using NitroBake. Unity doesn’t support PLA directly, but there is a plugin that allows its use. I’ve gotten good results using this method, but I am concerned that there may be performance issues if I go this route.

Thanks,

Michael Stafford

 Signature 

Michael Stafford
ideas in motion

Profile
 
 
Posted: 11 December 2017 09:13 PM   [ Ignore ]   [ # 1 ]  
Total Posts:  25
Joined  2008-03-16

I should also say I have pose morphs applied to this mesh and when I export using the settings above the morphs do not look right.

 Signature 

Michael Stafford
ideas in motion

Profile
 
 
Posted: 11 December 2017 09:49 PM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Michael,

How does it look when you re-load the FBX back to a new scene file?

Would you please upload the image to the link I will give you via PM? Thanks.

Talk to you soon.

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 11 December 2017 10:04 PM   [ Ignore ]   [ # 3 ]  
Total Posts:  25
Joined  2008-03-16

Thanks Sassi,

I think it has to do with the Pose Morphs. When I delete that tag to export looks better. This will be an issue for me though since it will mean I can’t do my facial expressions the way I had intended. I guess I can rig the face with bones and do it that way, but Pose Morphs were the way I had originally set this up.

I’ll send the image to your link now. I thought I attached it, but maybe not.

Thanks!

 Signature 

Michael Stafford
ideas in motion

Profile
 
 
Posted: 12 December 2017 03:01 AM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Michael,

The spikes that you see are the points that were stored in the Pose Morph. You might see the pattern of your non-SDS mesh in it. When I check the Unity manual, it can’t take SDS.
https://docs.unity3d.com/Manual/HOWTO-exportFBX.html

The tip from the QA UNITY that you posted is right, the Subdivision Surface needs to be baked, which obviously works.
https://help.maxon.net/us/#FFBXEXPORT-FBXEXPORT_GROUP

So you have the dog all fine in a FBX, but the Pose Morph causes trouble. The information inside of the PoseMorph hasn’t been Subdivided, well in fact it is subdivided, but not as it you need it. If you check the three models under the “Poses: Rexx_Body_All_1” and switch them one at the time to visible, you see the problem. A case for the support? I guess so.

Well, you said deadline, so let’s fix the PoseMorph.

Select the Body Object of REXX in your c4d file, with the Subdivision Surface, use cmd C and CMD (CMD drag might not give you all).

Repeat this three time (cmd V) so you have a model for all three states of your Pose Morph. Delete in each the Skin Object. The dog will move to the center of the c4d world.

Make sure all sliders of the PoseMorph are 0% (stay in animate mode for now)

Delete the first Pose Morph Tag, this is your “Base Pose”

For the second, move only the first slider “Sad Eyes” to 100%, if it looks right, delete the PoseMorph Tag.

For the third one, move only the “Sad Mouth” to 100%, as above, delete the Tag when ready.

Name all three!

Leave the Subdivision Surface in the EXACT 100% etc setting as the one you use for the body of REXX. Any difference here, and it fails.

These three will be (General: no Subdivision Surface, Geometry Bake Subdivision Surface.)

Export as FBX

Open the FBX in a new file in c4d. Open the PoseMorph in Edit mode and replace the three states with their spiky part in the Link Field of each pose.
Delete the previous spiky parts.

Save again as FBX. There should be no Subdivision Surface anymore.
It should work fine now. Testing it now again… I get sometimes mesh explosions! Because the Subdivsion Surface settings were off. So, it works fine here.

Cheers

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 12 December 2017 01:33 PM   [ Ignore ]   [ # 5 ]  
Total Posts:  25
Joined  2008-03-16

Wow Sassi! Your breadth and depth of knowledge of C4D continues to astound and amaze! smile

I saw the different versions of the file with the poses in the exported FBX, but I would have never thought of replacing them with pose models exported separately. Great Workaround!

It took me a couple trys, but I was able to get your method to work. The only issue I have is saving the FBX out the second and final time after I’ve replaced the poses. When I open the 2nd FBX up in C4D the new poses are there, but there are also a second copy. The animation of the pose sliders is also missing, so the poses aren’t animating. Are you seeing this? Its probably user error on my part. I’ll see if I can figure it out.

Thanks again for all your help!

 Signature 

Michael Stafford
ideas in motion

Profile
 
 
Posted: 12 December 2017 03:13 PM   [ Ignore ]   [ # 6 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Michael,

Thanks a lot. I try to get a small scene established where I can reproduce this problem, including the missing keyframes for the second export. I have to find the cause, as something disables them obviously. I saw the missing keyframes, so I build a small cube based, joint and PoseMorph set up, but I had no problems, it worked fine. But opening it then in Unity, made the world shake not the object. I have to continue to explore it, as it is certainly not the way to go. The best way to get this communicated is to have a small representation, reduced to the bare minimum.

The three copies, if you take a look to any of the previous exports, they are under the body mesh in a group as child and set to invisible. Place the three Smooth meshes there and after the fix, delete the three spiky ones.

As a side note, to my understanding, Unity is a real-time engine, which means that any heavy load has to be avoided. I would make certain how dense the mesh needs to be, to not kill the performance.I guess one subdivision instead of three should be already good, but ask the author of the game.
With a subdivision of one, I would make a copy of the dog, use the Mesh>Commands>Subdivision* (*to get to the parameters) and useSmoothSubdivision 1. This copy can be then used with Character>Manager>Vamp to transfer your weighting. With that done well, you could animate the dog in the final resolution and avoid all the problems to begin with. It depends of course on the expectations the people have on the end of the pipeline.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 12 December 2017 03:44 PM   [ Ignore ]   [ # 7 ]  
Total Posts:  25
Joined  2008-03-16

Thanks Sassi,

Thanks for looking at all this. Yes, the addtional copies of the meshes is strange. I set them up as you describe and delete the originals once I;ve got them linked, but when I save the FBX and open it back up in C4D I get the copies. Weird.

I had thought about animating the full res version, but I didn’t want to have to re-weight everything. I’ll look into VAMP. I thought there was probably a way to do it. Thanks for tip on that.

Yes, I agree with the comment about realtime performance. This morning I discussed this with the client and I think we are going to go with non-Sub-D for now for that reason alone. The first version I showed them the normals in Unity weren’t smoothing the model very well. They didn’t like it, but once I had Unity re-calculate the normals the low-poly model looks pretty good. Also, I looked at the Unity Game tutorial here on Cineversity and the “Farmer” wasn’t using Sub-Ds. I assume this is pretty typical for games/realtime, but its all new for me, so there is a learning curve.

Thanks again for coming to my rescue! smile

 Signature 

Michael Stafford
ideas in motion

Profile
 
 
Posted: 12 December 2017 04:06 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Michael,

I’m certainly not a Unity pro, not even close. What I understand is, that the PoseMorphs [targets] are normally stored somewhere. To provide the information for Unity, the obvious agreement is, that they are stored in a mesh, and not a cache.
https://docs.unity3d.com/Manual/HOWTO-exportFBX.html

Yes, I checked all the tutorials, and in none of them the Subdivision Surface was used.

The real-time thingy has certainly changed over the past decade, and Subdivision surfaces would be a wonderful way to update older version on the fly, but since each 3D app has its own “alchemy” to calculate them, even if the underlaying idea is similar, it would be a lot of work for Game engines to keep track of it, and C4D’s own SDS has changed (note able not only with the name change HyperNURBS). So, FBX is the “filter/converter here” but FBX has its own little challenges…


Edit:
With each new test I get more comfortable to blame anything “SubdivisionSurface/FBX-Im/Export” as the villain. Since the Subdivision Surface tightens the surface a little bit, or average between points and ideal curve (kind of) the previous points show up, hence the spiky stuff. Since the animation can’t be transferred with Subdivision on and baked in the process, the mesh only way is the way to go.

If you go with a non Subdivision Surface, the Vamp can work nicely, just try Surface or Normal Direction. The Morph transfer should work nicely to the new mesh as well, also here, the projection method is key.

My best wishes

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile