Monday, June 15, 2009

VEX Toon Cross-Hatch



This VEX Material simulates a toon, cross-hatching effect where based on the lighting and shadowing of the object will produce a wire-frame like pattern, similar to a drawing or comic book.

It is based on the luminance that the object gets from the lights in the scene. After the Lighting VOP, I used a Luminance VOP to get monochrome values, which range from 0 to 1. Then these values are color ramped. This yeilds a basic toon effect.

Using Constant Type ramping. You can add as many colors to the ramp as possible.

Now, instead of using the Color Ramp to directly change the surface color, I used a Scalar Ramp to change the width of the lines produced by a Wireframe VOP. So what you have is when the light brightens the surface, the lines will get thinner, and in the shaded area and the shadows, the lines will be thicker.

Since I gave the Wireframe VOP UV coordinates, it is best to add UVs to the geometries in SOPs.

I also got different results using Micropolygon or Raytraced rendering. Since using raytraced shadows and raytraced rendering is more presice, they yeild more order to the lines. Both ways look nice in their own way.

Micropolygon Rendering

Raytraced Rendering

VEX Network.