Shading, Lighting & Rendering with Cinema 4D R19 (Part 5)

So far in this series of articles, we have looked in detail at the basics such as BSDFs and material systems, explored the possibilities of textures and shaders and delved into the art of realistic lighting. Now it’s time to draw all this elegantly and efficiently in pixel images – the term rendering describes nothing other than the drawing of a pixel image by the computer based on the parameters of a 3D scene: objects, shaders, light, camera and render settings. The software used for this is a so-called render engine.
C4D’s native render engines work directly with the settings of the camera used in some aspects. It therefore makes sense to familiarise yourself with the camera object first.

Using cameras

To create a camera as an individual view in the editor window, click on the camera icon in the main menu bar of Cinema 4D, select in the editor menu Menu > Cameras > Use camera or click on the white square icon next to the camera object in the Object Manager. Clicking and holding the camera button also offers the choice of other camera types, such as the motion camera for the behaviour of a real, hand-held camera.
Example: “Steigenkogel” animation:

Camera parameters

There are numerous parameters in the attribute manager of a camera object, the most important of which we will now look at.

Object tab
  • Focal length defines whether the image corresponds more to a wide-angle or telephoto lens. In order to use millimetre-based size specifications such as focal length sensibly, scenes should be constructed to scale.
  • Film offset determines a 2D offset of the image.
  • Focus distance allows the focal plane to be linked to a freely selectable object via the focus object.
Physical tab
  • (only relevant when using the physical renderer)
    Film camera simulates the shutter of a film camera.
  • Exposure controls the light sensitivity.
  • Shutter speed controls the degree of motion blur.
  • Shutter offset and shutter efficiency determine the offset and hardness of the motion blur tail.
  • Lens distortion creates a curvature effect in the image.
  • Vignetting creates a darkening towards the edge of the image.
  • Chromatic aberration shifts the primary colours red, green and blue with increasing depth of field.
  • Aperture defines the aperture opening.
Image composition tab

This tab provides helpful orientation for image composition according to aesthetic principles (e.g. golden ratio etc.)

Details tab

When using the standard renderer and its depth of field, the parameters for depth of field (old) indicate the areas from where to where – starting from the camera – the depth of field is greatest.

Spherical tab

his tab allows you to easily render 360-degree environments of your scenes, e.g. as HDRI textures.
By the way: With the Stage object under Main menu > Create > Environment, you can switch between cameras in an animated way without having to use an editing programme. Example: “Steigenkogel” animation (see above).

Global Illumination – Basics

Image O1: An example of global illumination in outdoor scenes – or not? Scene from the Maxon QuickStart Training Shading, Lighting & Rendering

Now we come to the actual rendering process. In contrast to manual lighting, the techniques of which we learnt about in the last article, indirect light can also be generated automatically using global illumination (GI). The use of GI therefore initially requires less skill and appears more convenient, but GI settings need to be optimised and can tend to render significantly longer.
GI differs from local illumination (i.e. manual lighting) in that the rendering process itself is significantly involved in generating the light. GI calculates the interaction of light between objects by randomly firing beams at many points in the scene. Indirect light is thus generated automatically, as illuminated surfaces produce diffuse reflections. Materials with an activated luminaire channel are also interpreted as light sources, so-called polygon lights.

Polygonal lights and portals

Image O2: The Illumination material channel for material-specific adjustment of GI processing. Here is a window glass material with the Portal option activated

Objects with luminous materials can be defined as polygon lights in the Illumination material channel. In this channel, further GI parameters can also be adjusted for specific materials, such as the brightness and saturation of the GI processing of a material. If there are transparent surfaces in the scene, e.g. windows, through which GI rays penetrate into the room, the Portal option should be activated in order to significantly improve the GI calculation.

Beam depth principle

GI includes the principle of ray depth, i.e. how often light is reflected by objects. However, the ray depth parameter is only visible if a secondary method is selected that is capable of ray depth (e.g. light maps).
Important: In the case of polygon lights, ray depth 1 only describes the direct light emitted. In the case of real lights, this already refers to reflected, indirect light. Primary and secondary intensity regulate the weighting of the first and further reflected rays.

Primary and secondary GI

In C4D, GI is selected as an effect in the render presets. The GI calculation for standard and physical renderers is made up of a primary and a secondary method, which can also be selected separately.
The primary method is responsible for light emission from polygon lights and the first indirect light from objects illuminated by real lights. The secondary method is responsible for indirect lighting and can significantly accelerate the primary method. There are four GI methods on board: Quasi Monte Carlo, Irradiance Cache, Light Maps and Radiosity Maps. (Each render has its own GI.) Let’s take a closer look at the methods:

Quasi Monte Carlo (QMC) – the pedant

QMC follows the principle of statistical approximation using a fixed, non-adaptive number of samples that are shot into the scene from each object pixel to determine the brightness and colour of its surroundings. QMC is the most accurate and reliable in terms of artefacts, but tends to be grainy and is the slowest method.
Acceleration using a secondary method is particularly useful for QMC. The main parameter Samples describes the number of rays that are used to calculate the image – the presets “Low”, “Medium” and “High” provide a good starting point.

Irradiance Cache (IC) – the softie

Unlike QMC, IC adaptively adjusts the calculation density to the complexity of the scene. Large areas are thus calculated more coarsely than small areas. This is visible in the different point density in the pre-pass, the scene scanning before the actual rendering. Its
Result – the irradiance – is stored in a cache for reuse. IC is therefore significantly faster than QMC, but tends to have weak contact shadows and flickering during animations.
The above-mentioned Samples parameter also applies to IC. However, IC also offers an extra Irradiance Cache tab. Here, entry density determines the distribution of the shading points, Min./ Max. Rate determine the size of the pre-pass pixels in relation to the image pixels and Minimum/Maximum Distance determine the density in critical or non-critical areas (large areas).
In most cases, the entry density presets “Low”, “Medium” and “High” can be used.
However, if flickering occurs in large areas of animations, the number of samples should be increased. If flickering occurs in small areas, the maximum distance should be reduced or the entry density increased (tab
Irradiance Cache).

Radiosity Maps – Radiation wallpapers

Radiosity maps are a secondary GI method that can significantly speed up the primary method by converting the calculated GI into internal, cacheable textures. Particularly in combination with QMC as the primary method, radiosity maps thus demonstrate their speed advantage, although this comes at the cost of higher RAM consumption. In the Radiosity Maps tab, map density, resolution and sample subdivision determine the oversampling of these radiosity textures.
However, radiosity maps have one disadvantage: a limited beam depth. In connection with polygon lights, no reflection of indirect light is added, but the calculation is still accelerated considerably. With real lights, a reflection of indirect light would be added.

Light maps – ray chains

As a secondary method, light maps enable a high and yet fast calculation of beam depth. The method is cacheable and is predestined for interior spaces. The camera shoots a large number of visual rays into the scene (paths, light map tabs). These are reflected by geometry and the points of impact are evaluated according to brightness and colour. The results of the resulting ray chains are stored in a cell-like light map. The size of these cells visible in the pre-pass is the interpolation accuracy.
The Light Maps tab offers control over the number of visual rays with Path Count, while Sample Size refers to the size of the sample area between these ray chains. The sample size can be specified with the Screen in values relative to the camera section option or with World absolute. The latter is recommended for camera animations, as is the Use camera path option. For object animations, activate the Full animation mode option in the Cache tab.
If flickering occurs in corners of animations, it helps to increase the number of paths (see Fig. 03); if flickering occurs in small areas, reduce the sample size.
Pre-filtering together with interpolation homogenises an uneven, blotchy light map but tends to create light leaks, e.g. on walls. Increasing the wall thickness helps here. Also remember to activate the Direct light option when using real light sources.
By the way: Light maps can in turn generate radiosity maps (Light maps tab). This speeds up the rendering process even more.

Image O3: Render presets with activated Global Illumination. The primary method QMC is complemented and accelerated here by light maps. A high number of paths homogenises and improves the light map

Presets & Co.

The Preset drop-down menu can be found at the top of the General tab, which offers useful combinations of different GI methods for different purposes. It is a good idea to start with a preset depending on the intended use and adjust the parameters as required. The General tab also contains the parameters Discrete Area Light Sampling for better light and shadow mapping of polygonal lights and Discrete Sky Sampling for more precise shadows of HDRs and physical skies.

Render Engines

Now that we have made a technical excursion into the automated generation of indirect light, let’s take a look at the native render engines available in Cinema 4D: the Standard Renderer, the Physical Renderer and Pro Render.

The standard renderer

The standard renderer has always been the Swiss army knife of Cinema 4D when it comes to rendering images. Its advantages are the deepest possible integration into Cinema 4D, multi-passes, adaptive anti-aliasing and high rendering speed. However, depth of field and motion blur are only offered as post effects (available in the render presets) – depth of field (or, to put it another way, depth of field) therefore does not take into account transparencies or reflections. In Release 19, the engine has been accelerated by Intel Embree technology, which can speed up renderings by up to 100%. In the following, we will take a look at some specific parameters.

Antialiasing (AA)

Antialiasing can best be translated as edge smoothing and describes a fundamental problem of computer graphics: the depiction of many scene pixels on one screen pixel and the associated artefacts such as moiré, stepping or flickering. For high-quality anti-aliasing, multiple calculations beyond the accuracy of one pixel – i.e. in the sub-pixel range – must therefore be carried out.
If the standard renderer is selected as the render engine in the render presets, the Antialiasing item offers specific settings. (The physical renderer and Pro Render each have their own settings for edge smoothing)

  • None of them switch off anti-aliasing.
  • Geometry smoothes the edges of objects.
  • Best additionally smooths object surfaces, i.e. shaders / textures.

The standard renderer uses adaptive anti-aliasing for edge smoothing, i.e. an intelligent approach that dynamically evaluates the contrast of neighbouring pixels in certain tolerance ranges. Typical for an adaptive process, there are minimum and maximum values as well as a threshold value that is weighted in between:

  • Min level denotes the minimum quantity of sub-pixels per pixel, e.g. 1×1. This value is used in non-critical areas of the scene.
  • Max-Level is the maximum amount of subpixels per pixel, e.g. 16×16. This value is used in critical areas of the scene and can massively increase the render time.
  • Threshold value defines the contrast at which neighbouring pixels receive the adaptive AA, e.g. from 10% difference.
  • Evaluate object render tag: This checkbox defines whether the AA settings in render tags should be evaluated.

Optimise anti-aliasing

For high-quality anti-aliasing of textured objects, the best should always be used. If you still notice any stippling or flickering during the animation, reduce the threshold value. Only if a threshold value of 2% does not help, set it back to 10% and increase the Min value to 2×2. You should do the latter for animations anyway. One advantage of the standard renderer is that anti-aliasing settings can be defined object-specifically using a render tag
(see below). The option Force anti-aliasing, which allows object-specific settings, can be found in the Tag tab (Fig. 04).

Image O4: Still from the teaser for “Unter freiem Himmel” (https://vimeo.com/57539061). The scene was rendered with the standard renderer and benefits from high-quality antialiasing, especially in areas with a tapered perspective such as the ceiling

Filter

Filtering refers to the way in which anti-aliasing is applied to neighbouring pixels (e.g. sharpening or blurring). The use of depth of field (or depth of blur) serves to direct the viewer’s attention. The depth of field of the standard renderer is activated as an effect of the same name in the render presets. The focus distance and blur areas are defined in the Camera object, Detail tab. The depth of field of the standard renderer does not take into account transparencies and reflections.

Depth of field and motion blur

The standard renderer offers an intermediate image motion blur, which creates a definable number of intermediate images (samples) between two consecutive images and blurs them. It is also activated as a post effect. The effect is not compatible with Team Render.

The physical renderer

The physical renderer is the younger brother of the standard renderer and is designed to simulate physical camera parameters. Antialiasing is carried out using a separate process with the help of a unified sampler that combines samples for antialiasing, depth of field, motion blur and matte effects.

Sampling settings

There are three sampling procedures here. Different parameters are displayed depending on the selection:

  • Adaptive: Intelligent method that calculates more samples at critical points and fewer samples at less critical points.
  • Fixed number: Rigorous method with a fixed number of samples.
  • Progressive: This method samples a little better with each pass and can render endlessly if desired.

Sample quality: Presets of useful combinations can be found here. Automatic offers the sensational feature that all settings are only controlled by the one parameter Threshold. A value suitable for production is usually 3% – 8%.

  • Sampling subdivision prepares samples as subpixels for further processing by shading.
  • Shading subdivision (Min / Max) calculates adaptively subdivided pixel colour values depending on the complexity of the sample.
  • Shading threshold value determines the point at which the above shading parameters take effect.
  • Shading transparency check improves anti-aliasing for motion-blurred transparencies (attention, slower!).
  • HDR threshold protects the rendering from blurring effects caused by HDR textures.
  • Subdivision of matte effects, shadows, AO and SSS defines how coarsely these properties are to be calculated.

Depth of field and motion blur

In the physical renderer, the effects are directly related to the camera settings (Physical tab) and are calculated directly in the image. The depth of field takes into account transparencies and reflections. However, depth of field and motion blur slow down rendering – the latter in particular should therefore be
should therefore be done in post-production (image 05). The effects are activated via the corresponding checkbox in the Physical tab of the render presets.

Image O5: Forest scene from ZDF “Terra X – Planet of the Forests”. The real depth of field of the physical renderer is indispensable here, as the alpha maps of the leaves are also included
  • Depth of field: The strength of the blur is controlled via the camera’s aperture parameter: the smaller the aperture value, the stronger the blur (depth of field).
  • Motion blur: The effect offers options for subdividing the blur of animated objects (motion subdivision), animated deformers (deformation subdivision) and animated hair (hair subdivision).

Physical or standard?

Sample-heavy scenes or scenes with many transparencies and correspondingly strong anti-aliasing render significantly faster in the physical renderer. The standard renderer, on the other hand, as an all-round engine, outperforms the physical renderer in all areas in which little modern sampling and only manageable anti-aliasing are required.

Per Render

Standard renderers and physical renderers are CPU-based render engines, i.e. the computing power depends on the number and speed of the CPUs in your workstation. In recent years, however, GPU (graphics card) based render engines have been gaining ground. With the Pro Render developed by AMD, C4D also has a GPU-based render engine on board. In the following, we take a look at this engine with the current release 20.

Unbiased Physically Based Unidirectional

Pro Render is based on the principle of Unbiased Physically Based Unidirectional Pathtracing. This tapeworm term contains three important keywords: Unbiased refers to the elimination of systematically calculated inaccuracies in order to save computing time. Physically-Based-Materials (PBR – in the Material Manager Cmd Shift N) combine all light-reflecting aspects BSDF-based in the reflectivity channel and find a customised render engine in Pro Render. PBR materials should be supplemented with PBR lights for Pro Render. A PBR-based workflow ensures better reproducibility of shading and lighting in different scene contexts.
Unidirectional pathtracing means that random rays are shot into the scene from the camera and treated by objects based on BSDFs. Global illumination (GI) is thus calculated natively without additional settings, as reflections are not only specular but also diffuse. This so-called light transport makes it possible to calculate several rendering aspects (e.g. GI, depth of field, shadows, caustics etc.) at once. Due to these aspects, Pro Render is therefore ideally suited for scenes in which direct light is decisive, i.e. for outdoor scenes or product visualisations.

Kernel compilation

The first time you use Pro Render, it must compile its kernel for your hardware. This process is displayed at the bottom left of the status bar and can take up to several minutes for the first time. The regular rendering process then begins.

Interactive preview renderer

Pro Render can be used directly in the viewport. To do this, Pro Render must be started in the Viewport menu under Pro Render. Each scene update is then displayed almost in real time. All important settings for this can be found in the Preview tab of the Pro Render item of the render presets. The parameters there are basically a simplified summary of the parameters that are available in the Offline tab.

Offline tab

The parameters of the Offline tab define the final rendering in the Image Manager. So let’s take a look at its most important parameters in the Render mode drop-down menu.

  • Global Illumination calculates GI.
  • Direct light without shadow calculates no GI, no transparency, no shadow.
  • Ambient Occlusion ONLY calculates Ambient Occlusion.
  • Depth of field calculates blur based on the camera parameters (aperture etc.).
  • Motion Blur: Pro Render has Linear Motion Blur to animate objects and Interframe Motion Blur to animate deformations.
  • Max. Beam Depth defines how often rays are reflected to calculate GI. Click on the small black triangle to find options for further optimisation.
  • Antialiasing Samples determines the quality of the antialiasing.
    Filter / Filter size applies freely selectable filters to the calculated AA.
  • Crop radiance / value: This parameter is used to reduce brightness artefacts, so-called fireflies (see below), and acts like a cutback in the brightness of excessively strong rays.
  • Firefly / Firefly threshold: Fireflies are brightness artefacts that occur when a few beams (paths) hit small, very bright light sources. The threshold value prevents this over-illumination.
  • Detail level / Detail level display tag describes the level of detail of the rendering of basic objects, generators and metaballs in the image manager.
  • Final condition: Pro Render renders natively progressively, i.e. computational passes (iterations) are run through. The render result changes from coarse to fine and can be ended automatically. There are several possible conditions for this: Iteration count (number of calculation passes), time, threshold (falling below a luminance fluctuation from iteration to iteration) and none (endless rendering until cancelled by the artist).
  • Render update interval: Updating and displaying the intermediate render status in the viewport or image manager takes computing time. The render update interval determines the time or iteration interval at which the image is updated. The longer the interval, the more computing power is used for the iterations.
  • Rendering in buckets saves VRAM, as only the respective buckets, rather than the entire image, need to be stored in the graphics card memory.
  • Preset texture size: Currently, some Pro Render shaders have to be converted into a bitmap texture. The parameter indicates the preset texture resolution.

General tab

Here you will find settings that apply equally to offline and preview rendering. Let’s take a look at the most important ones:

  • Automatic lighting: If there are no light sources in the scene, an internal HDRI is used for lighting.
  • Static noise determines whether the grain remains static from image to image.
  • Beam epsilon (mm): Pro Render’s over-precise approach sometimes leads to self-shadowing of polygons or other artefacts. Ray epsilon shifts the corresponding ray in the normal direction and thus reintroduces a bias.
  • Out-of-core textures: Large bitmaps are only saved in VRAM if this is explicitly requested.

Multi-passes tab

Since R20, Pro Render has offered the rendering of multi-passes. Each of the multi-passes can be provided with anti-aliasing via a corresponding checkbox.

Limitations

Pro Render is in constant development and shows great potential even at this early stage. When learning to use Pro Render, you should be aware of its strengths as well as its limitations, such as the still rather slow speed, limited support for shaders, no subpolygon displacement, no light linking, no thinking particles, etc.

Save rendering time

Regardless of the engine, valuable render time can be saved by using various tricks when setting up the scene. The render presets and render tags play an important role here.

Render tags

Render settings can be defined on an object-specific basis using a render tag. To do this, the object is assigned a render tag via
Object Manager menu > Tags > Cinema 4D Tags to assign a render tag to the object.

Image O8: Adjusting the render optimisation: the render presets and render tags

Regardless of the default and physical renderer, the Tag tab can be used to define whether the respective object casts or receives shadows etc. and even whether it is visible in reflections or behind transparencies of other objects (Exclude tab).
If the standard renderer is selected, the Force antialiasing option can be selected in the Tag tab and the AA can be adapted to the specific object without having to increase the overall antialiasing in the render presets. Object channels (luminance masks) can be defined in the Object channel tab, which can be output as separate images using MultiPass (render presets). Furthermore, individual GI aspects and also Pro-Render-specific settings can be defined in the Render Tag.

Render presets

The render presets (Cmd B) are primarily used to select the render engine (Renderer drop-down menu), to add effects (e.g. Global Illumination) and to specify and save the rendering (Output and Save). The Multi-Pass item also offers the option of selecting certain aspects of the rendering (e.g. gloss, reflection, shadow or
Object channels from a render tag) as separate images / sequences in order to combine them in compositing. Individual parameter configurations can be saved as separate render settings.
The Options item in the render presets is particularly interesting. In the area on the right, you will find a number of controls that will make your life easier:

  • Threshold refers to the value below which transparency or reflections are ignored. A value of 3% instead of 0.1%, for example, can save a lot of rendering time.
  • Beam depth refers to the amount of transparency that the visual beam is allowed to penetrate before it displays black.
  • Reflection depth describes how reflections may be thrown back and forth. Always lower the value to 2 first to save rendering time for reflections. Because nobody needs the mirrored reflection of a mirrored reflection …
  • Shadow depth describes the amount of back-and-forth reflections or staggered transparencies up to which shadows may be displayed.

Simplify and check rendering

A large part of a project’s time is spent on simplifying, checking and possibly repeating the rendering. C4D’s tools for processing and checking the render load are welcome.

  • Team Render: Computers in a network can use Team Render to render together on a single image or an animation. To do this, the function must be activated in the render preferences and the Team Render client must be installed on each client machine. The client machines are then connected to the server via IP address and involved in the rendering process. Render jobs can also be administered via a web interface with the team render server.
  • Render Manager: The Render Manager (Main menu > Render > Render Manager) offers the option of automatically processing several render jobs one after the other, even in a network of several computers (Team Render). Projects can also be opened with all takes and only certain takes can be selected.
  • Take system: The take system of
    Cinema 4D allows you to create several variations of the scene in one and the same Cinema 4D file – so-called takes. This is ideal for creating render layers. The take system is located on the right-hand side of the screen as a vertical tab.
    New takes can, for example, have different lighting and object parameters or use different cameras or render settings. The key to variation in a take is the creation of a take-specific override of a parameter. The auto-take mode, which automatically saves all changes in the respective take, is particularly convenient.
  • Image Manager: The Image Manager is the central checking tool in Cinema 4D. For example, two results from the progression of rendered images can be defined as image A and B and compared with each other. In addition to the normal image, individual multi-passes can also be analysed separately.
Image O9: The take system: the auto-take mode automatically records changes in the relevant take. Separate render settings and cameras can be assigned per take – visible by the respective symbols

With the conclusion of this five-part series of articles, we have now gained a condensed yet complete insight into the large field of shading, lighting and rendering. All of this now needs to be applied confidently in daily practice or deepened with the Maxon Quickstart Training “Shading, Lighting & Rendering”. Have fun
with it