glTF Export

Last updated April 10th, 2019

In this release

  • Morph Animations support added
  • Scaling option added
  • Editor mode support added
  • asset.generator string added
  • Single animation object
  • Mipmaps support
  • Bug Fix: animation curves weren’t sampled correctly when baked
  • Bug Fix: Flip Z produced wrong orientation
  • Bug Fix: animation curve with only 2 keyframes wasn’t getting baked
  • Bug Fix: Linear interpolated curves exported as spline
  • Bug Fix: Exporting TRS/Pose Morph Animation where first/last frame’s time is a number with more than 3 decimals after the point, and a curve is missing in the animation editor, resulted in an error when baking option is enabled

About glTF

gl Transmission Format, or glTF, is a free specification by KhronosGroup for the efficient transmission and loading of 3D scenes and models by applications which makes it great for RealTime Graphics. The Cinema 4D glTF Exporter exports the c4d scene to *.gltf/*.glb formats, ready to be used across all platforms supporting glTF.

Exporting Options

To Export the scene in glTF format go to File->Export->GLTF (*.gltf), select a destination and click Save. An Options window will pop up with the following options:

  • Export Normals: Deselect to get Flat Shading.
  • Export UV Coordinates: Self explanatory.
  • Scale: Define the scale of the exported scene.
  • Export Textures: Self explanatory.
  • Double Sided: Select to prevent Back-face Culling.
  • Export TRS Animations: Export TRS animation tracks.
  • Export Morph Animations: Export either Pose Morph animation or PLA animation.
  • Bake Animations: Bake every frame of animation.
  • Substeps: Number of substeps to sample between each two frames.
  • Flip Z: Switch from Left Handed to Right Handed System.
  • Export as Binary(.glb): Export glTF file in its binary form.

Texture Mode

The Texture Mode of the gltf file is defined by the Texture Mode option in Preferences>OpenGL, select between Nearest, Linear and Mipmaps.

Pose Morph

The current glTF standard supports morph targets which are added, with differnet weights, to the original mesh. The weights can also be animated.

In Cinema 4D, Morph targets are called Poses, and the weights are Strengths.

Setting a Target overrides the internal poses defined in the tag.

PLA

PLA isn’t technically supported in the current glTF standard, but I was able to achieve this by considering the object at different keyframes to be differnt morph targets.

Materials

glTF takes the PBR approach to describe Materials, which translates pretty well to Cinema’s Reflection Channel, but is limited in some aspects. One of those is the lack for multilayered material support. And so, to get a similar looking result on export, we recommend working with a single Reflection/Specular layer in the Reflection Channel.


(*) Supported fields are Highlighted in blue

PBR Metallic Roughness

glTF’s PBR Material’s information is encoded into three main parameters:

  • Base Color: set by Layer Color’s Color selection or by Color selection in Color Channel.
  • Metallic Value: set by main reflection layer’s Reflection Strength value.
  • Roughness Value: set by main reflection layer’s Roughness value.

Texture maps to the aforementioned parameters are also supported:

  • Base Color Texture: set Bitmap Texture in Layer Color or in Color Channel.
  • Metallic Texture: set Grey-scale Bitmap Texture under Reflection Strength.
  • Roughness Texture: set Grey-scale Bitmap Texture under Roughness Strength.

Normal Map

Normal Maps can also be set in the main Reflection/Specular layer, under Bump Strength, set Mode to “Custom Normal Map” and set the Bitmap in Custom Texture.Can also be set in the Normal Channel and the Bump Channel.

Other Maps


(*) Supported fields are Highlighted in blue

Occlusion Map

Occlusion Map is set in the Diffusion Channel.

Emissive Factor and Map

Emissive Factor(Color) and Map are set in the Luminance Channel.

Alpha Map

Alpha Map is set in the Alpha Channel.

Editor Mode

Visibility of the object can be turned off by setting the Editor Mode to Red. Technically there’s no support for a visibility boolean in the current standard, this is achieved by setting the material’s alpha to 0.

Notes and Limitations

  1. Reflection Strength vs. Metallic Value: Reflection Strength translates very closely to glTF’s Metallic Value, but there’s a difference… In Cinema 4D, Reflection Strength describes how much light is reflected off the surface, whereas Metallic Value describes how much the reflective behavior of the surface resembles that of a metal. 0% Reflection Strength means that the surface doesn’t reflect any light, meaning it’s black. But that is not true for 0% Metallic Value.
  2. Texture Baking: As of now, the automatic baking of Texture Shaders is not yet implemented. If you do use Shaders, please manually Bake them using the Bake Texture tag and re-set them as Bitmaps.
  3. Metallic-Roughness coupling: In glTF, the Metallic and Roughness Maps are actually single Bitmap where the values are incorporated into the Green and Blue Channels. So when setting a Reflection Strength and Roughness maps, please make sure they are the same dimensions. If they are not, then the Reflection Strength map will be scaled to match the Roughness map.
  4. Color-Alpha coupling: Same goes for the Color Texture and Alpha Map, as they will be merged into a single RGBA Bitmap.
  5. Mix Strength: glTF mixes between the Main Color and the Texture by component-wise multiplication of the RGB values. This required an adjustment method of the Color value or the Texture pixels at Export to achieve the same mix as in Cinema 4D. It’s still WIP and artifacts may appear in the result.
  6. Normal map strength: When setting the Normal map in the Reflection Channel… The strength, or “scale”, of the Normal Map is defined by the product of Bump Strength and Strength.
  7. Error Messages: Proper Error Descriptions are yet to be included, if you run into an error, it will most likely say “Out of Memory…” but it’s very rarely so.
  8. Polygon Selection: Polygon Selection is not yet supported, please manually Split the object and apply the different materials accordingly.
  9. Color properties priorities: If Color Channel is enabled, its properties override the Layer Color properties set in the Reflection Channel(i.e. Color, Brightness, Texture and Mix Strength)
  10. Normal map priorities: If Normal maps are set in the Reflection Channel, Normal Channel and Bump Channel. Then the Normal map and its Strength are retrieved from the Reflection Channel first, Normal Channel second, and Bump Channel last.
  11. Instances: not supported yet. instances will be baked into a new polygon object.
  12. Cubic Spline animation curves: in Cinema 4D, two coefficients define the tangent of every key: “value” and “time”. In glTF, a tangent is defined only by “value”. If your exported animation doesn’t look the same, consider baking the animation.
  13. Linear/Step curves: An animation property(Translation/Rotation/Scale) will be exported as Step Interpolation only if all its keys interpolations(in the x,y,z curves) are set to Step, otherwise it will be exported as Cubic Spline.
  14. Pose Morph OR PLA: It’s not possible to export PLA and Pose Morph animations together.
  15. Pose Morph global Strength: The global Strength value and its curve in the Pose Morph tag cannot be exported, it is multiplied by the other strength values.
  16. Pose Morph Animation curve type and global Strength: Same as the two notes about curves above, the animation curves of a Pose Morph tag are exported as Linear/Step only if all their keys are set to Linear/Step interpolation. If the global strength curve is set to Spline interpolation while the rest are Linear/Step, the interpolation type will be Spline, even though the global strength isn’t exported.

Requirements

Cinema 4D R20 and higher.

Download

Last updated April 10th, 2019

Installation

Simply unzip the downloaded archive into the “plugins” folder.

Support

Provide your bug reports, test scenes or ideas by writing an email to labs-at-maxon-dot-net

Please rate this

68 Comments

  1. I didn’t see this in the Known Issues section so I thought I’d bring it up:

    Exporting a bunch of separate cubes with different textures on them, I’m getting this from the validator over at Don McCurdy’s GLTF viewer – https://gltf-viewer.donmccurdy.com

    VALUE_NOT_IN_LIST Invalid value 9987. Valid values are (9728, 9729). /samplers/0/magFilter
    VALUE_NOT_IN_LIST Invalid value 9987. Valid values are (9728, 9729). /samplers/1/magFilter
    VALUE_NOT_IN_LIST Invalid value 9987. Valid values are (9728, 9729). /samplers/2/magFilter
    VALUE_NOT_IN_LIST Invalid value 9987. Valid values are (9728, 9729). /samplers/3/magFilter
    VALUE_NOT_IN_LIST Invalid value 9987. Valid values are (9728, 9729). /samplers/4/magFilter

    I hope that feedback is helpful,

    Spence.

  2. I love the new baked animation stuff. Thank you.

    Still unable to export multi-material meshes. Is this on the roadmap? I’m writing a blog post for Torch3D (which uses gltf exclusively) and, unfortunately, I have to include a C4D->SketchFab->Torch step. I’d love to be able to just go C4D->Torch

    Thanks again, this plugin will be mighty when you’re done.

    -Spence.

  3. Great job! The scale factor was a great addition. I just wan’t to report a small bug. Apparently, the factor is being applied only to the scale of the objects, and not to their transfrom (position). So, let’s say you have two objects on the same scene on C4D, and one of them is on position y=0 and the other y=1. When viewing the exported scene on Three.js, the second object will be at y=1000, even if the scale was corrected by the scale factor when exporting. So the scene will look very different, with correct scale but wrong positions.

  4. HI Basel! im working with ventuz software, hope you heard about that, so now it has support of glTF 2.0 format for use rigged animations, in this format Geometry, Animation, and some other things can be stored so i make Eagle animation in cinema4d r20, export it as glTF import to vetntuz, model is there but no animations, but if i export same project as fbx and then convert it into glTF online then i can see my animation in Ventuz, whats issue can be there?

  5. Thank you for the Exporter.
    Can you tell me what´s wrong with Clay Viewer when loading the GLTF file?
    Thanks

    • Hi Zed,
      you’re welcome, glad to know you resolved the issue 🙂

      Cheers,
      Basel

  6. Hi,

    Hi, I cant get this to show in my export window. I have created the plugins folder and have added both files along with the res folder. Quit and restarted my machine a number of times. The gltf export option just isn’t there. I have also pointed C4D to the plugins folder manually and the other plugins I have for c4d show and are fine.. Can you please advise. I’m very anxious to have this working. Thanks. ps, I’m running Windows 10 and R20 C4D.

  7. Hey Basel! How about a quick video going over the shader stack? I would really like to see your workflow. Or maybe post a few baseline textures? Thanks!

  8. This is prefect 🙂 I really hope the Plug will find a way as a permanent/regular c4d-exporter into c4d in future releases.
    First i thought it didn´t work in ThreeJS. Before you export from c4d, keep an eye on the scene scaling. My objects were always to big. In ThreeJS they were clipped because of there big size. But after scaling them down to a really small value everything worked perfect. Then i adjusted Near- and Farclipping in ThreeJs an now i can export the Models in a normal worldscale… It would be perfect to have the option to set a scaling factor in the exportwindow. Thank you very very much for that great work 🙂

  9. Basel could you please date-stamp the latest versions so we can easily tell if/when it has been updated.

  10. I sure hope Maxon realizes how important this is and prioritizes robust support for an R20 patch or for R21 at the latest. glTF is becoming a big deal. Thanks Basel for your work on this.

  11. Here are a couple of bugs with the exporter

    – file should include an asset.generator string so devs can identify how it was created

    – animations should be bundled into a single glTF animation entry if they’re meant to be played together, not separate small animations for each piece of the model

    – something is buggy in the TRS animation export, maybe quaternion rotations need to be resampled.

    • Hi there Alek,
      thank you for bringing these to my attention
      – I see, thanks I will get it done for the next build.
      – ditto.
      – Correct, I also noticed this last week and got it fixed, will be available in the next build.

      Thank you for your feedback and make sure to check back in the upcoming days for the new build 🙂

      Cheers,
      Basel

    • Thanks Martin! Let me know how it goes for you and if you have any complaints 🙂

  12. Hi,

    Thanks for this plugin, Basel – great work! We are trying to use UV channel 2 from Cinema 4D for AO in three.js, but it doesn’t seem like this plugin exports the second set of UV coordinates. Is this is true, or are we doing something wrong? If not, could it be updated with this feature?

    • True, this is missing… It’s a simple fix, I’ll add it and you can find it in the next release 🙂

  13. Thanks so much for this Basel. I’m exporting with and image texture but get a I get a kind of grainy/noisy shimmering when looking round the model in the viewers (babylon, domcurdy) but when exporting from blender everything is smooth. This is amplified when viewed in VR. Known issue? Thanks again.

    • I managed to get this plugin working (I had polygon selection, doh!) but am seeing the same issues. Like anti-aliasing problem. MIP mapping issues?

      • Testing with babylon it shows that mipmapping is not present.

      • Thank you for bringing this to my attention, it has been fixed and will be available in the next release soon 🙂

  14. Sir, you are a legend!!!

    I’m having issues with my image textures though. Cant seem to get them to show up in my exported file. I’m testing with babylon js sandbox. All working great apart from the image texture. I’m using a PBR material with the image texture in Reflectance > Default Diffuse > Layer Color. Have played around with setting but no joy. Any tips?

      • Double check the notes and limitations above. I was using Polygon Selection; Where I was applying multiple materials to one mesh via selected faces. When I broke the mech into separate parts so each had only one material the texture image showed.

  15. First of all, thank you for your work!

    Is there a roadmap or something like this?
    Will you be supporting extensions like Lights and Draco Compression?

    • Hi Viktor,
      no roadmap is planned but to follow the standard glTF 2.0 specification as best as possible 🙂

      Cheers,
      Basel

  16. Unfortunately, this doesn’t work at all when trying to load scenes in to Three.JS.

    • Maybe you ran into the same problem that Fabian Kerbusch mentioned. Have you tried scaling?

  17. Oh goodness, Thank you so much, its excelent working on C4D R20 , i expored object with PBR material and this is worked without any problems. I want to transit my project into a web site, due this plugin i can do this pretty simple!!!

    • Hi Iain,
      please double check:
      – You have Cinema 4D R20 or higher.
      – xlib/xdl64 and res folder together under /plugins folder of your Cinema4D(create one if missing).
      – Restart Cinema 4D and check File->Export: is the gltf option available?

      • Hi, Thanks for your quick reply. I am running C4D r20 and have created a plugins folder in program files/MAXON/Cinema 4D R20/

        I have restarted a number of times.

        Thanks

  18. Is it possible to have some kind of notification or be able to subscribe to a repo or something for updates to this?

  19. Oh yeah! The current export-pipeline via FBX and a Commandline-Convert-Tool was… let’s say… ineffective 😉
    Thanks a lot Basel for your work!

    Does anybody know when Maxon intends to add glTF import/export functionality right away?

  20. Awesome news! This means you can now create WebGL applications with Cinema 4D (possibly with Verge3D).

  21. Animation support including multiple animations is a must. GlTF supports this and I’ve previously managed to achieve this via takes > export to fbx > convert to gltf using fbx2gltf. Would be awesome to have this native though. Also +1 for import!!

  22. Hey, that‘s great news! Is an importer for gltf also planned? Would be great to work with sketchfab models without havimg to go through Blender etc.

  23. Fantastic work Basel! Much needed plugin (you saved us some gray hair)
    Plus one on animation
    many thanks
    Vertex Helix

Leave a Reply

Your email address will not be published. Required fields are marked *