Cinema 4D

From NoskeWiki
Revision as of 02:18, 6 February 2019 by NoskeWiki (talk | contribs) (Created page with "==About== '''Maxon's Cinema 4D''' is a commercial, cross-platform, high-end 3-D graphics application, noted for its flexible interface and ease of use. It is capable of proce...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

Maxon's Cinema 4D is a commercial, cross-platform, high-end 3-D graphics application, noted for its flexible interface and ease of use. It is capable of procedural and polygonal/subd modelling, animating, lighting, texturing and rendering.

Graham Johnson from The Scripps Research Institute, a professional medical illustrator, introduced me to this application in 2009, and I was impressed by it's ease of use over 3D Studio Max. It is intuitive and has some fantastic metaball features. From the website you can download a 42 day free trial (activated via your e-mail address), after which you can no longer save files. An academic license WAS ~US $300 but now has gone up to ~$500, and it is $895 for a Studio edition. If this is too expensive, Blender is a free 3D animation program which is also very powerful, but does have a much steeper learning curve. For the rest of this page I talk about how to setup a scene, and perform a few nice tricks / effects in Cinema 4D, but you'll notice down the bottom there are several daughter pages, including an article on "Cinema 4D - Importing models from IMOD" which Graham helped with.


Child Pages

Related/Child Pages:


Scripting

One of Cinema 4D's draw cards (aside from its easy of use) is that it provides a several easy-to use scripting options which allow you to create your own plugin interfaces and animated "simulations". These options include: (#1) C4D's runtime scripting and programming language called COFFEE, which is similar in form to JavaScript, (#2) an advanced C++ API, (#3) a separate python API and (#4) a visual scripting option using something called XPresso. All of these options allow you to for developing platform-independent plug-ins, but are different in implementation. In many ways COFFEE is the more practical option for beginners and, unlike the C++ API, COFFEE doesn't require you to compile your own code and restart CD4 each time you recompile. Rather than explain these different options here, I have created separate page for each:


Related/Child Pages:


Visual Scripting

As well as writing code, it's possible to do "visual scripting" using XPresso. Select any object, then right click > Cinema4D > XPresso. Within this XPresso Editor you can drag objects on, navigate hierarchies and change properties. I found a nice introductory tutorial for XPresso here.



Setting up A Scene in Cinema 4D

If you've installed Cinema 4D it's a good idea to get into the hang of good coding practices and scene hierarchy. One good practice is to place all the objects in your scene under a single "Stage" object (Objects > Scene > Stage on the menubar). Thanks the the interface, you shouldn't have any problem finding out how to add any of the objects I talk about - just click the button that looks like a cube (or the other buttons next to it) and it will show a list of privatives and modifies which you can add. To get started you may consider adding a "Sky" and/or a "Floor" object. After adding solid (primitive) objects into your scene, the next thing you'll want to do is add lights and a camera.


Setting up the Lighting

To add a light is really easy: just click the light icon and select between a normal light (emanates from a single point, like a light bulb), target light (a spot light with a target), area light (think more like a big rectangular office light), infinite light (lights everything equally from same direction and has no falloff) and sun light (an infinite light with a cool feature to select the time of day). With the light selected, you can move it, and under Attributes > General you can change its intensity (how bright it is), color and falloff distance (how far before you can no longer see its effect).

  • TIPS:
    • To make the scene look more professional it can be a good idea to use a three-point lighting system (key light, fill light and back light).
    • For each light you add, you will probably want to adjust its "intensity" and set "shadow".


Adding a Camera

Before making a movie you will want a camera and I recommend using a single "Target Camera" - as this is easier to manage for simple animations. Click: Objects > Scene > Target Camera, move "Camera" to a better location (looking onto model) and notice that it always stays pointed towards "Camera.Target.1". You can animate the camera just like any other object.

Within your viewport go Cameras > Scene Cameras > Camera to see through and help position your camera, and go Cameras > Editor Camera to go back to editing things.


Making Textures

To add a new texture click File > New [Cmd+N] within the "Material Manager". Double click any texture in the "Materials" manager to edit it. To apply a texture to a object, drag it onto the object in the Objects Manager.

  • TIPS:
    • To see objects underneath tick "transparency" and adjust its "brightness".
    • To make objects appear "wet" turn on "specular", and make a small, sharp highlight.
    • To make surfaces appear more "intricate" or bumpy tick "bump" and add a noise texture.

NOTE: To create a pattern on a texture click "Color > Texture" then browse for the image file. If the texture renders funny, you should select the tag and then try changing the Projection from "UVW Mapping" to Cubic or one of the others. You'll also probably want to play with the Tiles U and Tiles V value. To then "bake" a texture to a mesh, right click the texture map and chose "Generate UVW Co-ordinates" (this option only appears if it's a mesh)... a new "UVW tag" then appears and if you select this you can click the "Structure" tab then "Mode > UVW" to see the coordinates for each polygon in the surface.


Creating Animation

Creating animation is usually the final step in the creative process and Cinema 4D has a very easy interface for creating animation:

  1. Select the object you wish to animation.
  2. Go to frame 0 (or enter '0 F' in the left textbox under the timeline) and click the "keyframe" button [F8] (the red key icon) to create your first keyframe.
  3. Go to another frame and move your object.
  4. Click the keyframe button again, and a second keyframe will be added. NOTE: You can also scale, rotate and change properties so long as the appropriate yellow toggle button (right of the keyframe button) is checked.
  5. Use the playback controls to see your animation.

NOTE: For more advanced movie editing options, click the "Layout" button (just below undo) and switch to "Animation" mode. Here you will see a much more advanced movie timeline showing all of your objects. By default Cinema 4D uses "ease in-ease out"/spline interpolation between keyframe, but you can change this if you click the gray graph icon (next to the gray key).


Rendering your Movie

To render the movie:

  1. Go Render > Render Settings to open the "Render Settings" dialog.
  2. Under "Save" change "Format" to "QuickTime Movie" and set "Path" to a sensible file name (to save to).
  3. Under "Output" change "Frame Range" to "All Frames". NOTE: You might also want to change the width and height.
  4. Close the dialog and then go: Render > Render to Picture Viewer [Shift+R].

NOTE: As the movie renders, you can minimize the Picture Viewer window and continue working on your model. C4D is very good like that.


NET Renderer

Rendering large movies can be very slow - hence animation studios have huge "render farms". If you have access to multiple computers you can speed up rendering (roughly by the number of computers) using C4D's "NET Renderer". Instructions are within the QuickStart Guide (pg 121) - I found it pretty easy to set up, once the server and clients are running, you simply use the browser/web interface (eg: http://XXX.102.117.77:8080/) to upload the .c4d files to process, and it's intelligent enough to do the rest (by distributing a range of frame to each machine). If you need access to a larger render farm, there are several sites, such as renderrocket.com which will allow you access to large on-demand C4d render farms for quite reasonable prices.


Tricks

Place a 2D Image in the Foreground or Background

To add a watermark to the foreground:

  • Open Adobe Photoshop, make a new 800x600 image with your logo in the bottom corner and save as "logo.psd".
  • Add a new texture in CD4 and double click it to bring up the Material Editor.
  • Untick all options on the left then tick "Trasparency".
  • With "Transparency" selected, click the right arrow next to "Texture" and "Load Image". Select "logo.psd" then close the dialog.
    • NOTE: You now have options to 'Edit Image...' (in Photoshop) and 'Reload Image...' to modify the image..
  • Go Objects > Scene > Foreground, then apply your new texture to the "Foreground" object.
  • Click the "Render View" button to see the result.

To place your image behind objects, simply use a "Background" object instead. To give the watermark a more washout appearance try using "Alpha", or use "Color" to make it solid.


Add 3D Text

To add 3D text:

  • Go Objects > Spline Primitive > Text. And enter text in the "Attributes" manager. As a 2D spline the text currently won't render.
  • Go Objects > NURBS > Extrude NURBS. TIP: To make it look 2D set its "Movement" in Z to 0.
  • Drag the "Text" object under "Extrude NURBS" (so it becomes a child).
  • Add texture tags to "Extrude NURBS" (not "Text")

To make the text face the camera select "Extrude NURBS" and right click > Cinema 4D Tags > Look At Camera. Unfortunately the text flips the wrong way around, but this is easy fixed by selecting the "Text" and setting its 'H' rotation to 180. As long as "Enabled" is ticked, the text will remain faced towards the active camera. To make the text stay in the same position relative to a camera consider making them children of "Camera". NOTE: If you only want the text to spin on the Y axis only untick "Change Pitch Rotation" on the tag properties..


Create a Fade In or Fade Out Effect

Changing the opacity of individual objects (plus their children) over time can be a bit tricky:

  1. Select the object you wish to fade in then right click > Cinema 4D Tags > Display.
  2. With the display tag selected tick "use visibility" in the Attributes Manager. NOTE: This tab also has options for backface culling and changing the objects appearance in the Editor.
  3. Go Window > Layout > Animation Layout.
  4. In the Timeline Manager, expand your object and select the "Display" tag then right click > Add Property Tag > Visibility
  5. Select "Visibility" then go File > Add Key At and enter '0 F'.
  6. Double click the keyframe just added (it will highlight yellow) and enter '100%' (for opaque).
  7. Enter another keyframe at '100 F' and give it a value of '0%' (for transparent) (repeating previous two steps).
  8. This does not show up in the editor, but if you go to frame 50 and click [Cmd+R] you should see the effect. NOTE: If a child has a display tag with (ticked) use visibility of 50%, it will not adjust with the parent.


A similar result can be achieved by selecting a material in the Timeline then right click > Add Property Tracks > Transparency Brightness (its transparency must be turned on of course). This will apply to all objects with this material. To make an object suddenly appear or disappear select in in the Timeline then right click > Add Property Tracks > Visible in Renderer (you can set it to on, off or default).

NOTE: When you select a keyframe, you can change its "Interpolation" between spline, linear and step... plus several other settings in the Attributes Manager.

WARNING: If you have too many overlapping semi-transparent objects (>7) they may appear blotchy - you can fix this by going to RenderSettings > Options and increasing the "Ray Depth" so rays penetrates more than 15 surfaces


Polygon Reduction

If you discover a mesh contains too much "jaggedness" or too many points (say >100,000) to render well you may wish to use polygon reduction. To do this, click the modifier icon (the icon of a bending prism on the top menu bar) and select "polygon reduction". Within the Objects window, drag the polygon reduction object (which you just added) under the polygon you wish to simplify. With the polygon reduction selected, modify the "Reduction Strength" to change how many polygons are removed until you find something you're happy with. Unfortunately, polygon reduction objects tend to slow down C4D, so to make these changes permanent right click your polygon and select "Current State to Object" and you can delete the original object. To see how many points are in any polygon you can select it in the "Objects" view then switch to the "Structure" and see the whole list of points.


Smoothing Meshes

There are various ways to smooth a model. If the model simply has too many points the Polygon Reduction method works fairly well. However, if the mesh itself is jagged and you want to smooth it out it is very difficult to do this without deforming the shape. There is a nice plugin here: Smooth plugin which can be added to the "Cinema 4D/plugin" directory, restart Cinema 4D then add a smooth deformer (via Plugin > Smooth > Smooth Deformer) and place it under the object. Another method is to add the "HyperNurbs" object. With both these options however, you must be careful of it shrinking and deforming the polygon beyond what you consider acceptable.


Make a Wireframe

To display and object as a wireframe is a little bit tricky, but there is a good tutorial here. To summarize their instructions.

  1. If your object is not a polygon right click > Make Editable [c] to make it a polygon.
  2. Select the object then go Tools > Polygons to switch to polygon editing mode.
  3. Press [Cmd+A] with (your cursor in the view port) to make sure all the objects polygons are selected.
  4. Go Structure > Extrude Inner. Under Attributes untick "preserve groups" and set "offset" to an appropriate size (0 won't work so try 0.5).
  5. Press [delete] to delete the selected polygons, and be left with a wireframe. NOTE: Yes, you may want to make a copy of the original object at the start!

In the tutorial they suggest you try going to Render Settings, then click Effect > Cel Renderer to render edges more effectively. If you have "MoGraph", and easier and more versatile method of making a "wireframe" is to click Plugin > Cinema4dsdk > C++ SDK - Atom. Any object you place under this Atom in the object hierarchy (sphere, cube, polygon etc) will thing display as a "atom like" cylinder and sphere model, and you can change the radius of the balls and sticks independently.


Making Winding Tubes and Tree-Like Structure

In cell biology there are many tube and tree like structure, so it is good to know how to model these. I've explained the basics below, but for a more advanced guide with pictures I recommend you read this excellent tutorial: "making and rendering a dead tree". To create a tube:

  • Add a "Bezier Curve" and draw out the rough shape you want your tube (you can change the points later).
  • Add a "Circle", and adjust the radius to the starting width you want your tube.
  • Add a "Sweep NURBS" object (from the Modifier), and drag below it the the circle and, under that the bezier curve. It should now produce a "winding tube" by dragging the circle along the spline. With the NURBS selected, you may want to remove the cap on one end, and probably want to change the "end scale". You can still select the bezier curve and use the point edit mode (on left) to change the curve.
  • To add multiple branches, repeat the above steps (or maybe just cut and paste the whole sweep nurbs), adjusting the position and the radius so the branches come out at the appropriate point. If you want all your splines the same radius, an alternative is to combine splines using right click "Current state to object" or someone's written a nice plugin called "Spline connector" (here) which lets you keep your spline objects separated. Finally you may want to make it one seemless mesh, by selecting them all (on the right) and "Convert to object", then use the Delete Polygon and Create Polygon to achieve this (see dead tree tutorial).
  • An alternative to this Sweep NURBS method is the HyperNURBS approach. Start by adding a "HyperNURBS" object, then add a "Cube" under it and make the cube editable by selecting it and pressing "c" or right click "Make Editable". Now use the "Bevel" tool (Structure > Bevel) to extract one (square) polygon at a time, drag it out, and then continue beveling, scaling and moving the new polygons you've created to make seamless branches. This can be pretty powerful, and I actually prefer this method because you don't have to worry about branches being separate meshes and sticking into each other.


Using BodyPaint

Using BodyPaint is a little tricky at first, but the following steps should get you started:

  • Switch your layout to "BP 3D Paint" using the top left icon or Window > Layout > BP 3D Paint.
  • Select Tools > Paint Setup Wizard... select the object/mesh you wish to paint and follow the prompts.
  • Select the Paintbrush tool (or one of the other tools on the left, select a color and start painting.

You may also want experiment by turning "Projection Painting" on and off (Tools > Projection Painting). If you wish to see what the texture image looks like switch to "BP UV Layout" layout then on the right window click "Texture > Texture_You_Want.tif" then "UV Mesh > Show UV Mesh" and it should appear and let you draw in either window.



Links


Acknowledgements: Graham Johnson from Scripps for introducing me to this software :-)