# Tooncraft Toon, cartoon, painterly and comic halftone looks for Unreal Engine 5.6, 5.7 and 5.8, with no engine changes and no material swaps. Lumen, light color and emissive keep working, because the bands are cut from the light the engine already computed. - **Four styles**: Anime Cel (two hard tones, cool shadow, rim, thin line), Cartoon (three loud bands, flat painted surfaces, thick line), Painterly (soft bands and a brush that follows the shapes) and Retro Comic (print colors, halftone dots in the shadow, ink line). - **Two styles on screen at once**: the world style and a secondary style. An actor or a material can ask for the secondary one, or for no toon at all. Painterly world with anime characters, cartoon world with a realistic weapon, and so on. - **Per actor without taking your stencil**: the Tooncraft Style component uses only the custom stencil bits 64 and 128. Values 1 to 63 stay yours. - **Per material**: two material functions plugged into Specular. - **Presets as assets**: every knob of a style lives in a Data Asset. Duplicate one of the four, tune it, and the change shows live in the editor. - **Blueprint**: switch the world style, the secondary style, a preset or an actor's style at runtime.  Try it before you buy: the Windows demo at https://github.com/filipetessaro/tooncraft-demo/releases/latest switches the styles with the number keys. ## Start in 3 steps 1. Copy the `Tooncraft` folder into your project's `Plugins` folder (or install it from Fab), enable it in **Edit > Plugins** and restart the editor. 2. **Project Settings > Plugins > Tooncraft**: pick the World Style (or a World Preset). Press Play. 3. To switch at runtime, call **Set World Style** or **Set World Preset** from any Blueprint. From the console: `r.Tooncraft.Style 1` (anime), `2` (cartoon), `3` (painterly), `4` (retro), `0` (off). ## The styles | Style | Bands | Surface | Line | Extra | |---|---|---|---|---| | Anime Cel | 2, hard | texture 60% painted over | thin | rim on the lit side, cool shadow | | Cartoon | 3, hard | painted flat in 4 tones, saturated | thick, black | | | Painterly | soft | texture a little calmer | none | brush after TSR | | Retro Comic | hard | 4 warm print tones | ink | halftone dots below the shadow line | | Off | Anime Cel | |---|---| |  |  | | **Cartoon** | **Painterly** | |  |  | | **Retro Comic** | **Retro Comic at night** | |  |  | The light is averaged over a small disc before it is cut into bands, so a strong normal map does not turn the bands into grain (`r.Tooncraft.LightSmooth`, radius in pixels at 1080p, 0 turns it off). The outline fades between 60 and 120 m, so the edge of the world does not draw a black horizon. ## Presets The four styles ship as assets in `Tooncraft/Presets` (`DA_TNC_Anime`, `DA_TNC_Cartoon`, `DA_TNC_Painterly`, `DA_TNC_Retro`). Duplicate one into your project and edit it. Each field says what it does when you hover it. | Group | Fields | |---|---| | Bands | Band Stops (width of each band in exposure stops), Band Softness | | Shadow | Shadow Tint, Shadow Pivot (light level where the tint starts) | | Color | Saturation, Surface Flatten (0 keeps the texture, 1 paints each surface with its average color), Color Levels (posterize the surface, 0 = off) | | Rim | Rim Strength | | Outline | Outline Width (pixels at 1080p), Outline Darkness, Outline Depth Threshold, Outline Normal Threshold | | Halftone | Halftone Strength, Halftone Cell Pixels | | Painterly | Paint Radius (0 = no brush), Paint Sharpness, Paint Anisotropy | Use a preset with **Set World Preset** / **Set Secondary Preset**, or set it in Project Settings. **Set World Style** goes back to a built in style and drops the preset. **Reset To Built In Style** on a preset copies a built in style's values into it. While a preset is set for a slot, the console variable of that slot is not read. ## Per actor Add **Tooncraft Style** to the actor and pick: | Style | What it does | |---|---| | World | Nothing, same as everything else | | Secondary | The secondary style (Project Settings, `r.Tooncraft.SecondaryStyle`, or Set Secondary Style) | | Off | No Tooncraft on this actor |  The component turns on Render CustomDepth on the actor's primitives and writes bit 128 (secondary) or bit 64 (off) of the custom stencil, and puts the primitives back as they were when it is removed. It sets `r.CustomDepth 3` (custom depth with stencil) if it was lower. Primitives added to the actor later need **Refresh Primitives**. **Set Style** changes it at runtime. If your own primitives write a custom stencil value with the default write mask, the component replaces it on that actor. Values 1 to 63 written on other actors are untouched. ## Per material Plug one of these into the material's **Specular** input: | Function | What it does | |---|---| | `MF_TNC_SecondaryStyle` | The material gets the secondary style | | `MF_TNC_NoToon` | The material is left out of Tooncraft | They do not work with Substrate in Adaptive GBuffer mode (use the component). They write a Specular value very close to the default 0.5 (the reflection changes from 4.0% to 4.1%), which Tooncraft reads back as a request. A material that needs its own Specular value cannot use them; give that actor a Tooncraft Style component instead. When an actor and a material both ask, Off wins, then Secondary.  ## Blueprint nodes | Node | What it does | |---|---| | Set World Style / Get World Style | Built in style of everything (`r.Tooncraft.Style`) | | Set Secondary Style / Get Secondary Style | Built in secondary style (`r.Tooncraft.SecondaryStyle`) | | Set World Preset / Get World Preset | A preset asset as the world style, None goes back to the built in one | | Set Secondary Preset / Get Secondary Preset | Same for the secondary style | | Tooncraft Style > Set Style | World, Secondary or Off for that actor | | Tooncraft Style > Refresh Primitives | Apply the actor's style to primitives added after it | | Tooncraft Style Preset > Reset To Built In Style | Copy a built in style into the asset | ## Console variables | Variable | Default | What it does | |---|---|---| | r.Tooncraft.Style | 0 | World style: 0 off, 1 anime, 2 cartoon, 3 painterly, 4 retro | | r.Tooncraft.SecondaryStyle | 1 | Style for actors and materials that ask for the secondary one | | r.Tooncraft.LightSmooth | 8 | Radius in pixels at 1080p the light is averaged over before banding, 0 = off | | r.Tooncraft.PaintRadius | -1 | Painterly brush radius in pixels at 1080p, -1 = the preset's | | r.Tooncraft.PaintHalfRes | -1 | Painterly brush at half resolution: -1 above 1440 lines, 0 never, 1 always | | r.Tooncraft.Debug | 0 | 1 shows the band light, 2 the outline | ## How it works Three points in the frame, all through the engine's public extension hooks: 1. Right after the base pass the scene color holds only emissive. Tooncraft keeps a copy. 2. After opaque lighting, Lumen, fog and water, and before translucency: the light at each pixel is the lit color minus emissive, divided by the surface color. That light is cut into bands in exposure stops, so the same bands hold in day and night, then multiplied back by the surface and the light's own color. Emissive is added back untouched. Outline, rim and halftone are drawn in the same pass. 3. After TSR, at output resolution: the painterly brush (a structure tensor and an anisotropic Kuwahara filter). Above 1440p it paints at half resolution, where the strokes are wide anyway. ## Cost RTX 2070 SUPER, Game Animation Sample level, day and night, close and wide. Tooncraft passes only, GPU time from ProfileGPU. | Output | Render resolution | Anime, Cartoon, Retro | Painterly | |---|---|---|---| | 1080p, TSR default | 1400x788 | 0.32 to 0.35 ms | 1.48 to 1.57 ms | | 1080p native | 1920x1080 | 0.57 to 0.86 ms | 1.72 to 2.04 ms | | 4K, TSR default | 1920x1080 | 0.57 to 0.75 ms | 1.96 to 2.11 ms | | 4K native | 3840x2160 | 2.27 to 3.38 ms | 3.61 to 3.88 ms | The band pass runs at render resolution, before TSR. The painterly brush runs after TSR, at output resolution, and at half of it above 1440p (`r.Tooncraft.PaintHalfRes 0` turns that off, at about 3.5 ms more at 4K native). The light smoothing reads a half resolution copy of the light, worked out once per frame. Two styles on screen at once cost the same as one. ## Limits - **Light is banded as a whole.** Direct light and global illumination are already summed when Tooncraft sees them, so they are banded together, and two colored lights crossing make one band, not one per light. - **Translucency** is not styled, it only does not break: glass and particles draw on top. - **Forward shading and mobile** are not supported. - **Heavy fog** far away can get bands of its own, since fog is in the color before the band pass. - **Substrate**: works in both GBuffer modes, Blendable and Adaptive. In Adaptive mode the material functions have no effect, since Substrate does not keep the Specular value; use the Tooncraft Style component there. - **Scene captures** that only capture depth are skipped. ## The demo The demo is Epic's Game Animation Sample level with the Echo character, dressed with Starter Content props near and far. Number keys switch the style, **N** day and night, **M** puts the player in the secondary style, **H** hides the help.  ## When something looks wrong | You see | Why, and what to do | |---|---| | No style at all | `r.Tooncraft.Style` is 0, or a preset was set and then removed. Set a style in Project Settings or call Set World Style. In the Output Log, lines starting with `Tooncraft:` say which preset is in use. | | No style, the project uses forward shading or mobile | Not supported, Tooncraft needs the deferred renderer. | | An actor with the component looks like the rest | The component's Style is World, or primitives were added after it: call Refresh Primitives. | | A material function has no effect | Substrate is in Adaptive GBuffer mode, or the material writes its own Specular. Use the Tooncraft Style component on that actor. | | Your own custom stencil effect stopped on one actor | That actor has a Tooncraft Style component, which writes the custom stencil with its own bit. Values on other actors are untouched. | | Grainy bands on rough surfaces | Raise `r.Tooncraft.LightSmooth` (pixels at 1080p, default 8). | | Bands in the fog far away | Fog is in the color before the band pass. Lower the fog density or accept it at a distance. | | A preset edit does not show while playing | The edited asset is not the one in use. The Output Log line `Tooncraft: ... edited` says `not in use` then. | ## Versions Unreal Engine 5.6, 5.7 and 5.8, Windows and Linux. ## Support contato@tessaroapps.com. We answer within 2 business days.