Keep up-to-date with Free tutorials!!

 

Sign up to our twice-monthly newsletter today for the latest tutorials, interviews and product information.

Sign me up to receive third-party emails from 3dtotal's partners, too!

- Latest news
- Exclusive Shop Offers
- Preview early content
- Plus much more

 

Not Ready to take that step? OK, Why not just Subscribe to the RSS Feed

 
submit tutorial
1
Non Photo Realistic Shading

By Yinako Minako
| Your Rating:
rating star nonerating star nonerating star nonerating star nonerating star none
(0 Votes)
| 37706 Views
| 0 Comments
| Comments 0
Date Added: 22nd June 2009
Software used:
Maya
This Document describes how to achieve a Non photo realistic shading effect in Maya, it also serve as a documentation to nprs.mel script. You can get the script here or on www.highend3d.com via this link (look for Non Photo Realistic Shading v0.5)

Introduction

The non photo realistic shading effect here looks like the image below, it works in Maya by using a simple shading network, it can be setup easily via a script (nprs.mel) or manually. This doc deals very much on how to use the shading network produced by nprs script. Its very easy to work with and very fast to get the result, and I hope you have fun reading this as me writing it :)Often working with 3D graphics the real physical shading models can be quite difficult to use for an artist from a traditional 2D background, say if I wish to color kelivina's(the girl below) skin in 2D, all I need to do is chose the correct color I have in mind and paint. In 3D however despite the texture/color I have chose for her skin the shading models I use and the lights in the scene determines very much the end result, and often it doesn't look like the color you had in mind, no matter how much tweeking....it can be very frustrating at times, to have a skin tone I need a skin shader, leather needs a leather shader etc. etc. So why can't I have one shader that describes what I what in a image, just like how I work in 2D? Well, nprs works very much like the 2D approach.

985_tid_nprtut01.jpg
Some info on the image above:
* There's no file texture involved, 99% of the image use nprs.
* Very fast to render, under 5 min on today's average machine.
* Using standard Maya render, no raytrace.

Part 1: before getting started

There's one important rule when working with nprs, you'll need to have a uniform light intensity across your scene, for
example I have 3 light set up and all my light's intensity add up to 1.00 So if I want to add 10lights later I'll need to adjust them so they still adds up to 1.00, otherwise objects shaded with nprs may appear over exposed. You may say how do I make object appear more bright? You adjust the colors in the nprs via a ramp(later on this) You can just have one light in your scene and still very good.

Part 2: install and execute nprs

To get nprs script work its easy, just copy the nprs.mel file to your Maya scripts directory (e.g.. C:\Documents and Settings\yinako\My Documents\Maya\4.0\scripts) yinako is my user name. To use the script just type nprs at the Maya command line and press Enter or run it from the script editor. You'll get a window like below.

985_tid_nprtut02.jpg
I'll explain the sliders briefly here:
bright color >> the brightest possible color on your shaded object
dark color >> darkest possible color on your shaded object, often you don't want it to be black...otherwise its not so interesting.
color steps >> the number of overall colors from bright color to dark color.(Later on this)
interpolation type >> non give a cell shaded look, Expotiential down have softer look between color boundaries. Now just click on create Non Photo Realistic Shading to get a shading network created, so every time you want a nprs you'll need to type it on the command line.

Part 3: working with nprs

Now go to the hypershade select the shader you just made and view its up down stream connections, it should look like below.

985_tid_nprtut03.jpg
The script only creates a shading network to begin with, there's much adjustment later on. Double click the color_steps ramp, this color ramp is at the heart of nprs, and how you work with it. Here's how it looks

985_tid_nprtut04.jpg
Here you can see there's 6 "color steps", the brightest color are always on top of the ramp, and the darkest color the lowest part of the ramp, changing the position of these give how much light is give to a particular color. Assign the npr_shader to a object, below I have the default setting of nprs assigned to Kelivina's bra. I have setup one light in the scene below with intensity 1.00. Notice the "color steps" form light to dark, these color steps corresponds to the ramp, so the color and positions on the ramp directly controls how much color and what particular color fall on the object. No matter how dark your scene is you'll never get black, but the darkest color for that object, which is yellowish brown here. Same applies to the brightest color too.

985_tid_nprtut05.jpg

Also notice the colors between the brightest and darkest are interpolated colors in between, this only give you a nice smooth shading, but like fine art you often don't want a perfect gradient, it looks too CG-ish, so you often adjust the color in between them. And the positions among them on the color ramp. A good way to adjust the color ramp is to use IPR in Maya and change the interpolation to non, to give that cell shaded look, which clearly defines where the boundary between you colors are. Now you can tweak a hell lot here. Of course you can add and delete "color steps" as you see fit to your work.

985_tid_nprtut06.jpg
I have deleted some of the "color steps", and give a dark purple for darkest color. Too much "color steps" can look too smooth of a shading, unless you are working on much higher res image which more color step can be distinguished. You'll also notice there's a dark border around the object if you don't want them just locate the condition node connected to the npr_shader and change the second term to 0.00. If you want the outline to be more fine you'll need to increase the mesh resolution, its the facing ratio method, cheap and fast, no comments there.

985_tid_nprtut07.jpg

Part 4: Tips

Now you know how to work the ramp, there's not much to it, very simple actually. Since now you colors appears exactly how you wish to appear in the scene, you can actually get colors from other sources. Like photos or mangas (for me), even though these sources are already lit, it doesn't matter to nprs, cause light in Maya can't change the color of your objects anymore. Here below I detach the color picker and go get some skin tones :)

985_tid_nprtut08.jpg
Here below I also have kelivina's finall skin color ramp, the positions and color doesn't have to be nicely interpolated. Notice there pink, orange, browns, it make the image look much more interesting that way. And this is what nprs is all about.

985_tid_nprtut09.jpg

Conclusion

So that's all, not much to say really, simple and easy to work with. I know there are many short comings with the current nprs I'm working on. I have considered future improvements and shading this way, here's are what's for the better:

* specular (hard ones too)
* file textures
* paint strokes along color boundaries

I haven't got to working on them yet, but If I ever want to improve on nprs those will be the first thing on mind, and of course if you know how to implement them I'll be god damn glad to hear it. Oh yeah one last note nprs was originally called manga shader. because that was the original idea behind it.

All rants, comments, suggestions, bugs email to yinako_minako@hotmail.com

Yinako minako © July 16, 2002


 
1
Related Tutorials

Tutorial

Gallery Image.



Keywords: Maya, Rigging, Animation, Blend Shapes

Go to tutorial
rating star fullrating star fullrating star fullrating star fullrating star half (9)
Comments 0 Views 14528

Tutorial

Gallery Image.



Keywords: Maya, Rigging, Hands, Fingers, Thumbs, Animation

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star full
Comments 1 Views 11956

Tutorial

Gallery Image.



Keywords: clouds, sky, realistic, max, afterburn,

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star full
Comments 0 Views 24673

Tutorial

Gallery Image.



Keywords: vehicle, car, mini, cooper, shading, texturing,

Go to galleries 1
rating star nonerating star nonerating star nonerating star nonerating star none
Comments 0 Views 28205
Readers Comments (Newest on Top)
avatar
(ID: 229428, pid: 0) Ncieu on Sat, 26 October 2013 3:35pm
how do i input that script in maya 2014 ?
Add Your Comment