home about gallery publications education links contact

..::engineering material::..

Another version of 3ds max, another new range of questions. Here we go again! This one makes use of 3ds max 5’s new Ink and Paint material, which allows you to create a variety of flat cell-shaded effects, but are mainly all solid colour. Mixing various maps in with the main material, we can create additional styles, from gradients to cross hatching.

Engineering diagrams normally take on the form of the “Thick & Thin Line Technique”, and there are basic rules to govern this. Unfortunately, due to the new material’s limitations, some of this theory will not be relevant as we won’t be able to create all of these features. However, we can create the basic concepts of this effect, if not bending the following rules slightly. The basic rule is that a thick line encompasses an object, and the thin line picks out the relevant detail on the object. Additional line styles can be introduced to illustrate fictitious outlines, imaginary intersections, break lines and hatching. Several versions of the same material can be created with various line widths to create the thick & thin line technique, and to illustrate material changes using varying degrees of hatching, but for this example, I shall just cover the basics…

The material will take the form of a solid white colour, with medium-grey colour and width lines to create the detail, and lighter thin line hatching to generate differences in material types, but for this example we shall use it for the shaded areas. This might sound slightly complex, but the method is very straight-forward. After the Ink and Paint material is created, we have to drop the number of Paint Levels down to 1, else the white spaces between the hatching will appear shaded in darkest shadowed areas. To create the hatching effect, we could either use a procedural map, such as a repeating gradient, but for this example we shall stick with a trusty bitmap. Unfortunately, this bitmap will wrap itself around the object and will also be visible in lit areas, which, for this example, is not the effect we are after. Additionally, the colour of the main material needs to be white. Therefore a Falloff map should be created in the Lighted slot, checked to Shadow / Light and ensuring that the Light swatch is set to white. The bitmap should then be loaded into the Shadow slot. Again, we have the problem of the texture wrapping itself around the object. To solve this, set the mapping to Screen Environ mapping. The map is now stretched right across the screen, so increasing the tiling to 10 for both U and V will add more lines and also make them thinner. The hatching should also be at an angle, so enter -30 in the W Angle spinner to slightly rotate the lines. A quick test render shows our effect is working, yet the hatching fades in and out. Amending the Falloff map’s Mix Curve will solve this to create a harsh line where the hatching begins; this curve can be amended and positioned according to taste. Next, we need to change the colours of the lines used to pick out the detail in the object. Amend the line width to 1 and the colour to a dark grey and copy this colour from the Outline swatch to the Overlap, SmGroup and Mat ID swatches. Change the background colour to white and render. You will notice that some detail is picked out more than others. This can be easily resolved by using smoothing groups, especially if you’ve used a finishing tool like Meshsmooth on your object. Amending the smoothing groups will create extra lines and can add additional detail in your image. Finally save the image out using a bitmap format with an alpha channel. In Photoshop (or equivalent), load the selection of the alpha and Stroke a thick black line around the rendered object. This stroke method could be recorded as an action if you decide to render out an animated sequence.

Enlarge Screenshot Open up a scene and set the Environment background colour to white. Create a new Ink and Paint material in the Material Editor. Note that there are 2 levels of shade set as a default; amend this value to 1 else the hatching will be shaded further.
Enlarge Screenshot Add a Falloff map in the Lighted slot and amend the Falloff Type to Shadow / Light. Ensure that the Lit swatch is set to white and amend the Mix Curve as shown to remove any gradient from lit to shaded colour.
Enlarge Screenshot Add a Bitmap map in the Falloff map’s shaded slot and load in the “cross-hatch.bmp” file included on the cover cd. Set the mapping type to Environ – Screen and enter 10 in the U and V Tiling spinners. Rotate the map by entering -30 in the W Angle spinner. NOTE: To change the hatching to material type, simple remove the Falloff map and the entire material will be hatched.
Enlarge Screenshot Set the Outline swatch colour to a mid-to-dark grey and copy this colour to the SmGroup and Mat ID swatches. Set the Ink Width minimum to 1. To increase line quality, increase the Ink Quality spinner to 2 or 3, but beware: this will greatly increase render times.
Enlarge Screenshot If necessary, set or reset smoothing groups in your geometry to define lines and / or add material differences that could be used for additional hatching with other materials later on.
Enlarge Screenshot Save the rendered image as a 32 bit TGA file. Open it up in Photoshop (or equivalent) and load in the selection of the Alpha channel to create a selection area around the rendered object. Stroke the selection with a black line with a width of, say, 3. If required, this can be recorded as an action for animations to batch-process the individual frames.
Enlarge Screenshot The background and thick line have been added in Photoshop. Technically inaccurate because the thick line should encompass the individual objects, but line thickness cannot be easily set within the material itself…
Download the max file! Zip file to accompany.


To get the full benefit of this Q&A, and to understand the limitations of the material and how to get around them, it would be advisable to do a little bit of background research into technical drawing and CAD, if you have no prior experience of the subject. An excellent start would be at http://www.cadinfo.net/icad/linewt.htm which illustrates the types of lines used in technical illustration.

Just because 3ds max 5 now has a cell-shader, it doesn’t mean that other third-party cell-shader plugins are now obsolete. Illustrate! from David Gould is an excellent, and fast cell-shade renderer compared to 3ds max 5’s material, and comes with a host of features to enable you to create this effect properly!

Complete the image by creating an engineering background image to composite the rendered diagram onto. This may have to be done in post if the render is an animation as some elements may pass over the backgrounds line borders.

To reduce any inconsistencies and to remove the effect of the animated object “passing under the hatching”, create several versions of the hatching, each slightly offset, and load them into the hatching map slot as an animated sequence. Also, try using multi-level Falloff maps to create cross-hatching for darker areas of the object.

Initially published: 3D World magazine, Issue 31, November 2002.

Copyright Pete Draper, November 2002. Reproduction without permission prohibited.