diff options
Diffstat (limited to 'cnn_v3/docs/HOW_TO_CNN.md')
| -rw-r--r-- | cnn_v3/docs/HOW_TO_CNN.md | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/cnn_v3/docs/HOW_TO_CNN.md b/cnn_v3/docs/HOW_TO_CNN.md index 3013e1c..69bbf6f 100644 --- a/cnn_v3/docs/HOW_TO_CNN.md +++ b/cnn_v3/docs/HOW_TO_CNN.md @@ -138,49 +138,53 @@ Produces all 20 feature channels including normals, depth, mat IDs, and shadow. #### Blender requirements -- Blender 3.x+ or 5.x+, Cycles render engine (5.x API differences handled automatically) -- Object indices set: *Properties → Object → Relations → Object Index* must be > 0 +- **Blender 4.5 LTS** recommended (`blender4` alias); 5.x also works +- Cycles render engine (set automatically by the script) +- Object indices set: *Properties → Object → Relations → Object Index* > 0 for objects you want tracked in `matid` (IndexOB pass) #### Step 1 — Render EXRs ```bash -blender -b scene.blend -P cnn_v3/training/blender_export.py -- \ - --output /tmp/renders/ \ +cd cnn_v3/training +blender4 -b input_3d/scene.blend -P blender_export.py -- \ + --output tmp/renders/frames \ --width 640 --height 360 \ - --start-frame 1 --end-frame 200 + --start-frame 1 --end-frame 200 \ + --view-layer RenderLayer ``` -The `--` separator is **required**; arguments after it are passed to the Python script, -not to Blender. `--output` is the base directory for the compositor File Output node; -Blender appends the slot name and frame number automatically (e.g. `Combined0001.exr`). -`//` is a Blender shorthand for the directory containing the `.blend` file. +The `--` separator is **required**. `blender_export.py` uses native +`OPEN_EXR_MULTILAYER` render output — all enabled passes are written +automatically. One file per frame: `{output}/0001.exr`, `0002.exr`, … +Render progress (`Fra:/Mem:` spam) is suppressed; per-frame status goes to stderr. **Available flags:** | Flag | Default | Notes | |------|---------|-------| -| `--output PATH` | `//renders/` | Base output directory; `//` = blend file directory | +| `--output PATH` | `//renders/` | Output directory; `//` = blend file directory | | `--width N` | 640 | Render resolution | | `--height N` | 360 | Render resolution | | `--start-frame N` | scene start | First frame | | `--end-frame N` | scene end | Last frame | | `--view-layer NAME` | first layer | View layer name; pass `?` to list available layers | -**Render pass → CNN channel mapping:** +**Render pass → EXR channel → CNN file:** -| Blender pass | EXR channels | CNN use | -|-------------|-------------|---------| -| Combined | `.R .G .B .A` | `target.png` (beauty, sRGB-converted) | -| DiffCol | `.R .G .B` | `albedo.png` (linear → sRGB gamma 2.2) | -| Normal | `.X .Y .Z` | `normal.png` (world-space, oct-encoded to RG) | -| Z | `.R` | `depth.png` (mapped as 1/(z+1) → uint16) | -| IndexOB | `.R` | `matid.png` (object index, clamped uint8) | -| Shadow | `.R` | `shadow.png` (255 = lit, 0 = shadowed) | -| Combined alpha | `.A` | `transp.png` (inverted: 0 = opaque) | +| Blender pass | Native EXR channel | CNN file | +|-------------|--------------------|---------| +| Combined | `Combined.R/G/B/A` | `target.png` (beauty, linear→sRGB) | +| DiffCol | `DiffCol.R/G/B` | `albedo.png` (linear→sRGB γ2.2) | +| Normal | `Normal.X/Y/Z` | `normal.png` (oct-encoded RG) | +| Depth | `Depth.Z` | `depth.png` (1/(z+1) → uint16) | +| IndexOB | `IndexOB.X` | `matid.png` (object index, uint8) | +| Shadow | `Shadow.X` | `shadow.png` (255=lit; defaults to 255 if absent) | +| Combined alpha | `Combined.A` | `transp.png` (1−alpha, 0=opaque) | -**Pitfall:** Blender `Normal` pass uses `.X .Y .Z` channel names in the EXR, not `.R .G .B`. -`pack_blender_sample.py` handles both naming conventions automatically. +**Note on Shadow pass:** Blender's Cycles Shadow pass may be absent for scenes +without shadow-casting lights or catcher objects; `pack_blender_sample.py` defaults +to 1.0 (fully lit) when the channel is missing. #### Step 2 — Pack EXRs into sample directories |
