The contour properties (color, width, etc.) depend on the object the contour is on and its material. For each material that should have a contour, one has to specify a contour shader. A material will not get a contour if it does not have a contour shader. The colors consist of four components: red, green, and blue color, and opacity. All four components of the color are normally between 0 and 1. The width is specified as a percentage of the minimum of image x resolution and y resolution. For example, if the image resolution is 700×500 and a contour width of 1.0 (percent) is specified, the thickness of the line becomes 5 pixels. The color, width, etc. can be parameters, or depend on curvature, distance, color, and illumination.
A material gets a simple contour of constant color and width if it has the contour_shader_simple contour shader. For example, the following specifies red contours that are half a percent wide:
contour "contour_shader_simple" ( "color" 1.0 0.0 0.0 1.0, # solid red "width" 0.5 # in % of image resol )
As another example of a contour shader, contours of color and width that are linearly interpolated between two values, depending on distance to the camera, are specified with the contour shader contour_shader_depthfade. Two depths, colors, and widths are specified. If a contour point is more distant than far_z, the contour gets color far_color and width far_width. If a point is nearer than near_z, the contour gets color near_color and width near_width. If the depth is in between, the color and width are linearly interpolated. For example, to get contours that are interpolated between two percent wide red at depth -10 and half a percent wide blue at depth -25, specify
contour "contour_shader_depthfade" ( "near_z" -10.0, # from this depth, "near_color" 1.0 0.0 0.0 1.0, # color (red), "near_width" 2.0, # and width (in %) "far_z" -25.0, # to this depth, "far_color" 0.0 0.0 1.0 1.0, # color (blue), "far_width" 0.5 # and width (in %) )
The left figure is a black-and-white illustration of this depthfade contour shader. The right figure is a scene with two materials with different contour type: illumination-dependent contours on the teapot and simple contours on the "floor".
There are many other contour shaders in contour.so, and new ones can be written by the user.
Copyright © 1986-2008 by mental images GmbH