Your online Softimage Educational Resource

The blog has been online for more than 4 years and there’s still not a single post even remotely related to the delicious brew called coffee… Perhaps it will someday, but in the meantime you can read the articles about Softimage. Most of the material are tutorials and Q&As I’ve written for 3D World Magazine sometime between today and 2003. If you have any questions please don’t hesitate sending me an email.

Thanks to Letterbox Animation Studios for hosting all the scene files.

Make sure you visit their for 100s of hours of free XSI video tutorials.

Tuesday, August 5, 2008

2D Illustration Shading

The coffeemaker’s anisotropic toon material is achieved by the usage of a gradient node rather than actual toon shaders.

While pretty much every surface will hold a great deal of bumps and scratches if it’s just magnified enough, there is an important dissimilarity between any given surface and the one found on brushed metal for example. As the name might intimate, somewhere along the process the metal have been brushed or treated in a similar manner. The tiny grooves or scratches caused by this handling aren’t completely random as on most objects but forms a somewhat regular pattern with the all the bumps running in the same direction, which is what makes all the difference. Because of the uniformity, the reflections or specular highlights will stretch along the surface instead of evenly in all directions. This is called Anisotropic shading or reflection and can also commonly be seen on things like CD’s, hair and wood, to name a few.

With the quick breakdown of the central concept taken care of, it’s time to focus on recreating it in the 3D world. To get the most out of our material we need a set where it will feel right at home and where we easily can spot any inaccuracies. Given that I’m an obsessive coffee abuser, a quite common breed in the 3D industry I might add to my defense, I feel compulsory to exemplify the course of action with a coffeemaker. Well, fortunately there’s more to the coffeemaker than just the slight dampening of ones withdrawal symptoms. Since you rarely can go wrong with an attention-grabbing design and an neat combination of metal and plastic details, the model will in fact be a great stand in for a generic technical object. Furthermore, the prominent cylindrical parts are such an appreciative shape to use when trying out our faked anisotropic material. Applying a standard Phong or Blinn shader to coffeemaker would give us round-ish highlights, whereas our goal is to make it elongate properly from top to bottom. While this alone would introduce some potential issues, as the anisotropic shader found in XSI doesn’t behave correctly on polygon objects, we also need to attain a 2 dimensional feeling. As these types of illustrations are traditionally drawn in a paint program handling vector graphic, like Illustrator, we should hopefully have a fair idea of the style we’re aiming at.

Opposed to photo-realism where you strive for a high range of shades smoothly blended together, toon shading is all about reducing the soft gradient, creating blocks or bands of solid color instead. Although Softimage and Mental Ray offers some truly great tools out of the box for creating toon shading we’re not going to use them for the brushed aluminum effect. While the same or similar result can be achieved with those shaders (as discussed in the tips section), they wont add anything to our proposed material setup so there’s really no motive using them. Instead we’ll approach it more or less like you would in a paint program, by using a gradient to color the surface. The trick isn’t only about getting a nice representation on the gradient slider, but just as much regarding the manner of mapping it on to the objects. By using standard texture projections you’ll get a good deal of control of how and where the different color will be placed, but the downside is that you do have to place them manually. As an alternative we can use a vector value to position the gradient along a preferred axis. Since the whole purpose with the gradient is to fake the entire shading, by including the reflections, highlights and so on in the actual gradient node, we don’t need it to react to any light sources in the scene. As a result we can simply connect it directly to the material node, making it slightly faster to render.

If you’re the slightest familiar with the print industry, then you’re probably aware that colors don’t always come cheap. Due to these costs, manuals or assemble instructions are therefore often printed solitary in black and white. This, however, does not mean that our image automatically will be all pale and dull, just that we should limit our color scheme to shades of gray. The illustration just wouldn’t be complete without an ink line tracing the object. So today’s objective will be concluded by adding a toon ink lens shader to the camera, whereupon it’s time to hit the render button.

The project files used in this tutorial can be found at:

Brushed metal Step by step
You can never be seated to close to the coffeemaker, so follow these six steps to ensure it’s never further away than a mouse click…
Start by loading the scene toon_anisotropic.scn from the cover CD and browse through the scene to familiarize yourself. We’ll be using two different materials for the coffeemaker, which will be shared by the different objects and clusters. In order to make the handling of these a far bit easier we’ll apply the material to groups instead of the individual individually. Let’s start off by creating the starring material, the brushed aluminum.

Select the group called metal and apply any material to it. Open the Render Tree and get Texture Generators>Gradient. Disconnect all links from the shader to the material node and connect the gradient to the surface input. To map the gradient onto the surface we’ll use an Incidence node. This way we can control the spreading and behavior of the highlight both with the gradient and the incidence node.
So, get Illumination>Incidence and connect it to the Input of the Gradient node. Open the Incidence PPG and change the Mode to +X Axis. Check the Invert box, set the Bias to about 0.25 and the Gain to 0.8. As you might notice, it’s still not working properly, which is because we need to change the input type on the Gradient. Open the Gradient PPG and switch to the Input tab. Choose Scalar input as the Input Type.

Switch back to RGBA Gradient tab and delete all the markers, except three. More markers can be used to create further complexity in the shading. Give the left and right makers a light gray color whereas the one in the middle should be noticeable darker (I used RGB: 0.9 for the light gray and RGB: 0.7 for the dark). Try changing the markers positions (the round markers for the blend as well) till you get a nice anisotropic shading.
Let’s move on to the plastic parts. Select the group called plastic and give it a toon material. Lower the base color sliders to make it a tad darker. Switch of the Highlights and go to the Rimlights tab and enable it. Rimlights aren’t affected by light sources in the scene, and are neat method to fake the impression of light actually illuminating the surface. Set the coverage to about 0.8 and lower the softness to 0.1.
The only thing left to do is getting the so important ink line on the objects. Select the camera and open its property editor. Go to the Lens Shaders tab and click add. Select the Toon_Ink_Lens. Select it in the shader list and click Inspect. The ink line is far to thick in my opinion, so I lowered it to about a third. If you haven’t done so already, draw a render region in the camera viewport and enjoy

A couple of additional tips
A couple of tips to enhance your images and more importantly; to ensure that you’ll have plenty of spare time to hang around your local coffee machine

Tip # 01
Not all objects in your scene need necessarily to share the same color on the ink line. By enabling override in the Ink tab of the Toon material node, you can use the sliders to set different ink color per object instead of globally applying it to the whole scene. This will obviously require that you’ll use a toon shader for the anistropic material as well. Simply connect the gradient node to the base color of the Toon node, and disable the materials highlight.

Tip # 02
As mentioned earlier, you can use the Toon shader to create a similar material for the brushed aluminum. In this case however, you’ll use the Base color to set the color of the highlight rather than for the object. Disable the Highlights, switch to the Rimlights tab and enable both Layer 1 and Layer 2. This is where we will set the actual color for the object, so set it to whatever color you see fit (use the same color for both layers, though). Set the Softness to zero, to maintain the cel look. Now change the Vector for both layers from Camera to Left and Right and you can see how the material is developing. Play around with the different settings until you’re pleased with the way look.

Tip # 03
How the viewer perceives any given color, is greatly influenced by the colors surrounding it. The whiteness’ of a white box would for example be perceived very differently if you changed the scenes background color from black to white. While you are most likely to render your images without any setting any background color (in other words, with an alpha channel) you can still benefit from temporary using one during the development of your materials. The easiest way to change the color, when working with toon shaders, is in the camera’s Toon Ink Lens Shader PPG, under the tab called Background. Though, you might want to disable it again prior to the final rendering, as the background color affects the alpha channel as well.


Unknown said...

Good post! Many of my clients want NPR images. While I often give clients a few versions, some more realistic than others, they often go with the more stylized looking comps.

I think part of it is that they now think just about anyone can create a "real" looking image, so they want to instead have something different- that gives a "feeling" or relays a more abstract idea of/about the product or subject.

Besides, once you combine these renders with a bit of comp knowledge and some additional "hand made" flourishes it really opens the door to a lot of possibilities while keeping render times down etc. No need for the client to know that it took you only 10min-1hr to make five different style sheets!