Download Utils/data_processing/docs/CAMERA_AND_RENDERING.md from vLAR/PhysInOne: direct link, hf CLI and curl.
- Browser
- Download file 10.4 kB
-
https://huggingface.co/datasets/vLAR/PhysInOne/resolve/main/Utils/data_processing/docs/CAMERA_AND_RENDERING.md
- Command line
-
hf download hf://datasets/vLAR/PhysInOne/Utils/data_processing/docs/CAMERA_AND_RENDERING.md
-
curl -L -o CAMERA_AND_RENDERING.md https://huggingface.co/datasets/vLAR/PhysInOne/resolve/main/Utils/data_processing/docs/CAMERA_AND_RENDERING.md
Camera Placement, Rendering, and Post-processing
This guide describes the public PhysInOne workflow for placing cameras, creating a Level Sequence, rendering EXR passes, and converting those passes into the dataset layout.
1. Prerequisites
Install Unreal Engine 5.5.4 and enable these project plugins:
- Python Editor Script Plugin
- Editor Scripting Utilities
- Movie Render Queue
The project must contain BP_CameraTrajectory and the Movie Render Queue
configuration assets referenced by render/render_config.bat.
Install post-processing dependencies in a normal Python environment:
python -m pip install -r requirements-render.txt
The camera scripts run inside Unreal Engine, not in the normal Python environment. The moving-camera script imports NumPy, so NumPy must also be available to Unreal's Python interpreter.
2. Configure BP_CameraTrajectory
Place BP_CameraTrajectory at the center of the physical event. Its rotation
must be zero and its X, Y, and Z scales must be identical. Use the smallest
uniform scale that still lets every camera capture the entire event.
| Field in the Unreal panel | Meaning |
|---|---|
Num |
Number of managed static cameras named CineCamera_0, CineCamera_1, and so on. Choose the count required by your release protocol; 7 in the reference panel is only an example. |
Time |
Sequence duration in seconds. The script calculates the authoritative frame count as round(Time Γ FPS). |
Random Sample Direction |
Randomly chooses clockwise or counterclockwise movement. |
Sample Clockwise |
Used only when Random Sample Direction is disabled. |
Random Hemisphere |
Randomly chooses the upper or lower hemisphere. |
Upper Hemisphere |
Used only when Random Hemisphere is disabled. |
Longtitude Range |
Longitude span in degrees. The property is intentionally spelled LongtitudeRange in the current Blueprint/API. |
Longitude Angles / Latitude Angles |
Output arrays written by the moving-camera generator. Do not edit them manually. |
Points Array |
Not consumed by the supplied Python scripts. |
Total Frames |
Not consumed by the supplied Python scripts; Time Γ FPS is authoritative. |
The default frame rate is 30 FPS. Redirect and laser phenomena that require faster motion sampling use 60 FPS.
3. Generate static cameras
Open the target level in Unreal Editor. In the Unreal Output Log, run:
py "D:/path/to/data_processing/camera/generate_static_cameras.py" --focal 18
Optional arguments:
| Argument | Default | Description |
|---|---|---|
--focal |
18 |
Focal length in millimeters. |
--aperture |
10 |
Camera aperture. |
--radius |
100 |
Base sphere radius in Unreal centimeters before Blueprint scale. |
--min-latitude |
30 |
Minimum absolute sampling latitude. |
--max-latitude |
60 |
Maximum absolute sampling latitude. |
--deterministic |
off | Removes the stable level-specific longitude offset. |
The script replaces only cameras whose labels match CineCamera_<integer>.
It does not delete unrelated CineCamera actors or CineCamera_Moving.
Inspect every generated camera in the viewport. Move or resize
BP_CameraTrajectory and rerun the script if an important object is occluded or
outside the frame.
4. Generate the moving camera and Level Sequence
After approving the static cameras, run:
py "D:/path/to/data_processing/camera/generate_camera_sequence.py" --focal 18
Useful arguments:
| Argument | Default | Description |
|---|---|---|
--focal |
18 |
Focal length in millimeters. |
--aperture |
10 |
Camera aperture. |
--radius |
100 |
Base trajectory radius in centimeters. |
--latitude-range |
60 |
Maximum latitude magnitude. |
--path-type |
random |
One of random, arc, sine, or loop. |
--seed |
level-derived | Explicit seed for a different reproducible path. |
--output-root |
project Rendered/Videos |
Optional camera-metadata root. |
For a canonical level such as:
/Game/PhysInOne/Scenes/Val/DoublePhysics/ExampleScene.ExampleScene
the script creates or replaces:
/Game/PhysInOne/Trajectories/Val/DoublePhysics/ExampleScene_trajectory.ExampleScene_trajectory
and writes metadata to:
<ProjectRoot>/Rendered/Videos/Val/DoublePhysics/ExampleScene_trajectory/
The generator replaces the sequence at that exact path and replaces only the
actor labeled CineCamera_Moving. It removes old camera metadata files but
never removes RGB, depth, segmentation, or other rendered-data directories.
The camera stage is the sole owner of:
transforms_train.json
transforms_val.json
transforms_test.json
It chooses two approximately opposite static cameras for validation, uses the first half of their timeline for validation, uses the first half of the other static cameras for training, and uses the second half of all static cameras for testing. The level-derived seed makes this choice reproducible. Post-processing preserves these files exactly.
Open the generated sequence and inspect the complete Camera Cuts track. To try
a different trajectory, rerun with a different --seed. Reduce
Longtitude Range if the camera crosses walls or other occluders. Once a path is
approved, do not move BP_CameraTrajectory or the static cameras without
regenerating the sequence.
5. Configure headless rendering on Windows
Copy the example configuration:
copy render\render_config.example.bat render\render_config.bat
Edit these local paths in render_config.bat:
set "UE_CMD=C:\Program Files\Epic Games\UE_5.5\Engine\Binaries\Win64\UnrealEditor-Cmd.exe"
set "UPROJECT=D:\PhysicBenchmark\PhysInOne.uproject"
set "DDC_LOCAL=D:\UnrealCache\Local"
set "DDC_SHARED=D:\UnrealCache\Shared"
Also verify all nine Movie Render Queue configuration paths: Train, Val, and
Test for SinglePhysics, DoublePhysics, and TriplePhysics. The public project
stores these .uasset files in:
PhysicBenchmark/Content/PhysInOne/Scripts/
This corresponds to /Game/PhysInOne/Scripts/ inside Unreal Engine. Do not
rename or relocate that directory: render_config.bat refers to these package
paths directly. The scripts alone cannot recreate the render-pass settings.
Render a list of levels:
render\render_levels_windows.bat -f examples\level_list.txt
Render one level:
render\render_levels_windows.bat -l "/Game/PhysInOne/Scenes/Val/DoublePhysics/ExampleScene.ExampleScene"
The renderer writes render/render_batch.log and records successful levels in
render/complete_render_list.log. It skips paths already in the completion
file and returns a nonzero exit code if any level fails. It does not terminate
other Unreal Editor processes.
6. Convert one completed render directory
Preview-safe conversion keeps the source EXRs:
python postprocess/exr_to_dataset.py \
"D:/PhysicBenchmark/Rendered/Videos/Val/DoublePhysics/ExampleScene_trajectory"
Delete each source EXR only after its converted file is written and verified:
python postprocess/exr_to_dataset.py \
"D:/PhysicBenchmark/Rendered/Videos/Val/DoublePhysics/ExampleScene_trajectory" \
--delete-source-exr
Select passes or worker count when necessary:
python postprocess/exr_to_dataset.py RENDER_DIR \
--channels rgb,depth,seg \
--workers 8 \
--jpeg-quality 95
By default, conversion also creates points3d.ply. It back-projects the first
RGB/depth frame from every static camera listed by
blender_CineCamera_<index>.json, merges the views in world coordinates, and
uniformly samples at most 100,000 colored points. CineCamera_Moving is not
used. The default valid-depth range is (0, 20) meters.
Adjust the point-cloud limits when necessary:
python postprocess/exr_to_dataset.py RENDER_DIR \
--depth-threshold 20 \
--max-points 100000 \
--ply-seed 0
Regenerate only the point cloud from existing JPEG/NPZ outputs:
python postprocess/point_cloud.py RENDER_DIR \
--depth-threshold 20 \
--max-points 100000
Use --skip-ply only when intentionally converting a channel subset that does
not include both RGB and depth. In render_processor.py, --force-ply
replaces an existing valid PLY; otherwise a valid existing file is preserved.
Output format:
ExampleScene_trajectory/
βββ CineCamera_0/
β βββ rgb/0000.jpg
β βββ depth/0000.npz # key: depth
β βββ seg/0000.npz # key: seg
βββ CineCamera_Moving/
β βββ rgb/
β βββ depth/
β βββ seg/
βββ blender_CineCamera_0.json
βββ points3d.ply # all static views, first frame only
βββ transforms_train.json
βββ transforms_val.json
βββ transforms_test.json
7. Monitor multiple scenes
Use canonical UE level paths and let the processor infer rendered directories:
python postprocess/render_processor.py \
--level-list examples/level_list.txt \
--project-root "D:/PhysicBenchmark" \
--watch \
--interval 60 \
--delete-source-exr \
--log-dir render_processor_logs
Alternatively, provide a text file containing one rendered directory per line:
python postprocess/render_processor.py \
--render-list rendered_directories.txt \
--watch
Without --watch, the processor performs one scan and exits. A pending render
produces exit code 2. Progress is flushed to disk in real time:
render_processor_logs/
βββ progress.log
βββ success_scenes.tsv
βββ failed_attempts.tsv
The success file is resumable: a later invocation with the same log directory skips scenes already verified as complete.
8. Important safety behavior
- Camera scripts only delete specifically managed camera actors.
- Regenerating a sequence replaces only the inferred scene sequence asset.
- Camera metadata cleanup never deletes rendered media directories.
- EXRs are retained unless
--delete-source-exris explicitly supplied. - Post-processing never samples views or rewrites
transforms_*.json. - A scene is not marked complete until
points3d.plyis valid, unless--skip-plywas explicitly supplied. - No script contains or requests a Hugging Face or GitHub access token.