Red-i Productions Presents:
[The definitive]
Cinema4D - Riptide - ZBrush
Import/Export Guide
Copyright © 2007 by Keith Young
(a.k.a. Spanki)
http://www.skinprops.com

 

Introduction


As the author of the Riptide .obj file Import/Export plugin for Cinema4D, the following is my attempt to clear up any confusion about import/export options used when transferring files back and forth between Cinema4D (using Riptide) and ZBrush. As a relative newcomer to ZBrush, I can't advise on the intricacies of creating Displacement Maps or setting them up for use in Cinema4D, so this document is only concerned with the actual .obj file import/export process.

Also note that I am writing this relative to ZBrush version 3.1 and various versions of Cinema4D, R9 through R10.5 with Riptide v1.6.

[Reminder: As always, if you have any questions about any of this, or other Riptide questions, please use the Riptide Support Forum.]

 

Terms and Definitions


Below are some terms and definitions I use throughout the document...

  • Cinema4D / BodyPaint 3D - I may abbreviate these as C4D or BP.
  • Material Zones - some group of polygons that are assigned to some material/texture within C4D.
    These are set up as uniquely named Polygon Selection Tags, with Texture Tag's "Selection" property set to the name of the selection tags. These show up as "usemtl xxxx" records in the .obj file.
  • Groups - some group of polygons that are also set up within C4D as uniquely named Polygon Selection Tags and then tracked by a Riptide "Group Tag".
    Groups are just a generic way of tracking some set of polygons. They show up as 'g xxxx' records in the .obj file. Different applications use them for different purposes...
    • ZBrush: can use these as 'PolyGroups' which let you hide/unhide sets of polygons.
    • Cinema4D: doesn't really have any special meaning for Groups, but the built-in import code will split the mesh up into multiple polygonal mesh objects at group borders (adding vertices as necessary). The Riptide plugin tracks Groups as Polygon Selection Tags and has multiple options for dealing with and keeping track of Groups for both Import and Export (including splitting the mesh up at group borders, but you also have the option of NOT splitting the mesh up, while maintaining the group selections).
    • Poser: Poser uses Groups to determine joint/bone boundaries. All polygons in the 'hip' group, are part of the 'hip' bone/joint, etc., so they are very important for any posable meshes within Poser.
  • PolyGroups - ZBrush's name for 'Groups', listed above.
  • Regions / UVMapper Regions - Similar in structure and function to the Groups described above...
    Just as some background, Steve Cox (author of the UVMapper program) came up with the idea of using comment fields in .obj files to store an additional means of tracking/categorizing groups of polygons. These lists of polygons can overlap the normal 'group' mechanism, as well as the normal 'material zone' mechanism, giving you 3 distinct ways to categorize each polygon.

    When I wrote Riptide, I implemented these "UVMapper Regions" in a way that is compatible with UVMapper and UVMapper Pro. As far as I know, UVMapper and Riptide are the only programs that understand this setup in the .obj file (other programs just see them as comments and ignore them - so you'll lose them upon re-exporting), but it can still be a handy way to store additional grouping information in the file for future use (If Riptide sees these regions in the file, it will create polygon selection tags for them, as well as the Region Tag that tracks them for exporting).

    [NOTE: Some ZBrush documentation may use this 'Region' term to describe islands/tiles of uv-mapping, but it does not (currently) support the UVMapper Region records that Riptide produces. See also the "Cinema4D -> ZBrush Workflow / Overview" and "Export UV Coords" sections below].

 

Cinema4D -> ZBrush Workflow / Overview


This document assumes that ZBrush is being used primarily for the creation of Displacement Maps (and/or Bump maps, Normal maps, Cavity maps, etc.), where the modeling and rendering are taking place within Cinema4D. With this in mind, there are a few issues to consider:

  • any .obj files exported from ZBrush only retain a limited subset of the information that may have been in the .obj file exported from C4D...
  • Because of the above, if you export a .obj file from ZBrush, you can only get back one (useful) set of polygon selections...
    • Material Zones or...
    • Groups or...
    • Regions

...which ones you get, depends on your decision between which set you want to work with as PolyGroups inside ZBrush vs. how much trouble it's going to be for you to re-create them back in Cinema4D.

However, assuming you're using ZBrush to generate displacement maps (and not uv-mapping or mesh changes), then you don't usually need to export the mesh file in the first place - just the displacement maps, which you can apply to your original mesh sitting in C4D. If you need to do any modifications to the mesh (like different uv-mapping or moving some vertices around), you can just make those changes in C4D on the original and re-export the mesh. Note that using this method, several of the Riptide Export options are less crucial as well (scaling, etc). So related to that, you can export a mesh for use only in ZBrush, which may or may not be the same grouping structure as your working model.

With the above in mind, here are some thoughts on which set of selection tags to use in ZBrush as PolyGroups (which let you hide/unhide sections of the mesh and are always re-exported as .obj file 'group' records)...

Material Zones:

This choice probably makes the most sense, since you're making displacement maps to be used with materials - even though some materials would use the same displacement maps if they are part of the same UV region/tile/island (see the section on uv-mapping, below). These selections also often overlap the Group selections of a mesh (when working with humanoid Poser-type meshes, "Skin" or "SkinBody" or even "SkinHand" would likely encompass all the polygons in the various finger Groups, thumb Groups and hand/palm Group, but might also encompass the forearms, shoulders, torso, neck, abdomen, etc.).

If you want to have your material zones available as PolyGroups in ZBrush, then:

  • make sure that the Riptide "Export Materials" option is Enabled
  • before you import into ZBrush, make sure that you have the "Preferences -> Importexport -> Import Mat As Groups" option Enabled. Note that this will override the "Preferences -> Importexport -> Import PolyGroups" option (you can only get Groups or Material Zones as ZBrush PolyGroups).

Groups:

If you are modeling just for rendering within C4D, then you may not even have any groups set up. If this is the case, then you are free to set up some specific groupings for use as PolyGroups within ZBrush:

  • select a group of polygons
  • create a Polygon Selection Tag
  • give the tag a unique name
  • repeat the above steps for any other groups of polys
  • add a Riptide "Group" tag to your mesh and choose those selection tags (to change the tags being tracked later, double-click on the Group Tag to open it's dialog).
  • make sure you have "Export Groups" Enabled.
  • make sure you have "Group Tag Names" Enabled.
  • before you import into ZBrush, make sure you have the "Preferences -> Importexport -> Import PolyGroups" option Enabled.
  • make sure that you have the "Preferences -> Importexport -> Import Mat As Groups" option Disabled (you can only get groups or materials as PolyGroups).

Regions:

As described above (and again in the uv-mapping section), Regions are also just another generic way of tracking/categorizing some set of polygons, separately from Groups. Aside from the name and the method they are stored in the .obj file, they are implemented to act exactly like the Groups described above. ZBrush doesn't (currently, at least) know about UVMapper Regions, so if you want to use your regions as PolyGroups, you'll have to change your Group tag to point at these selections before exporting, instead.

 

 

Riptide Export Dialog Options


The Riptide .obj Import/Export plugin provides numerous options that controll the content and structuring of .obj files, so this section will discuss each option in detail, relative to exporting your mesh ready for import into ZBrush.

First off, if you don't really care about the details, try using the following options..

 

...this setup should work well for you, but I do recommend also at least reading the sections on Scale Factor, Face Sorting and Export UV Coords.

Each option is described in more detail below...

Index:

  • Scale Factor
  • Export Ngons
  • Export Normals
  • Export Faces
  • Reverse Faces
  • Export UV Coords
  • Flip UV Horizontally
  • Flip UV Vertically
  • Export Materials
  • Export Groups
  • Export Regions
  • Face Sorting
  • Mesh Names
  • Group Tag Names
  • Preserve Hierarchy
  •  

    Scale Factor


    ZBrush will auto-scale your model when importing and you have some control over the export scale (up to 100x, down to .1x), so generally, any Riptide Scale Factor value should be fine when exporting your model for import into ZBrush, so just leave it however you normally have that set.

    If you need to export a mesh from ZBrush back to Cinema4D (see the "Cinema4D -> ZBrush Workflow / Overview" section above), then you should leave the ZBrush export scaling set to 1, so that it gets exported at the same scale it was imported. You can then leave the Riptide Import Scale Factor set to whatever you had it when you exported the mesh - I show a Scale Factor of 1000 in the example above, just because that's the value I use going to/from Poser.

     

    Export Ngons


    ZBrush only supports quads and triangles. If you have Ngons in your model and you have this option Enabled, then ZBrush will display a warning and then convert them to quads/triangles for you. The best option in this case is to either "Remove N-gons" in Cinema4D before exporting (in Polygon Mode, "Select All", right-click in the editor window somewhere and select "Remove N-gons" from the pop-up menu), or make sure that Export Ngons is Disabled. This way, you can have confidence that your uv-mapping will remain intact.

     

    Export Normals


    Normals are not needed by ZBrush and are ignored if present (or at least ZBrush doesn't export Normals). Since exporting Normals just adds to the size of the file, you can Disable this option.

     

    Export Faces


    Must be Enabled.

     

    Reverse Faces


    This option controls which direction the faces/polygons point (used for Backface Culling). Interestingly, ZBrush seems to determine the order based on how the mesh is enclosed, so it doesn't really matter whether this option is Enabled or Disabled - it can read either direction and it exports in the direction needed by Cinema4D by default (they are exported the wrong direction if you Enable ZBrush's "Flip Face" option).

    However Cinema4D's own built-in .obj Import code needs this option Enabled, as does Poser and some other apps. If you use Riptide for Importing, there's a "Reverse Faces" option on import as well, which is normally Disabled to match the built-in .obj file loader's direction. So basically, just leave this set to whatever you normally have it set to.

    There's a potential point of confusion relative to this, because the existing/previous ZPipeline guide shows a screen-shot of the export dialog with this option Disabled. Normally (for export to Poser or Cinema4D and many other apps) - and the way ZBrush is going to export files by default - this option should be _Enabled_.

     

    Export UV Coords


    This should be Enabled. Assuming you have BodyPaint, you should also have already uv-mapped your model before exporting. When uv-mapping your model, there are a couple of things to keep in mind...

    1. Make sure that you don't have any overlapping uv-polygons. I think ZBrush refers to these as non-standard and will issue a warning.

    2. Related to #1, if you plan to use more than one texture on your model, then you need to break your uv-mapping up into 'islands' (or 'regions') and tile them. This is actually one good use of Riptide's "Region" tag...

    Just as some background, Steve Cox (author of the UVMapper program) came up with the idea of using comment fields in .obj files to store an additional means of tracking/categorizing groups of polygons. These lists of polygons can overlap the normal 'group' mechanism, as well as the normal 'material zone' mechanism, giving you 3 distinct ways to categorize each polygon. When I wrote Riptide, I implemented these "UVMapper Regions" in a way that is compatible with UVMapper and UVMapper Pro. As far as I know, UVMapper and Riptide are the only programs that understand this setup in the .obj file (other programs just see them as comments and ignore them - so you'll lose them upon re-exporting), but it can still be a handy way to store additional grouping information in the file for future use (If Riptide sees these regions in the file, it will create polygon selection tags for them, as well as the Region Tag that tracks them for exporting).

    So, ZBrush would ignore these selections, but the basic idea is still useful... you basically make separate polygon selections for each set of polygons that will use the same texture. Once you have these 'region' polygon selection tags in place, if you right-click on your mesh in the Object Manager, you can add a Riptide Tags -> UVM Region tag to keep track of them. Then while in BodyPaint, you can select these groups of polygons using those tags and tile them out into their own space...

    - select the polygons for a region using the selection tags created above.
    - in the UV Mapping -> Transform tab, enter a 1 in the Move -> X field
    - click on Apply button

    ...this will move your selected uv-polygons to the right by one tile. For each subsequent group of polygons, you click Apply enough times to move them out beyond the previous group. Another option would be to use my Undertow plugin, which has "Tile U" and "Tile V" commands that do the same thing without messing with the Transform tab.

     

    Flip UV Horizontally


    Leave this Disabled.

     

    Flip UV Vertically


    Leave this Disabled.

     

    Export Materials


    Leave this Enabled. ZBrush doesn't maintain your material settings and it combines all material zones into one zone when it exports, but you do have the option of EITHER using material zones as PolyGroups or using .obj file 'groups' as PolyGroups when you import, so it doesn't hurt to have them in the exported file (see the "Cinema4D -> ZBrush Workflow / Overview" section above).

     

    Export Groups


    Leave this Enabled. If you plan to use groups as PolyGroups in ZBrush, then this has to be Enabled. If you're going to use your Material Zones as PolyGroups, then it doesn't matter if this is enabled or not but it doesn't hurt anything if groups are in the file as well (might as well leave it alone/enabled).

     

    Export Regions


    Doesn't matter. ZBrush (currently, at least) treats these as comments (ignores them), so it doesn't matter if they are in the file or not (might as well leave it alone/enabled).

     

    Face Sorting


    Take your pick / doesn't matter. Some applications will load .obj files faster (sometimes much faster), if you "Sort By Material", so I always leave it set to that. If you're using Groups as PolyGroups in ZBrush and you have a lot of them, then "Sort By Groups" could potentially speed up the loading, but any option will do (none of the options will produce bad or not-working files - face sorting order is not critical, vertex sorting/order is a different story, but Riptide does not re-order vertices).

     

    Mesh Names


    Generally, you want this Disabled. This option was meant to be a quick-n-dirty way to get a group or region per mesh in the scene when you didn't set them up specifically using the Group and/or Region tags. There seems to be quite a bit of confusion related to this option in general, so here's some background/details...

    In short, you should only use this option if you don't have any Riptide Group Tags on your mesh, but you still want Groups in the file (or re-read that sentence replacing 'Group' with 'Region', if you use the "As UVMapper Regions" option). If you Enable this option and you have already set up some Groups and a Riptide Group Tag and also have the "Group Tag Names" option Enabled, then you can end up with 'empty' groups in the file, which may cause some confusion.

     

    Group Tag Names


    Generally, you want this Enabled. If you're not setting up groups on each mesh with a Group Tag, then you would Enable the "Mesh Names" option above, instead.

     

    Preserve Hierarchy


    Generally, you want this Disabled. It was initially implemented to mimic some C4D built-in import/export functionality, but it's not currently very useful.