An Alternative Cartoon Render Technique

As we all know, the cartoon renderer in Cinema4D XL v6 leaves a lot to be desired. There's no control over line thickness, or solarizing amount, and some shapes just look flat because the lines are only drawn around single objects. You can try to overcome this by writing your own shaders, but I discovered a technique that allows for a whole lot more control without any special plugins or shaders. This is a pure Cinema4D, out-of-the-box technique. Hope it helps some of you.

create a shape

For the render to show anything, you do of course need some object in the scene. I just built a quick hypernurb object with some overlapping shapes and wrinkles to have a good idea how the technique reacts to these kind of shapes. As you probably know, the built-in cartoon renderer only draws a line around a single object, so any surface irregularities don't receive the oh so neccesary line.

add a camera and a light

This technique relies on a light at the exact location of the camera, so you need a camera in your scene! Add one, and set the editor view to the camera. Next add a light, link it to the camera and use the coordinates manager to set it's position and rotation to 0,0,0. The light is now at the position of the camera and pointing forwards. You can move it a tiny bit behind the camera so the light's 'geometry' (the white asterix-type lines) don't obscure your view.

Now the fun starts.

creating the lines

The spot you just added is the 'lines' spot. It will take care that each object receives a black line, by casting a shadow from the point of view. Because it is soft, the shadow will be slightly larger than the object that casts it. This results in a black 'glow' around the object that can be made into a line with some tweeking. This technique does mean that you have to have an object behind each object, else the line will not appear. So the first thing you do now is add a sphere that encompasses the whole scene. A sky object won't work, because it doesn't recieve shadows. Just add a very large sphere.

Next, turn your light into a spotlight. An omnilight would mean you need 6 shadowmaps where the spot only needs one. And as the light is connected to the camera, you'll never be able to look outside of the light's cone anyway. Also set the inner angle of the spot [details tab] to some value. Now you can control the 'iris' of the whole image by just pulling the points of the spotlight, allowing for some very nice effects.

Okay, so we need a soft shadow on the light. Set it's shadow to soft, and use a mapsize of 1000x1000 [shadow tab]. Lower resolution maps will result in thicker lines, but will also show more artifacts. In the shadow tab, set the light's bias to 1%, uncheck absolute (don't know why, but this setting seems to work best for this technique). If you get very dreadfull self-shadowing or smearing, just turn up the bias in slight amounts. Remember you do need a low bias if you want even tiny irregularities in the surface of the object to show up as lines.

Because we want this light to only create the lines around an object, and not to actually light it, turn on 'ambient illumination' [details tab] and just to be sure turn on 'no specular' as well. This doesn't have any effect, but I'm a supersticious guy :).

Now make a test render.

Ain't that interesting! We have some lines! But you must admit, they aren't too well defined ... wait a minute, what about that 'outline shadow' option? [shadow tab] Turn it on and make another test render.

Ah, that's more like it! If we now add a fully white material to the object and the background, instead of the default 50% grey, we get a very nice black-and-white drawing, with varying line thickness. Also, lowering the shadow map size increases the line thickness, though also the vague-ness. Lowering the shadow's 'sample radius' makes the lines less vague but show more artifacts - resulting in ragged lines which actually can look kind of nice!

The settings of this image: shadow map 300x300, sample radius 1.


We only have an outline now. How about adding some shading, to define the form some more? You could of course just add some lights and make the object non-white, but that would also mean that the shadow-lines would get less prominent in places where there is a lot of light. No, we need to do something else, namely add a negative light to create the shading. Add a light and set it to distant type [general tab]. I do this so I can keep the light object itself in the view of the camera and define it's angle by simple rotation. Rotate it so that it 'lights' the bottom of the object. In the details tab, set it's brightness [details tab] to -50%.

That looks almost like there is an actual light in the left top corner! Now, make a test render to check out the details.

Hm, yes, well, nice, but we want a more cell-color like edge to the shading, don't we? Okay, let's turn up the contrast of the light [details tab]. The following image has a contrast of 120%. Higher values give you a more defined edge, but tend to flatten the image a lot as well. I personally kind of liked this well-defined but still gradiated look, as if it was colored with watercolor. I also turned 'down' the negative brightness to -20%.

One pitfall to look out for, is that the bacground sphere will be rendered with the same contrast setting. In the image above, the light is pointing forwards by an amount large enough that this will not be a problem, but if you're less lucky you might get this:

You can solve this by using a different kind of light, like a spot or a parallel spot, so that the negative light doesn't reach the background. Another fix suggested to me was to add a render tag to the sphere, and set it to 'Compositing background'. This way the sphere will only catch shadows, and not lighting. You'll lose the 'iris' effect, of course, but who needs that :).


So how about a small highlight? We'd need to color the object first of course, so first add some colored material to the object. Also give the material a well defined highlight (maybe even 1000% strength), so the final rendered specular will have that same solarized effect as the rest of the object. Add another light, set it to distant (for the same reasons as mentioned above), turn on 'no diffuse' (details tab) and rotate it so that the highlights are in the right place. Render.

That's about it. For this final image, I also gave the 'shadow' light a slight red/orange color. Because it is a negative light, this results in a blue shade on the object.


I know this technique will not work in all circumstances, and there are a few pitfalls. For example, a highlight will blow away a line if the two meet. This can look kind of nice actually, but there's nothing you can do about it. Also, surfaces that are almost perpendicular to the camera (ie you look along the surface) can show the tendency to have a fair amount of self-shadowing, smearing the lines in ugly patches. This can to some extent be solved by turning up the bias, though that would also mean some lines will get less prominent. Anyhow, it's a nice technique, and can just as well be used on already existing scenes without changing any materials. You'll need to redesign the lighting of course, as that's what makes up this look.

and finally

A final thing to try is to render a scene that is set up this way with ... the built in cartoon renderer! The lines will be even more defined while still retaining that varying line thickness. You'll loose the wonderfull watercolor-effect though.

On the next page you can see some examples of existent scenes rendered with this system.

...and you can download a c4d-file containing a cartoon render camera system. Just remove all existing lights from a scene, import this file, set the camera to 'cartooncamera' and see what happens. My guess is each scene needs it's own tweeking, but this file is a good start.

Now go play with those settings and have a good time :)