Non Photo Realistic Shading Maya 0.7.0 script by yinako: http://www.creativecrash.com/maya/downloads/scripts-plugins/rendering/misc/c/non-photo-realistic-shading-maya
Non Photo Realistic Shading Maya 0.7.0 is a script to setup shading networks for a anime/toon look, by using a series of ramps.
Language: MEL
Type: Maya Editor Script
Script Files: 1
Number of lines: 198
Functionality: 6.5
The script offers a few options: name of the shader, bright and dark colors, the number of color bands, shading type and building the specular. Some additional options would be nice (such as choosing a few extra colors (perhaps highlight color, a few middle colors and shadow color) but otherwise can give some good results with what is available.
Design: 6
The script is only two functions (one for UI, one for processing UI and creating the shader network). The first function is fine, but the second function may benefit from being broken up into separate functions. The creation and joining of the specular node could easily have been a separate function instead of a long if statement. By having everything in the main process function, it introduces a lot of variables as well for such a small script.
Style: 6.5
The code is well commented, and makes good use of whitespace and appropriate variable names. It would benefit from creating separate functions instead of using comment blocks to separate logic, but in such a small script it is hard to rate that too heavilty. There are a few magic numbers (especially in the creation of the spec ramp) which may be nice to add as options to the UI instead of being hardcoded into the script.
Documentation: 7.5
The documentation is easy to follow and provides a good amount of information. The source code has quite good comments as well, and makes it easy to follow what the code is doing as the comments are pretty descriptive.
Reusability: 7.5
The script is tiny and thus would be very simple to maintain, however it would require some additional work to extend functionality, and would benefit from some additonal separation of logic. The creation of the shading network is fairly self contained (as the function takes no parameters), however, it would be fairly easy to refactor this code to make it more extendable, based simply on the size of the code base.
Overall: 6.5
The script is small but gives a nice starting point for anime/cartoon shading using ramps. Likely it would be more useful with a few more options, but as it stands, the results are pretty good, and would work for a certain look.
Until next time,
Michael Hubbard
https://michaelhubbard.ca
One reply on “Code of the Day: Non Photo Realistic Shading Maya”
Hi Michael!
Nice CotD!
I wanted to try out the plugin but couldn’t get it working in neither Maya 2012 nor 2011 🙁
Which version are you using?
lg, Martin