File size: 7,420 Bytes
aaf8747 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # Rendering custom proxy styles
The release includes map geometry, recorded world/camera observations, frame timing, and the source of proxy compiler 5.5.1. These inputs support new visual representations of the recorded scenes. The example below prepares a small portable session for a selected clip, then calls the actual bundled compiler. It does not require the omitted full-length source RGB video.
## Prepare a clip-sized session
First extract a training clip and its episode/map metadata as described in [USAGE.md](USAGE.md). Then run:
```bash
python examples/prepare_proxy_session.py \
--index metadata/source_index/global_index.sqlite3 \
--source-root source \
--alignment extracted_clip/clip_000001.alignment.json \
--output work/clip_session
```
The destination must be new. This standard-library adapter looks up each source `frame_id`, loads the authoritative per-segment `source_frames.jsonl` and `source_alignment.jsonl`, and prepares 124 output timestamps for each camera. It carries forward the recorded server times and world ticks while placing the output on the clip's 24 FPS grid. It copies unchanged observations from four seconds before through 0.6 seconds after the selected source interval to support the compiler's temporal filters. Reused source frames remain explicit in the preparation's `release_source_frame_id` fields.
The resulting session is a new rendering input. It is not claimed to reproduce the released compressed proxy bytes: filtering state, initialization, rendering environment, and encoding can affect a rerender. For exact original playback, use the included `.proxy.mp4`.
## Install the bundled renderer
Extract `metadata/renderer/proxy_source_5_5_1.zip` to a working directory; it contains `source/pyproject.toml` and the Python package. The original environment used Python 3.11 and is recorded under `metadata/renderer/environment/`. A typical isolated setup is:
```bash
python3.11 -m venv work/render-env
work/render-env/bin/python -m pip install -r metadata/renderer/environment/requirements.lock
work/render-env/bin/python -m pip install -e 'work/renderer/source[proxy-gl]' --no-deps
```
In this example, extract the source ZIP under work/renderer first. FFmpeg must be on PATH, and full collision rendering needs a working headless OpenGL/EGL implementation such as system Mesa. Install compatible system OpenGL/EGL libraries and drivers for your platform. The dependency lock covers Python packages; it does not install native graphics drivers.
The `wm-proxy` entry point is defined in the bundled `source/pyproject.toml`; its arguments are implemented in `source/src/wm_engine/proxy/cli.py`.
## Render a different shading style
This command uses flat shading instead of the release's relief shading, while retaining the captured trajectories and the compiler's classified map representation:
```bash
WM_GL_BACKEND=egl work/render-env/bin/python -m wm_engine.proxy.cli render \
work/clip_session \
--world source/worlds/scene_001 \
--output work/proxy_flat \
--ground collision \
--scene-mode classified \
--surface-shading flat \
--radius 150 \
--vegetation-clearance 0.35 \
--human-facing-cues
```
`work/proxy_flat` must not already exist. For a quick environment check, add `--max-frames 1 --resolution 320 180`; this produces one frame per camera rather than the whole clip. For software rendering on a configured Mesa system, `LIBGL_ALWAYS_SOFTWARE=1` and `GALLIUM_DRIVER=llvmpipe` select the CPU backend. Native library setup remains platform-specific.
The outputs are `work/proxy_flat/agent_000/proxy.mp4` and `work/proxy_flat/agent_001/proxy.mp4`. With the full-resolution, full-length command, combine the two views using:
```bash
ffmpeg -i work/proxy_flat/agent_000/proxy.mp4 \
-i work/proxy_flat/agent_001/proxy.mp4 \
-filter_complex '[0:v][1:v]hstack=inputs=2[v]' -map '[v]' \
-an -c:v libx264 -crf 18 -pix_fmt yuv420p -movflags +faststart \
work/proxy_flat_dual.mp4
```
Validate that both inputs have the same 124-frame sequence before combining them. The left camera must remain agent_000.
## CPU-only data-path smoke test
If EGL is unavailable, the bundled compiler also has a coarse CPU rasterizer. This command checks that the prepared observations, timing, and camera data are readable:
```bash
work/render-env/bin/python -m wm_engine.proxy.cli render \
work/clip_session \
--world source/worlds/scene_001 \
--output work/proxy_cpu_smoke \
--ground agent_plane \
--scene-mode placements_heightmap \
--surface-shading flat \
--max-frames 1 --resolution 320 180
```
This coarse ground/placement rendering changes geometry assumptions and is useful only as a setup check; the map's full collision representation requires the EGL path described earlier.
Release preparation tested clip extraction and all member hashes, both-view source/control lookup, clip-session preparation, and this one-frame-per-view CPU rendering using the shipped compiler. The full collision/EGL smoke test could not initialize a device on the publication host (`found 0 devices`), so it is not claimed as a newly verified full rerender.
## Extend the style beyond CLI switches
| Change | Source entry point |
|---|---|
| Flat versus neutral relief shading | `proxy/shading.py:surface_colors`, CLI `--surface-shading` |
| Static geometry representation | `proxy/scene.py:scene_geometry`, CLI `--scene-mode` |
| Semantic colors and facing cues | `proxy/geometry.py`, `proxy/gl_renderer.py` |
| Character and vehicle primitives | `proxy/humanoid.py`, `proxy/vehicle.py`, `proxy/compiler.py:dynamic_boxes` |
| Camera projection and world-to-image conversion | `proxy/geometry.py:Camera`, `proxy/gl_renderer.py:GLRenderer` |
| World placements and collision lookup | `world/static_store.py`, `world/collision.py` |
These paths are relative to `source/src/wm_engine/` inside the source ZIP. Make changes in a separate working copy and write outputs to a new directory. Preserve camera calibration, timing, entity identities, and raw observation provenance when the intended change is visual style. Be careful with palette changes: some renderer code recognizes semantic classes through exact colors, including the separation of water geometry; update those coupled rules together.
The compiler's supported scene modes are `classified`, `fast_collision`, and `placements_heightmap`; the last is a coarse legacy preview. It also exposes clutter/puddle filters, vegetation clearance, human facing cues, and occupant smoothing controls. Inspect `python -m wm_engine.proxy.cli render --help` for the exact bundled interface.
## Scope of reconstruction
The original proxy is a simplified geometric control representation. Rigid human proxies do not recover articulated motion or detailed seated poses. The map export does not capture every recording-specific dynamic IPL/MLO state. Clock alignment is estimated, and some source intervals have missing camera/world information. The metadata retains those limitations instead of inventing missing observations.
Recorded controls can support control-conditioned training, analysis, or new action encodings. New user-authored actions require a dynamics model or a compatible interactive simulator to produce a new world-state sequence. The shipped metadata and renderer alone do not implement the full GTA game simulation or guarantee deterministic game replay.
|