Create NPR painterly filter
create_npr_filterCreate oil, pencil, or watercolor stylizations for any TouchDesigner TOP using a generalized Kuwahara filter. Exposes live radius, smoothness, and strength controls for real-time tweaking.
Instructions
Apply a non-photorealistic painterly filter to an existing TOP. A generalized Kuwahara (sector-based local variance smoothing) runs in a single GLSL TOP and branches into three looks selected by mode: oil (flat color regions, preserved edges), pencil (graphite sketch via luminance × edge magnitude), or watercolor (quantized chroma + low-frequency bleed). Creates a Select TOP → GLSL TOP → Null TOP chain under parent_path and exposes Radius / Smoothness / Strength as custom parent params bound by expression for live tweaking. Returns the GLSL TOP path, the bind-ready output null path, the fragment DAT path, exposed controls, and an glsl_compile_verified flag (always false offline — verify post-cook with get_td_node_errors).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source_path": "<source_path>"
},
"name": "create_npr_filter"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Painterly look. oil: full Kuwahara → flat color regions with preserved edges. pencil: luminance + edge-mag → graphite sketch. watercolor: quantize chroma + low-freq bleed. | oil |
| name | No | Base name for the glslTOP (textDAT becomes `<name>_frag`, output becomes `<name>_out`, source select becomes `<name>_src`). | npr1 |
| radius | No | Sampling radius in texels. Cost is O(radius² · sectors) — keep modest on 4K. | |
| sectors | No | Number of generalized-Kuwahara sectors. 8 = smoother painterly; 4 = classic Kuwahara (cheaper). | 8 |
| strength | No | Wet/dry mix between source (0) and filtered output (1). Live control. | |
| resolution | No | Output resolution: 'input' inherits from the source (default), or '720p' (1280x720), '1080p' (1920x1080), '4K' (3840x2160). | input |
| smoothness | No | Blend between hard min-variance sector pick (0) and softmax-weighted average across sectors (1). Live control. | |
| parent_path | No | Parent COMP path to create the glslTOP + textDAT + nullTOP inside. | /project1 |
| source_path | Yes | Absolute path of an existing TOP to filter (e.g. '/project1/render1'). Pulled in via a Select TOP (no cross-COMP wire). |