Search Unity

Changes to Cinema4D Support in Unity

Discussion in 'Asset Importing & Exporting' started by marc_tanenbaum, Mar 23, 2020.

  1. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hi everyone!

    I want to share some good news for anyone who uses Cinema 4D and Unity. We have been working with Maxon to improve integration and want to explain how the change will affect your workflow.

    Our integration with Cinema 4D has always been a little shaky. In essence, what we’ve done with .c4d files is open a background instance of Cinema 4D, use it to convert your files to .fbx, then import the result. Unfortunately, this flow – while it works in the ideal case – breaks down in a whole slew of real-world cases and was never that stable or predictable. With Maxon's help, we’ve fixed this.

    Starting from 2019.3.0b7, Unity no longer supports *.c4d files directly. Instead, Maxon provides a free plugin called Cineware – available here in the Asset Store – that will handle import. You will need to import this plugin into your project for 2019.3 forward.

    This approach has several advantages. First, quite simply, Maxon knows their format better than we do, and can focus on any necessary support. Second, no instance of Cinema 4D will open in the background: the import will run within Unity, which should make imports faster and more predictable. Finally, since the plugin will be in the Assets folder, teams won’t run into problems if different team members are using different versions of Cinema 4D.
     
    salex1 and Eyefisher like this.
  2. pauloaguiar

    pauloaguiar

    Joined:
    May 13, 2009
    Posts:
    700
    Why not export in FBX format? I find it easier I suppose. I use Cinema 4D a lot for my projects but I export it in FBX format.
     
  3. PixelArtworks

    PixelArtworks

    Joined:
    Apr 12, 2019
    Posts:
    1
    Having trouble with this new plugin with Unity 2019.3.7f1.

    I am saving the file in R21 for Cineware.

    Imported .c4d files with a pose morph tag have an invisible skinned mesh renderer. The blend shapes seem to import correctly, but the mesh is invisible. It is a simple cube mesh with 1 pose morph state that changes the scale.

    Steps I have tested to try resolve:

    On the skinned mesh renderer...
    - Have set Update When Offscreen ON
    - Have replaced materials
    - Have tried re-linking mesh
    - Have reset skinned mesh renderer bounds to same size and larger than mesh should be in case of occlusion

    In Player Settings...
    - Have toggled Compute Skinning* to no avail
    - Have toggled Graphics Jobs (Experimental) to no avail

    Is there ANYTHING else I can try? Should I be using a different version of Unity?
     
  4. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hi @ProjectionArt

    Part of the idea of this plugin is that Maxon is taking ownership of their format. As I mentioned above "Maxon knows their format better than we do, and can focus on any necessary support". So I'd recommend asking on one of their forums (you can find their list here). Best of luck!
     
  5. llealloo

    llealloo

    Joined:
    Dec 22, 2019
    Posts:
    3
    What if I am tied to using 2018 LTS? The importer is totally broken with the most recent version of cinema, it hangs and hangs. I am having to store my c4d files outside of my assets directory.

    Preferably, I could just disable this import feature and use FBX export, but I haven't been able to find anywhere I can disable the c4d import function.

    Or perhaps is there a way to make a dummy "Unity-C4DToFBXConverter.pyp" (which resides in the C4D plugin directory) that merely loads an empty scene instead of trying to parse files?
     
  6. Moe_Baker

    Moe_Baker

    Joined:
    Oct 22, 2017
    Posts:
    36
    Can you please disable the warning that shows when I have a .c4d file in my project?
    I'm not using Cineware, it's not exporting my models correctly, I'm just exporting an FBX directly from Cinema 4D and keeping both the files in the same directory in my unity project.
    The warnings just bloat my log and obscure any real warnings.
     
  7. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Hi!
    Can you be more precise about this warning? There are several different warnings that can fire up during asset import inside Unity. We know that some are more important than others and it's sometimes hard to figure out which ones are just annoying on certain projects versus really important for everyone.
     
  8. Moe_Baker

    Moe_Baker

    Joined:
    Oct 22, 2017
    Posts:
    36
    Sure, I'm talking about warnings like these:

    Here's an image showing the warnings: https://imgur.com/a/nAPz2yY
    Thank you for the support.
     
  9. George-Ing

    George-Ing

    Unity Technologies

    Joined:
    Jan 14, 2020
    Posts:
    78
    Hey Moe,

    Thanks for the feedback. I'm just wondering, is there a specific reason you're including the C4D assets as part of your Unity project?
     
  10. Moe_Baker

    Moe_Baker

    Joined:
    Oct 22, 2017
    Posts:
    36
    I find it easier to work with that way, I can open the file right from within Unity and export an FBX right to the same directory.
     
  11. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    @Moe_Baker You could create a ScriptedImporter targeting .c4d files that would just do nothing.
    Because we allow ScriptedImporter to override the ModelImporter for this specific file format, it will be used by default and skip the whole import process that occurs on your c4d files. It will even save you time as you don't wait for model imports that you don't use.
    Here the script you could drop into any Editor folder in your project:
    Code (CSharp):
    1. using UnityEditor.AssetImporters;
    2. using UnityEngine;
    3.  
    4. [ScriptedImporter(1, "c4d")]
    5. public class c4dIgnoreImporter : ScriptedImporter
    6. {
    7.     public override void OnImportAsset(AssetImportContext ctx)
    8.     {
    9.     }
    10. }
    11.  
     
    Immu and Moe_Baker like this.
  12. Moe_Baker

    Moe_Baker

    Joined:
    Oct 22, 2017
    Posts:
    36
    Thank you! This is a great solution.
     
  13. yannminh

    yannminh

    Joined:
    Jul 1, 2007
    Posts:
    43
    Hello,

    by opening my 2019.2.21 project which represents several years of development, in the new version of Unity 2O2O, I had the very unpleasant surprise to notice that all my C4D files are "missing prefabs", or "Missing Mesh".

    and even if I use Cineware from Maxon ... I lost the link with all my meshes ... I just loose 10 years of build...

    as after a lot of research on the net, it seems that no one seems to be complaining about this problem,

    I just tried a prefab export from the 2019 version, and a re-import of the prefab from the 2020 version of unity with Cineware de Maxon, and it's the same ... missing prefab and meshes everywhere ... I am oblige to rebuild all my work...

    Maybe I am just missing something simple to update my Cinema4d files from unity 2019 to Unity 2020?

    if anyone had an idea it would be great ...

    thank you for your help...

    Yann
     
  14. Moe_Baker

    Moe_Baker

    Joined:
    Oct 22, 2017
    Posts:
    36
    Had come across the same issue, didn't really bother to look for an answer, knew Unity would screw me like this one day and it won't be pretty so I just fixed it manually, but that is for just a small project.
    Yet I think I figured out a way tho... the way the old C4D importer worked was by exporting a "temporary" fbx from your c4d files, so you can trick Unity by creating your fbx files explicitly and using them instead of the old "temporary" fbx files, you'd:

    - Rollback your project to its last usable state before upgrading to 2020.
    - DON'T open the project in Unity yet.
    - Open the project folder using the file explorer.
    - Delete the Library, Temp, Obj folders, basically any temporary folder that Unity creates.
    - Select a c4d file and open it in Cinema 4D.
    - Export the .c4d file as an fbx to the same directory as the c4d file.
    - From the file explorer, look for the meta file for the c4d file, should be something like **********.c4d.meta (they are hidden by default so you might need to enable the option to show hidden files on your file explorer).
    - Rename that meta file to **********.fbx.meta

    Now if you open the project, that specific fbx model should be linked correctly wherever the old .c4d was used, tho you may need to correct the scale of the new fbx file, sometimes the default 1 works, sometimes it's 100, I don't know, C4D and Unity are weird like that.
    Now, you'd want to fix all the .c4d files before opening the project in Unity but you can try this out with a couple of .c4d files, make sure it actually works, and then rollback your project again, delete temporary folders and proceed with all the .c4d files.
    The process would be too tedious of course, but you can automate it, you can write a script (outside of Unity of course) that will rename all **********.c4d.meta to **********.fbx.meta, there is probably some freeware out there that can do this too.
    From there you'd only need to batch export all your .c4d files into .fbx, You can probably write a script that will batch export all your .c4d files to .fbx using Cinema 4D's Python scripting or something, or you can hire a freelancer to write it for you, or buy a tool like this Batch Processor Tool for Cinema 4D.
    Good luck with your project.
     
    jmdeb and yannminh like this.
  15. yannminh

    yannminh

    Joined:
    Jul 1, 2007
    Posts:
    43
    Thanks Very much Moe_Baker... it is great... I try that ... :):):)
     
    Moe_Baker likes this.
  16. Ill-Fish

    Ill-Fish

    Joined:
    Aug 23, 2015
    Posts:
    22
    I haven't used Unity for a while. Now I made a 3D Model in C4D exported it as fbx file. Uploaded it to Mixamo for animation and imported the animated fbx to Unity. But I get the message, that C4D file are not longer supported. That it weird
     
  17. George-Ing

    George-Ing

    Unity Technologies

    Joined:
    Jan 14, 2020
    Posts:
    78
    That is odd.

    That sounds like a bug. If you could file a report with a sample asset then we'll look at getting that sorted out for you.
     
  18. Ill-Fish

    Ill-Fish

    Joined:
    Aug 23, 2015
    Posts:
    22
    I created a new model, made the same steps as before, but now the problem is not appearing anymore. So it seems it was a temporary problem. Thanks for you offer to help.
     
  19. P3ndragonLLC

    P3ndragonLLC

    Joined:
    Sep 19, 2019
    Posts:
    99
    @pauloaguiar Do you ever have issues getting the textures and shaders configured correctly from the fbx export? I find I have issues with getting the skin textures to look correct (but I'm starting from someone else's export) Do you have to do anything to the textures for them to look in Unity like they did in Cinema4d?
     
  20. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    @bastien_humeau
    It seems to work when I add a new C4D file in the source files, but not when opening the editor, when I do, there's still the huge list appearing (I'm using 2019.4.29f1 so the 'experimental' version of assetImporters)
    Could this be the reason ? Or should I possibly move the script in the execution order ?
    upload_2021-8-22_10-48-59.png
     
  21. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Hey @Immu, I've tried it with a small project that only got a bunch of c4d assets and the dummy ScriptedImporter in 2019.4 and got no issue.
    Do you have any error showing up in you project that would prevent the AssetDatabase from using the ScriptedImporter?
    Did you place the script in an Editor folder, or inside a folder with an Editor asmdef?
    Did you copy the code in a file named the same as the class (c4dIgnoreImporter.cs in my example) ?
    Either way, if you have the time to send over the project using the bug reporter we can have a look into why it doesn't work in your case.
     
  22. jmdeb

    jmdeb

    Joined:
    Jul 28, 2017
    Posts:
    23
    Thank you so much!! Was looking for an answer to this question and your reply helped me a LOT! ;)
     
    Moe_Baker likes this.
  23. Nirvan

    Nirvan

    Joined:
    Nov 16, 2013
    Posts:
    134
    Someone found solution for logging in with the plugin? I have C4D license but can't log in (says "This email address is either reserved or not registered." I am using same email as Maxon Portfolio) and I can't even register. ("The email is reserved. Please use another email to to complete registration.")
    Logging using google mail is not possible because "browser isn't safe".
     
  24. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    @bastien_humeau
    @George-Ing

    Back on this topic, It wasn't priority for some time so I kinda left it hanging, but I still have it :/

    For the purpose of this test, I've created blank project on 2021.3.23f1
    Using new project template - 3D Core.

    I add the script :
    Code (CSharp):
    1. using UnityEditor.AssetImporters;
    2. using UnityEngine;
    3. [ScriptedImporter(1, "c4d")]
    4. public class c4dIgnoreImporter : ScriptedImporter
    5. {
    6.     public override void OnImportAsset(AssetImportContext ctx)
    7.     {
    8.     }
    9. }
    10.  
    upload_2023-5-7_14-39-53.png

    I add C4D file here
    upload_2023-5-7_14-40-11.png

    I close the project, then whether or not I delete the C4D meta file, upon reopening the project, I'll get:
    upload_2023-5-7_14-44-12.png

    So the script doesn't seem to override the warning, with the 100+ C4D files in my bigger project that I prefer to keep inside my project for organization purpose, it's just very annoying to get those warning on each startup, even more considering the fact that other, more important unrelated warning, could be inside the list;

    I wish this could be a warning I could disable through Additional compiler arguments with /nowarn..., but it's not even a standart warning with a code.
    When looking for the warning code using full warning stack, I only get:
    Code (CSharp):
    1. 0x00007ff6887fed1d (Unity) StackWalker::GetCurrentCallstack
    2. 0x00007ff6888058d9 (Unity) StackWalker::ShowCallstack
    3. 0x00007ff68979d0a3 (Unity) GetStacktrace
    4. 0x00007ff689e4d05d (Unity) DebugStringToFile
    5. 0x00007ff689be8e9c (Unity) FBXImporter::CanLoadPathName
    6. 0x00007ff689a83238 (Unity) AssetDatabase::SelectAssetImporter
    7. 0x00007ff689ab0125 (Unity) GetImporterSelection
    8. 0x00007ff689b61332 (Unity) SelectMissingImporter
    9. 0x00007ff689b43314 (Unity) InsertOutOfDateArtifactInCategorizations
    10. 0x00007ff689b418f0 (Unity) CategorizeAssets
    11. 0x00007ff689b23bf8 (Unity) RefreshInternalV2
    12. 0x00007ff689b2bfeb (Unity) StopAssetImportingV2Internal
    13. 0x00007ff689b18d7d (Unity) InitialRefreshV2
    14. 0x00007ff6893426dd (Unity) Application::InitializeProject
    15. 0x00007ff6897a7808 (Unity) WinMain
    16. 0x00007ff68ab86cbe (Unity) __scrt_common_main_seh
    17. 0x00007ffee0b17604 (KERNEL32) BaseThreadInitThunk
    18. 0x00007ffee18a26a1 (ntdll) RtlUserThreadStart
    Thanks for your help.
     
  25. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Hi there!
    Thank you for reaching out with so many details.
    I can see the warning was implemented in the Importer selector instead of in a dummy importer that can be overridden easily...
    Let me create a task in our backlog and we'll look into fixing that and backporting if possible.
     
    salex1 and Immu like this.
  26. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    Lovely !
     
  27. Immu

    Immu

    Joined:
    Jun 18, 2013
    Posts:
    240
    Hello, is there any way to follow the advancement of that task ?
     
  28. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Immu likes this.