Search

English (United Kingdom)French (Fr)
 R&D in Computer Graphics   
    Home Tutorials Toon and contours shaders 3DS Max cartoon & contour shader
3ds Max toon and contour shader tutorial
Toon shader and contour shader tutorial for 3ds Max

Toon shader and contours shader for mental ray® for 3DSMax®

David Lanier 3D hereby grants to you a royalty-free, non-exclusive license to possess and to use the
following shaders for both commercial and non-commercial purposes.

NO WARRANTY: THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY DAVID LANIER 3D TO YOU HEREUNDER ARE PROVIDED "AS IS."
DAVID LANIER 3D DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

** Use them at your own risks **

Download :

Mental ray shader for 3DSMax 7+

Image realized with our shader, courtesy of Andy Alesik : www.alesik.de

 

Tutorial :

Set the .mi file in the directory 3dsmax7or8 \ mentalray \ shaders_autoload \ include
And the .dll in : 3dsmax7or8 \ mentalray \ shaders_autoload \ shaders

The directories are indentical for Max 7 and 8.

Set mental ray® as the default render engine.

Now open the material editor and click on Standard (left arrow) and choose a mental ray® material (right arrow).

 

Your material editor becomes now :

Click on the button on the right of Surface and choose dl3d_toon_shader(DL3D) like this :

You can now edit the shader's parameters :

The parameters are :

- Ka : coefficient for ambient color
- Kd : coefficient for diffuse color
- Ks : coefficient for specular color
- roughness : coefficient to set the roughness of the surface for specular reflexions (the highest is the roughness the more centered is the specular reflexion)
- ambientcol : ambient color
- diffusecol : diffuse color
- specularcol : specular color
- fractalnoise : adds fractal noise on specular and diffuse color (more like a test for fun than a must have feature).

This toon shader discretize the coefficient linked to specular and diffuse reflexions. For that purpose, it uses 3 floating numbers in the range [0, 1]
- lim1 : lowest limit (all under lilm1 has a black color)
- lim2 : medium limit
- lim3 : highest limit
- mode : integer that can be 0, 1 or 2, it is used to filter the lights used for rendering. (0 = use all ights, 1 = use only lights specified in the following array, 2 = use all lights but those mentionned in the following array)
- array : array of lights if mode is set to 1 or 2.

Then go up one level to retrieve the mental ray® material :

And click on the contour shader and select dl3dtoonshader_contour(DL3D) :

Your material editor becomes :

The parameters are :

- color : the color of the contour of 3D objects.
- width : width of the contour
- silhouette : if checked, we draw only the silhouette of the object (the contour lines that are interior to the object are not drawn)

Then, you have to setup the rendering parameters this way :

Then check the Contours enable check box.

And click on on the Contour Contrast button and choose "dl3d_contour_contrast_function(DL3D)" shader like this :

Now click on the Contour Store button and choose "dl3d_contour_store" :

The dl3d_contour_store shader has no parameters.

The dl3d_contour_contrast shader has editable parameters. To edit them, drag and drop the button dl3d_contour_contrast_function on on the slot of the material editor. Then choose instance for your modifications to be applied on the shader in the renderer options.

The dl3d_contour_contrast parameters are :

This shader is used to set which pixels are going to bedrawn as contour using the color from the dl3dtoonshader_contour(DL3D) shader.

- deltaangle : is the angle in degrees between 2 faces, if this angle is higher than deltaangle we consider this pixel as part of the contour.
- zdelta : is the delta Z into the Z buffer to consider 2 pixels as part of the contour.
- density : floating number in the range [0,1], let you set the density of the contour drawing.

 

Finally, assign the contour shader here :

Assign the mental ray® shader on one or several objects and render.

Videos :

vidéo dl3d_toon_shader (AVI 2,3 Mo)

Images :



 


To top of the page Go to top To top of the page


(c) David Lanier 3D. All rights reserved.
Republication or redistribution of David Lanier 3D web site content, including by framing or similar means,
is expressly prohibited without the prior written consent of David Lanier 3D.

RenderMan developer | Maxscript developer | technical director TD | developpeur freelance free lance | lightwave plugins lscript developer | Photoshop plugins scripts developer | Motion builder plugins scripts developer | Mental Ray developer | XSI plugins script developer development programmer programming | maya plugins MEL script developer development programmer programming | 3dsmax plugins maxscript | 3dsmax sdk | maxscript training | shader developer development programmer programming writer | 3ds max SDK | plugin shader tools | formation maxscript | formation developpement plugin | developpeur independant | developpeur shader | formation 3dsmax plugins SDK | developpeur plugin |