PrepAI
AI scene prep for Unreal Engine: clay render, segmentation, depth / normal / line art guide passes, one-click export of every pass, and image generation from the viewport with a built-in local AI engine.
Clay & Segmentation
Swap all materials to clay or flat ID colors with one click. Original materials are always backed up and restored.
Guide passes
Depth, normal and line art, ready for ControlNet, ComfyUI and video-to-video tools, shimmer-free.
Export All Passes
Render Beauty, Clay, Segmentation, Depth, Normal and Line Art from a Level Sequence with Movie Render Queue, as PNG / EXR / JPG / MP4.
PrepAI Gen
Generate a photoreal image from what you see in the viewport, compare it with a draggable before/after line, and keep a professional shot list.
Requirements
- Unreal Engine 5.8, Windows 64-bit.
- Dependencies enabled automatically: Python Editor Script Plugin, Editor Scripting Utilities, Movie Render Queue.
- PrepAI Gen (optional): NVIDIA GPU, 12 GB of VRAM or more recommended, about 20–30 GB of free disk space for ComfyUI and the models.
Installation
- Epic Games Launcher → Fab Library → PrepAI → Install to Engine (5.8).
- Open your project, go to Edit → Plugins, search PrepAI, enable it and restart the editor.
- A PrepAI menu appears in the Level Editor menu bar.
Quick start
- PrepAI → Open PrepAI Panel.
- Click Clay: every material becomes gray clay. Click Original to restore.
- Pick a guide pass (Depth, Normal, Line Art) to see it live in the viewport.
- Open a Level Sequence, go to the Render tab and click Export All Passes.
- Want an AI image? Open PrepAI Gen, install the engine once, write a prompt and click Generate from Viewport.
PrepAI Panel
PrepAI → Open PrepAI Panel (also in Tools → PrepAI). A dockable window: the header always shows what is active (render mode, guide pass, export progress). The panel has a Scene tab and a Render tab; the export button is always visible at the bottom.
Render mode
| Mode | What it does |
|---|---|
| Original | The scene as you built it. |
| Clay | Replaces every material with gray clay. Emissive and unlit materials (LEDs, screens, sky) keep their look, masked materials keep their cutout, glass becomes light translucent clay, skeletal meshes get a separate character color. |
| Segmentation | A flat, unlit, exact color per group (segmentation map). Sky, fog and atmosphere are hidden, and colors are output with no tonemapping, no anti-aliasing, no depth of field and no motion blur. |
Segmentation
Visible only when the render mode is Segmentation.
| Setting | Description |
|---|---|
| Group by | Actor, Layer, Outliner folder or Tag. All actors in a group share one color. |
| Colors: Distinct | Well-separated colors, editable per group with the color picker. |
| Colors: Semantic | ADE20K class colors, the code used by ControlNet segmentation models. Classes are guessed from names (person, floor, stage, light, screen…) and can be changed per group from the class menu. |
Guide passes
| Pass | Description |
|---|---|
| Depth | Normalized depth, near = white, far = black. Auto sets the far distance from what the camera sees, for maximum contrast. |
| Normal | Camera-space normals. |
| Line Art | Edges from depth and normal changes, white on black (or black on white), with Threshold to remove noise and Thickness. |
While a guide pass or Segmentation is on, viewport anti-aliasing, depth of field and motion blur are turned off so the image does not shimmer. They are restored when you switch back.
Options
| Option | Description |
|---|---|
| Keep emissive materials | LEDs and screens keep their original look in Clay. |
| Keep unlit materials | Sky domes and screens keep their original look. |
| Hide decals | Decals are hidden in Clay and Segmentation. |
| Hide sky / Hide fog | A clean background for AI. |
| Hide on-screen warnings | Hides the engine messages drawn over the viewport (shadow overflow, sky light, lighting needs rebuild…) for clean captures and recordings. Works in every mode; it only hides the text. |
| Translucent | Glass (light translucent clay), Hide or Keep. |
Render tab & Export All Passes
Renders the open Level Sequence once per enabled pass with Movie Render Queue. Files go to <output folder>/<Sequence>/<pass>/ (default <Project>/Saved/MovieRenders/PrepAI). A progress bar shows each pass; the scene is restored to its original materials at the end.
| Section | Settings |
|---|---|
| Passes | Beauty, Clay, Segmentation, Depth, Normal, Line Art. |
| Output | Folder, file name pattern ({sequence_name} {pass} {frame_number}), format PNG / EXR / JPG / MP4, or an image sequence plus “Also export MP4”. |
| Resolution | 720p, 1080p, 1440p, 4K, 9:16, 1:1 or custom. |
| Frames | Whole sequence or a custom range; frame rate from the sequence or a preset / custom value. |
| Quality | Spatial / temporal samples and warm-up frames for Beauty and Clay. Segmentation and guide passes are always rendered without anti-aliasing so ID colors stay exact. |
PrepAI Gen
PrepAI → Open PrepAI Gen. Generates an image from the viewport with a local AI engine (ComfyUI with FLUX.2 Klein) that runs hidden in the background: no external windows, no browser. Every long operation shows a progress bar.
First start
- Engine → This PC: choose an install folder (default
%LOCALAPPDATA%\PrepAI\ComfyUI) and click Install ComfyUI. Already have a ComfyUI portable? Use the existing folder instead. - Model: pick a workflow and click Download missing models.
- FLUX.2 Klein 4B — Apache 2.0, commercial use allowed, faster. Recommended to start.
- FLUX.2 Klein 9B — higher quality, FLUX Non-Commercial License. Gated: accept the license on Hugging Face and paste a Hugging Face Read token.
- Click Start (or just generate: the engine starts automatically).
Generate
The viewport is captured exactly as you see it — Original, Clay, Segmentation, Depth or Line Art — and sent to the AI with your prompt. Set Seed (or Random), Steps and Megapixels, then click Generate from Viewport. Free VRAM unloads the models; Stop shuts the engine down. The engine also stops when Unreal closes.
Prompts (style library)
About 630 ready-made prompt styles in 19 categories — photography, cinema, camera views, illustration, 3D, materials, architecture, interiors, eras and more. Click styles to build an ordered chain: it is added after your prompt when you generate (your prompt, style 1, style 2…), so you can change the look without rewriting the scene.
| Feature | Description |
|---|---|
| Chain | Numbered chips in the order they are applied: move ◀ ▶, remove ✕, Clear. The final prompt sent to the AI is shown below. |
| Presets | Save the current chain (e.g. “Concert night look”) and load it with one click. |
| Search & favorites | Filter by category, ★ Favorites or My styles; search by name, text or tag. |
| Insert into prompt | Copies the styles into the prompt text to edit them by hand. |
| Your own styles | New, Edit, Duplicate, Delete, new categories, Import / Export (.json). Built-in styles can always be restored with Reset built-in styles. |
Your styles, edits, favorites and presets are saved in %LOCALAPPDATA%\PrepAI\prompt_styles_user.json and are shared by all your projects. Each generation stores the scene prompt and the styles separately; Use settings restores both.
Viewport compare
After each generation a before/after overlay appears over the viewport: drag the line to compare. The image keeps its aspect ratio and lines up with the camera frame. Live viewport compares with the scene as it is now, Capture with the exact frame that was sent to the AI.
Generations (shot list)
Every result is saved in <Project>/Saved/PrepAI/AIRefs with the viewport capture and its metadata: prompt, seed, workflow, level, sequence, frame, frame rate, camera, lens (focal length, aperture, focus, sensor, FOV) and transform.
| Action | Description |
|---|---|
| Compare in viewport | Shows the before/after overlay. With Match shot camera on, the viewport first goes back to the shot. |
| Go to shot | Opens the sequence at the shot frame and switches the viewport to the shot camera, like the Camera options menu. Free-view shots go back to Perspective at the saved position. Cameras are found even if renamed. |
| Use settings | Loads prompt, seed and settings to iterate on a shot. |
| Rename / ★ / Delete | Name shots, mark favorites, filter by ★ or search by name, prompt, sequence or camera. |
| Save selected / Save all | Copies images (optionally with captures and metadata) to a folder. |
| Shot list CSV | Exports the shot list for production. |
Remote server
Run the AI on another computer (for example a workstation with a bigger GPU): start ComfyUI there with --listen, then in PrepAI Gen choose Engine → Remote server and enter its address, e.g. http://192.168.1.20:8188. The required models must be installed on that machine.
Actor tags
| Tag | Effect |
|---|---|
PrepAI_Keep | The actor is never modified. |
PrepAI_Char | The actor uses the character color in Clay. |
settings.json
<Project>/Config/PrepAI/settings.json — open it from the panel (Open settings.json), then click Rebuild materials after editing colors.
| Key | Description |
|---|---|
| clay_color, character_color | Linear RGB 0–1. |
| roughness | Clay roughness. |
| emissive | "keep" or "clay". |
| translucent, glass_opacity | "glass", "hide" or "keep"; opacity of the glass material. |
| keep_unlit, hide_decals, hide_sky, hide_fog | Same as the panel options. |
| emissive_name_keywords | Material names containing these words are treated as emissive. |
| depth_near_cm, depth_far_cm | Depth range in centimeters. |
| normal_axis_sign | Flip normal axes to match your AI tool. |
| seg_group_by, seg_colors | "actor" / "layer" / "folder" / "tag"; "distinct" or "ade20k". |
| seg_default_class | ADE20K class for unrecognized names (default "wall"). |
| lineart_* | thickness, depth_strength, normal_sensitivity, threshold, white_bg. |
| export_* | Passes, resolution, folder, format, MP4, name pattern, frame range, frame rate, samples. |
Tips & troubleshooting
- Restore before saving. Switch to Original before saving the level. A backup is always kept in
<Project>/Saved/PrepAI/<Level>.json, so materials can be restored even after a restart. - Generated materials are created in
/Game/PrepAI. - World Partition: only loaded actors are processed.
- Movie Render Queue renders what you see: you can also switch on Clay, Segmentation or a guide and render with your own MRQ settings.
- Generation is slow? Use the 4B model, lower Megapixels, click Free VRAM, or use a remote server: Unreal and the AI share the same GPU memory.
- Use a camera with Constrain Aspect Ratio for captures that match your final framing.
Third-party software and models
PrepAI does not include ComfyUI or any AI model. They are downloaded only when you click Install / Download, from their official sources, and are subject to their own licenses:
- ComfyUI (GPL-3.0) — github.com/comfyanonymous/ComfyUI
- FLUX.2 [klein] 4B (Apache 2.0) and 9B (FLUX Non-Commercial License), Black Forest Labs — huggingface.co/black-forest-labs
- Qwen3 text encoder and FLUX.2 VAE, repackaged by Comfy-Org — huggingface.co/Comfy-Org
Support
Questions, bugs or feature requests: info@salvonostrato.com
Please include your Unreal Engine version and, for errors, the lines starting with “PrepAI” from the Output Log.