Wednesday, 27 March 2013

Mental Ray Contour Shader

I need to start rendering again and realised that I'd pretty much forgotton how to render contours so here are some notes to myself for the rest of the shots :)

1) In render settings enable contour rendering. For my specific purposes I've also gone for hide source (I don't want any other textures, lighting etc visible in my contour layer - I'll comp those together later), flood colour is white (it could be anything, I'm going to key it out in the comp), over sample value of 30 (I need it this high to get reasonable quality and the render times are fine), gaussian filter and filter support of 2.

2) Pipe in "contour_contrast_function_levels" to Contrast Shader and "contour_store_function" into Store shader. (See below for where to find these in the hypershader.)

3) The settings I used for the contour_contrast utilitiy are below. To make sure I got the outlines I needed and to prevent broken lines, contours flickering on and off etc etc I went for diff mat which draws a countour line between different materials. This meant that I had to apply multiple materials to a single object, by applying individual shaders to the faces that I wanted to be outlined

4) For contours which get narrower with distance from the camera plug the "contour_shader_depthfade" utility into the shading group for the material

5) Starter settings for the depthfade utility are below. These need to be tweaked on a shot-by-shot basis depending on camera / lens etc.

I used tons of different resources to get this right but here's one that was pretty clear :)