Toon Host shaded objects can be both transparent and reflective. Rendering an object's transparency and reflection properly depends on the object's transparency and reflection properties, the Toon Ink Lens shader's trace depth, and the render pass or render region's raytracing depth settings.
The former defines how transparent and/or reflective the object is, as well as how surfaces and ink lines appear when seen though transparent objects or reflected in reflective objects. The latter two specify how many levels of transparency and/or reflection are calculated.
The trace depth determines how many levels of contour detection are computed when rendering ink lines. For example, to render a transparent object's front and back-face ink lines requires a trace depth value of 2 (for two levels of contour detection). Rendering the front-face ink lines of an object behind that transparent object requires an additional level, and so on.
Keep in mind that increasing the trace depth can significantly increase render time.
The trace depth value must be higher than 1 for transparency or reflection to be visible.
No matter how high you set Trace Depth, you won't get any more levels of reflection or transmission than are permitted by the Raytracing Depth settings that you set in the Render Options or View Render Options (render region) property editor.
For example, you can have Trace Depth set higher than 1, but you won't get any reflected contours at all if your rendering properties' Reflection or Maximum Ray Depth are set to 0.
Select the camera that is rendering the ink lines and open its property editor (Modify Shader from the Render toolbar).
On the Lens Shaders tab, the lens shader stack appears. Select the Toon Ink Lens shader from the shader stack and click the Inspect button to open the shader's property editor.
From the property editor's Sampling tab, adjust the Trace Depth value.
Controlling the transparency of toon-shaded objects is similar to controlling the transparency of objects with other types of surface shading. Transmission and refraction are calculated to a specified depth and objects behind the transparent objects show through with appropriate distortion.
However, the toon shaders allow you to control how object colors and ink lines appear when seen through transparent objects.
Original rendered image. No transparency has been added.
The objects' transparency RGB values are set to 0.5, 0.5, 0.5 in this image, making the objects semi-transparent. The objects' index of refraction is set to the default value of 1 so background surfaces are not distorted when seen through transparent foreground surfaces.
Setting the index of refraction to 1.1 creates some refractive distortion of the background surfaces wherever they are seen through the foreground surfaces.
To make a toon-shaded object transparent
Although the following procedure assumes that the object has a Toon Paint and Host material shader applied to it, the same controls exist in the Toon Host shader.
Select the toon-shaded object that you want to make transparent.
From the Render toolbar, choose Modify Shader to edit the object's Toon material shader. The Toon Paint and Host shader's property editor opens.
Set the following parameters, as necessary:
Select one of the following methods for combining object surface colors with transmitted colors (those seen through transparent objects).
Standard Blend: Combines the surface color with the transmitted color by mixing the two colors according to the degree of transparency.
Preserve Colors: When selected, the transmitted color is composited onto the surface according to the opacity of the occluded surface. This has the effect of leaving a surface color unchanged where nothing is transmitted through it.
Color: Specifies the transparency of the red, green, and blue channels. This color modifies transmitted colors, like a filter: if it is set to red, for example, objects seen through the surface will be tinted red.
Index of Refraction: Specifies the transparent object's index of refraction.
Detection Threshold: Sets the threshold above which a surface is considered transparent (and below which it's opaque) by comparing the greatest of the transparency RGB channels to the threshold. The surface is considered to be transparent if it is found to be greater than the threshold value.
Modify Surface Ink: When these options are enabled, a surface's transparency affects the color and/or alpha of the ink lines rendered on that surface.
Color: The degree to which the ink color is affected by the surface's transparency. A setting of 0 leaves the ink color unchanged, while a setting of 1 results in 100% of the weight given to the transparency color.
Compositing: Specifies how the transparency color and ink color are combined. Choose from the available compositing modes described Compositing (Transfer) Modes.
Alpha: Specifies the degree to which the ink alpha is affected by the surface's transparency. A setting of 0 leaves the ink alpha unchanged, while a setting of 1 results in 100% of the weight given to the transparency color.
Modify Refracted Ink: A surface's transparency affects the color and/or alpha of the ink lines that are seen through that surface. The options are the same as the Modify Surface Ink options.
Controlling the reflectivity of toon-shaded objects is similar to controlling the reflectivity of objects with other types of surface shading. Reflections are calculated to a specified level and objects around the reflective objects appear in their reflections with appropriate distortion.
However, the toon shaders allow you to control how object colors and ink lines appear when seen reflected in reflective objects.
Original rendered image. No transparency has been added.
The objects' reflection RGB values are set to 0.5, 0.5, 0.5 in this image, making the objects semi-reflective. Reflections are calculated to the extent permitted by the Trace Depth Setting.
To make a toon-shaded object reflective
Although the following procedure assumes that the object has a Toon Paint and Host material shader applied to it, the same controls exist in the Toon Host shader.
Select the toon-shaded object that you want to make transparent.
From the Render toolbar, choose Modify Shader to edit the object's Toon material shader. The Toon Paint and Host shader's property editor opens.
Set the following parameters, as necessary:
Select one of the following methods for combining object surface colors with reflected colors (those seen in reflective objects).
Standard Blend: Combines the surface color with the reflected color by mixing the two colors according to the degree of reflectivity.
Preserve Colors: The reflected color is composited onto the surface according to the opacity of the reflected surface.
This has the effect of leaving a surface color unchanged where nothing is reflected off it.
Color: Specifies the reflectivity of the red, green, and blue channels.
This color modifies reflected colors, like a filter: if it is set to red, for example, objects reflected on the surface will be tinted red.
Modify Surface Ink: When these options are active, a surface's reflectivity affects the color and/or alpha of the ink lines rendered on that surface.
Color: The degree to which the ink color is affected by the surface's reflectivity. A setting of 0 leaves the ink color unchanged, while a setting of 1 results in 100% of the weight given to the reflective color.
Compositing: Specifies how the reflectivity color and ink color are combined. Choose from the available compositing modes described Compositing (Transfer) Modes.
Alpha: Specifies the degree to which the ink alpha is affected by the surface's reflectivity. A setting of 0 leaves the ink alpha unchanged, while a setting of 1 results in 100% of the weight given to the reflectivity color.
Modify Refracted Ink: A surface's reflectivity affects the color and/or alpha of the ink lines that are reflected on that surface. The options are the same as the Modify Surface Ink options.
Trace depth tapering allows you to taper ink lines as a function of raytraced depth. Primary rays have a trace depth of 0 and are not affected by the taper. Reflections and transmissions, on the other hand, have trace depths of 1 or greater and are rendered progressively thinner as their depth increases.
To set the trace depth tapering
Select the camera that is rendering the ink lines and open its property editor (Modify Shader from the Render toolbar).
On the Lens Shaders tab, the lens shader stack appears. Select the Toon Ink Lens shader from the shader stack and click the Inspect button to open the shader's property editor.
From the Taper tab, activate Trace Depth tapering by setting the a non-zero value.