UCPE
π· [CVPR'26] Camera-controlled text-to-video generation, now with intrinsics, distortion and orientation control!
Install / Use
npx skills add chengzhag/UCPEInstalls into whichever agent you are using.
README
π· UCPE
<p align="center"> <h1 align="center">Unified Camera Positional Encoding for Controlled Video Generation</h1> <p align="center"> <p align="center"> <a href="https://chengzhag.github.io/">Cheng Zhang</a><sup>1</sup><sup>,2</sup> Β· <a href="https://leeby68.github.io/">Boying Li</a><sup>1</sup> Β· <a href="https://www.linkedin.com/in/meng-wei-66687a105/?originalSubdomain=au">Meng Wei</a><sup>1</sup> Β· <a href="https://yanpei.me/">Yan-Pei Cao</a><sup>3</sup> Β· <a href="https://www.monash.edu/mada/architecture/people/camilo-cruz-gambardella/">Camilo Cruz Gambardella</a><sup>1,2</sup> Β· <a href="https://research.monash.edu/en/persons/dinh-phung/">Dinh Phung</a><sup>1</sup> Β· <a href="https://jianfei-cai.github.io/">Jianfei Cai</a><sup>1</sup><br> <sup>1</sup>Monash University <sup>2</sup>Building 4.0 CRC <sup>3</sup>VAST </p> <h2 align="center"><a href="https://arxiv.org/abs/2512.07237">Paper</a> | <a href="https://chengzhag.github.io/publication/ucpe/">Project Page</a> | <a href="https://youtu.be/rMX7gxH8jBM">Video</a> | <a href="https://huggingface.co/datasets/chengzhag/PanShot">Hugging Face</a></h2> </p>
*Our UCPE introduces a geometry-consistent alternative to PlΓΌcker rays as one of the core contributions, enabling better generalization in Transformers. We hope to inspire future research on camera-aware architectures.
π’ Updates
- [2026.05.14] π₯ UCPE is used in SANA-WM
- [2026.04.12] π¦ Raw 4K Panoramic Videos released on HuggingFace β skips CameraBench and PanFlow curation; also provides ERP videos for PanShot (YouTube now serves 360Β° videos in EAC format, breaking the original download script).
- [2026.03.19] π§ Fixed a bug in PlΓΌcker encoding (thanks to @fengq1a0's issue #5).
- [2026.02.21] π UCPE accepted to CVPR 2026
- [2026.02.04] π PanShot Dataset And Curation Code (controllable camera data synthesized from PanFlow)
- [2026.02.04] π― Full Training, Evaluation, Visualization Code
- [2025.12.07] β‘ Quick Demo code released
π TLDR
π₯ Camera-controlled text-to-video generation, now with intrinsics, distortion and orientation control!
<p align="center"> <img src="images/cameras.png" alt="Camera lenses" height="120px"> <img src="images/orientation.png" alt="Orientation control" height="140px"> </p>π· UCPE integrates Relative Ray Encodingβwhich delivers significantly better generalization than PlΓΌcker across diverse camera motion, intrinsics and lens distortionsβwith Absolute Orientation Encoding for controllable pitch and roll, enabling a unified camera representation for Transformers and state-of-the-art camera-controlled video generation with just 0.5% extra parameters (35.5M over the 7.3B parameters of the base model)
<p align="center"> <img src="images/video-ucpe.gif" alt="UCPE" style="max-height:480px; width:auto;"> </p>π οΈ Installation
conda create -n UCPE python=3.11 -y
conda activate UCPE
conda install -c conda-forge "ffmpeg<8" libiconv libgl -y
pip install -r requirements.txt
pip install --no-build-isolation --no-cache-dir flash-attn==2.8.0.post2
pip install -e .
cd thirdparty/equilib
pip install -e .
We use wandb to log and visualize the training process. You can create an account then login to wandb by running the following command:
wandb login
<details>
<summary>Below are installations for tools used in evaluation and dataset processing
that can be skipped if you do not need these tools.</summary>
cd ../GeoCalib
pip install -e .
pip install -e siclib
cd ../UniK3D
pip install -e . --extra-index-url https://download.pytorch.org/whl/cu121
cd ../Q-Align
conda create -n qalign python=3.9 -y
conda activate qalign
pip install -e .
pip install jsonlines "numpy<2" protobuf pydantic-settings
cd ../vipe
conda env create -f envs/base.yml
conda activate vipe
pip install -r envs/requirements.txt
pip install --no-build-isolation -e .
</details>
<br>
β‘ Quick Demo
Download our finetuned weights from OneDrive and put it in logs/ folder. Then run:
bash scripts/demo.sh
The generated videos will be saved in logs/6wodf04s/demo, examples shown below:
demo/lens.json: Our Relative Ray Encoding not only generalizes to but also enables controllability over a wide range of camera intrinsics and lens distortions.
demo/pose.json: The geometry-consistent design of Relative Ray Encoding further allows strong generalization and controllability over diverse camera motions.
demo/teaser.json: Our Absolute Orientation Encoding further eliminate the ambiguity in pitch and roll in previous T2V methods, enabling precise control over initial camera orientation.
π PanShot Dataset
Please download the PanShot dataset from Hugging Face to data/UCPE/PanShot-7z by:
huggingface-cli download chengzhag/PanShot --repo-type dataset --local-dir data/UCPE/PanShot-7z
Then extract the dataset by:
cd data/UCPE/PanShot-7z
bash extract_panshot.sh
cd ../../..
The extracted dataset will be saved in data/UCPE/PanShot.
Please then copy the other files to form the following folder structure:
βββ captioned-test.jsonl
βββ captioned-train.jsonl
βββ max_rotation-test.json
βββ meta-test
βββ meta-train
βββ pose-test
βββ pose-train
βββ videos-test
βββ videos-train
<details>
<summary>If you want to go through the dataset curation process, Please follow these three steps.</summary>
Shortcut for steps 1 & 2: You can skip the CameraBench and PanFlow curation steps by downloading our pre-processed data directly:
huggingface-cli download --repo-type dataset chengzhag/UCPE --local-dir data/UCPE cd data/UCPE && bash unpack_hf.sh && cd ../..Note: step 3 (PanShot) still depends on the PanFlow dataset's videos and slam_poses, so you'll also need to download those following the instructions in the PanFlow section below β only the processing scripts can be skipped.
CameraBench
Download the dataset from multiple sources:
cd data
huggingface-cli download --repo-type dataset syCen/CameraBench --local-dir CameraBench
cd CameraBench
huggingface-cli download --repo-type dataset syCen/Videos4CameraBnech --local-dir data/videos
wget https://huggingface.co/datasets/chancharikm/cambench_train_videos/resolve/main/videos.zip
unzip videos.zip -d videos
cd ../..
Process the dataset:
conda activate UCPE
python tools/process_camerabench.py # set split = "train" and split = "test"
conda activate vipe
cd thirdparty/vipe
python thirdparty/vipe/run.py pipeline=default streams=raw_mp4_stream streams.base_path=data/UCPE/CameraBench/videos/ pipeline.output.path=data/UCPE/CameraBench/vipe/ pipeline.output.save_artifacts=true pipeline.post.depth_align_model=null
conda activate UCPE
python tools/geocalib_camerabench.py
python tools/filter_camerabench.py
Processed dataset will be saved in data/UCPE/CameraBench.
PanFlow
Download the pretrained model PanoFlow(RAFT)-wo-CFE.pth of Panoflow at weiyun, then put it in models/PanoFlow folder.
Our PanShot dataset is built upon PanFlow dataset's videos and slam_poses. Please download follow their instructions on how to download the full videos and download their meta and slam_poses files following Full Dataset.
Then process the dataset with:
conda activate UCPE
python tools/filter_panflow.py
conda activate qalign
python tools/score_panflow.py
conda activate UCPE
python tools/align_panflow.py # set split = "train" and split = "test"
python tools/match_panflow.py # set split = "train" and split = "test"
python tools/normalize_panflow.py # set split = "train" and split = "test"
PanShot
Note: YouTube recently changed its 360Β° video format from ERP (Equirectangular Projection) to EAC (Equi-Angular Cubemap). As a result, the video download part in
process_panshot.pyno longer works. Use the Shortcut above to download our pre-processed ERP videos first βprocess_panshot.pywill then automatically skip the download step and proceed with the remaining processing.
Export your YouTube cookies to ~/.config/cookies.txt in Netscape format for 4k download. Then download and process the dataset:
conda activate UCPE
python tools/process_panshot.py # set split = "train" and split = "test"
python tools/caption_panshot.py # set split = "train" and split = "test"
</details>
<br>
π‘ RealEstate10k Dataset
We use RealEstate10k Dataset for evaluation, so only poses and captions are needed. Plesae download the RealEstate10k poses from the official website (RealEstate10K.tgz) and unpack it
Related Skills
qqbot-channel
385.5kQQ channel management skill. Use qqbot_channel_api for explicit QQ channel-management requests; confirm write, delete, and bulk actions before calling authenticated QQ Open Platform endpoints.
docs-writer
106.4kAlways use this skill when the task involves writing, reviewing, or editing files in the `/docs` directory or any `.md` files in the repository.
cpp
40.5kGuide Cursor to write modern C++ and CMake code with clear structure, RAII, const-correctness, and safe error handling.
gamemaker-gml
40.5kGameMaker Language (GML) rules for scripts, objects, events, rooms, data structures, and performance-minded game code
