ToonDisplayFilter

Overview

The ToonDisplayFilter outlines objects and discretizes the color of an image buffer.


Attribute Reference

General attributes

ambient

Rgb
default: [ 0, 0, 0 ]

Adds an ambient light to the cel shading

edge_detector

Int enum
  0 = “None” (default)
  1 = “Sobel”
  2 = “Laplacian”
  3 = “Laplacian of Gaussian”

Type of edge detector to use

ink_depth_threshold

Float
default: 0.01

The threshold for the depth-based ink outline

ink_normal_scale

Float
default: 0.01

Increase for a more pronounced normal-based ink outline

ink_normal_scale = 0.0 --> 30.0

ink_normal_threshold

Float
default: 0.01

The threshold for the normal-based ink outline

input_albedo

RenderOutput
default: None

RenderOutput that represents diffuse albedo material aov

input_depth

RenderOutput
default: None

RenderOutput with 'depth' result

input_diffuse

RenderOutput
default: None

RenderOutput that represents diffuse reflection LPE

input_glossy

RenderOutput
default: None

RenderOutput that represents glossy reflection LPE

input_normal

RenderOutput
default: None

RenderOutput with 'normal' result

num_cels

Int
default: 2

Sets number of toon cels in diffuse shading


Examples

local depth = RenderOutput("/output/depth") {
    ["file_name"] = "result_tmp.exr",
    ["result"] = "depth",
    ["math_filter"] = "min",
}

local normal = RenderOutput("/output/normal") {
    ["file_name"] = "result_tmp.exr",
    ["result"] = "material aov",
    ["material_aov"] = "DSS.normal"
}

local albedo = RenderOutput("/output/albedo") {
    ["file_name"] = "result_tmp.exr",
    ["result"] = "material aov",
    ["material_aov"] = "DSS.color"
}

local glossy = RenderOutput("/output/glossy") {
    ["file_name"] = "result_tmp.exr",
    ["result"] = "light aov",
    ["light_aov"] = "glossy"
}

local diffuse = RenderOutput("/output/diffuse") {
    ["file_name"] = "result_tmp.exr",
    ["result"] = "light aov",
    ["light_aov"] = "diffuse"
}

local toonDF = ToonDisplayFilter("/display/toon") {
    ["input_glossy"] = glossy,
    ["input_diffuse"] = diffuse,
    ["input_albedo"] = albedo,
    ["input_depth"] = depth,
    ["input_normal"] = normal,
    ["num_cels"] = 2,
    ["ambient"] = Rgb(0.1, 0.05, 0.2),
    ["ink_depth_threshold"] = 0.01,
    ["ink_normal_threshold"] = 0.0,
    ["ink_normal_scale"] = 1.0,
    ["edge_detector"] = "Sobel",
}

RenderOutput("/output/toon") {
    ["file_name"] = "result0.exr",
    ["result"] = "display filter",
    ["display_filter"] = toonDF,
    ["channel_name"] = "toon"
}