Apr21

Unity 3D: OBJ-Export and Cinema 4D troubles

And yet again I had to spend a whole day to work out a bug in my Unity3D-to-Cinema4D-Pipeline. Well, after all, I am constantly jumping a whole dimension here (yeah, I did a bad play on product names).

The situation: I use the OBJ Exporter found on the Unity Wiki (ObjExporter) to export each of my levels to OBJ. I then import those OBJ-files in Cinema and bake the shadows for it. The shadowmaps are then used for basic lighting of the levels. Well, this is pretty straightforward up to here.

After doing some asset optimizations last week, the exported OBJ file I wanted to use today for shadow baking was not displayed correctly any more in Cinema. Viewing the OBJ file in a text editor, however, I could not find anything wrong with it. In the past I had to deal with some formatting issues within the OBJ-Export-Script (decimals need to be seperated by ‘.’ and not ‘,’) so I suspected the problem to be that sort of thing again and usually a quick look at the ASCII source of the file made the problem obvious.

After playing around with number formatting for a while, I found out, that Unity creates an empty zero-length array of normals for a mesh if the import settings are set to not import normals and tangents. When exporting a mesh without normals the OBJ-Export-Script does not write any normals for the mesh - which is what causes the problem.

Solution: Basically you need to give the mesh an array of normals before you export it. A simple array of zero-vectors will do.

Apr13

Cinema4D won’t let monitor sleep

Cinema has an option in the program’s preferences that suppresses MacOS’ sleep functionality. This is useful when a rendering takes a long time.

But this function also prevents the monitor from sleeping, which is not very energy-efficient.

After weeks of trying to figure out what keeps my monitor from switching to standby after 20 minutes, I found the option in Cinema4D and turned it off. I use a little tool called Caffein to prevent the display form sleeping when I need it to stay on.

Jan11

HowTo: Fix the Import-Integration of Cinema4D in Unity

The Upgrade to Cinema 11.5 was released a couple of month back and shortly there after the update to Unity 2.6 was out. And right after that there was a wave of complaints that the automatic Import of C4D files into Unity is not working any more.

I had this problem as well, but could figure out a solution rather quickly. I shared my solution on how to fix the problem and thought nothing more of it. Yesterday I stumbeled across several topics in the Unity Community in which people stated that the import is still broken for them and they are now doing manual conversion to FBX.

Here is how I fixed the Import:

  1. Make sure Unity and Cinema4D are not running
  2. Run Cinema4D in 32bit mode (goto ‘Applications’, Show Info of ‘Cinema 4D’ and check ‘Run in 32bit mode’)
  3. Set user rights on the ‘Maxon’ folder in ‘Applications’ to rwx for user, group and everybody
  4. Delete the folder ‘Unity-C4DToFBXConverter’ in plugins
  5. Open Unity and try to import a C4D file
  6. Unity will open Cinema4D and install the Converter and then trie to use it to convert the C4D automatically to an FBX file which it will store in the project library folder

If you install Cinema 11.5 newly, please make sure the FBX 6 exporter is configured correctly. These settings are working fine for me:

  • check Export Animations
  • Export Materials and Textures
  • check Export as FBX 5.0 compatible file
  • uncheck Export as Textfile
  • check Export Normals (please note that due to a bug in the converter, normals will not be imported correctly into Unity, you have to generate them with Unity using the ModellImportSettings)
  • uncheck both texture options

It looks like this for me (I am running a German version of the program)