MeRoPE: Metric Rotary Position Embedding for Camera-Controlled Video Generation

Zhijian Qiao1, Xinjiang Wang2, Jiajie Chen2, Haoming Huang2, Meng Li2, Chih-Chung Chou2, Jing Wang2, Shaojie Shen1

1HKUST    2Zhuoyu Technology

Paper Code coming soon

Every video token has a ray

Language models use positional encoding to tell words where they occur in a sequence. MeRoPE gives each video token a geometric position: when it occurs, where its camera ray starts, and where the ray points. It encodes relative camera motion without amplifying feature magnitudes, and adds geometric cues for potential matches across views.

A calibrated camera places each token’s ray in 3D: its origin follows the camera position, and its direction passes through the token’s image-plane location. The highlighted token also moves within the image plane; (u, v) are normalized image coordinates. The synchronized time axis adds the fourth coordinate. Motion is illustrative.

Alongside visual features, MeRoPE uses each token's time and calibrated camera ray. These geometric tags help the model relate observed tokens to the tokens it predicts across cameras and time. It does not need a separate 3D reconstruction model such as VGGT [1] or Depth Anything 3 [2] to produce point clouds or depth maps before generation. This keeps the hand-designed interface small: we provide the ray geometry, while correspondence and scene evolution are learned from data.

How geometry enters attention

UCPE [3] assigns a ray-local frame to every calibrated camera ray. The frame begins at the ray origin, and one axis follows the ray direction. MeRoPE uses the same ray-local representation and chooses the remaining frame orientation with a minimum rotation (MinRot). The paper gives the full construction and singularity analysis.

For a query token \(a\) and a key token \(b\), an operator \(\mathcal{U}_{ab}\) inserts their relative geometry into the attention score:

\[ \underbrace{\frac{\mathbf{q}_a^\top\mathbf{k}_b}{\sqrt d}}_{\text{standard attention}} \quad\longrightarrow\quad \underbrace{\frac{\mathbf{q}_a^\top\mathcal{U}_{ab}\mathbf{k}_b}{\sqrt d}}_{\text{geometry-aware attention}}. \]

Here \(\mathbf{q}_a\) and \(\mathbf{k}_b\) are the query and key feature vectors, \(d\) is their dimension, and \(\mathcal{U}_{ab}\) encodes the geometric relation between the tokens. The geometric version differs from standard attention only by this operator.

GTA [4], PRoPE [5], and UCPE [3] use the homogeneous relative transform between the two frames as this operator:

\[ \mathcal{U}^{\mathrm{hom}}_{ab} = \begin{bmatrix} R_{ab} & \mathbf{t}_{ab}\\ \mathbf{0}^\top & 1 \end{bmatrix}. \]

The matrix \(R_{ab}\) and vector \(\mathbf{t}_{ab}\) rotate and translate from the key ray-local frame to the query ray-local frame. The vector \(\mathbf{0}\) is zero in three dimensions. Write the corresponding query and key channels as 3D vectors \(\mathbf{u}^{q},\mathbf{u}^{k}\) and scalars \(h_q,h_k\). Their contribution to attention is

\[ \begin{bmatrix}\mathbf{u}^{q}\\h_q\end{bmatrix}^{\!\top} \mathcal{U}^{\mathrm{hom}}_{ab} \begin{bmatrix}\mathbf{u}^{k}\\h_k\end{bmatrix} = (\mathbf{u}^{q})^\top R_{ab}\mathbf{u}^{k} +\underbrace{h_k(\mathbf{u}^{q})^\top\mathbf{t}_{ab}}_{\text{metric-translation term}} +h_qh_k. \]

The middle term depends directly on metric translation.

Why metric translation can dominate

Ray origins are measured in meters. Scaling the same motion by \(\lambda>0\) changes \(\mathbf{t}_{ab}\) to \(\lambda\mathbf{t}_{ab}\), so the translation term becomes

\[ h_k(\mathbf{u}^{q})^\top\mathbf{t}_{ab} \quad\longrightarrow\quad \lambda h_k(\mathbf{u}^{q})^\top\mathbf{t}_{ab}. \]

The term can grow with camera baseline even when visual similarity stays the same. After softmax, attention may favor a distant frame because of its distance rather than its visual content.

UCPE assigns excessive attention to the most distant early frame, while MeRoPE preserves a local temporal profile
Temporal attention from the center token of the final frame. Frame 0 is the farthest key frame and frame 12 is the query frame. Trained UCPE [3] has an attention spike at the farthest frame, while MeRoPE keeps a local temporal profile.

MeRoPE retains the metric relative pose but represents it with rotations, whose output norm does not grow with distance.

Encode where rays point and how cameras move

MeRoPE separates relative pose into ray-frame rotation and metric translation. Both become norm-preserving operators in attention: changing camera geometry changes their rotation angles while keeping feature lengths fixed.

Rotation · viewing direction

Query ray Q turns around the fixed camera origin O; the blue minimum-rotation arc from optical axis z and the local coordinate frame follow.
Turn query ray Q while camera origin O and optical axis z stay fixed. The blue MinRot arc and local axes follow. Comparing the query and key ray frames then encodes their relative viewing orientation.

Translation · camera displacement

Key camera K moves along the baseline while query camera Q stays fixed; the green relative displacement vector changes length.
Move key camera K while query camera Q stays fixed. The green Δo changes with the baseline. MeRoPE maps each displacement coordinate to rotary phases, retaining metric motion without stretching the features.
How metric displacement becomes rotary phases

The relative rotation \(R_{ab}\) between the MinRot ray-local frames already preserves norms. Let \(C_a\) map query-camera coordinates into the world frame, and let \(\mathbf{o}_a\) and \(\mathbf{o}_b\) be the two ray origins. Their displacement in the query camera is

\[ \Delta\mathbf{o}_{b\mid a}=C_a^\top(\mathbf{o}_b-\mathbf{o}_a). \]

Because \(C_a^\top\) depends on the query, subtracting two independent world-frame phases cannot recover this quantity. MeRoPE computes the relative translation first and then encodes each coordinate with multi-frequency 2D RoPE rotations [6]:

\[ \mathcal{U}^{\mathrm{trans}}_{ab} =\bigoplus_{c\in\{x,y,z\}}\;\bigoplus_{k=0}^{K-1} \operatorname{Rot}\!\left(\omega_{c,k}[\Delta\mathbf{o}_{b\mid a}]_c\right), \qquad \operatorname{Rot}(\theta)= \begin{bmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{bmatrix}. \]

The index \(c\) selects a translation coordinate. The value \(K\) is the number of frequencies, \(k\) indexes them, and \(\omega_{c,k}\) is the corresponding angular frequency. The direct sum \(\oplus\) places the independent 2D rotations on the diagonal. Distance changes their angle \(\theta\), not the feature magnitude.

Add cues for where a cross-view match may lie

Relative pose describes camera geometry. For a static scene point on a key ray, its possible direction in the query view depends on its unknown depth. These candidate directions trace a purple spherical arc. MeRoPE samples anchors along this arc and encodes each anchor frame relative to the query ray frame, giving attention a geometric cue for potential correspondence.

Turn the key ray · reshape the arc

The ray from key camera K turns while both camera origins remain fixed. Its vanishing direction u moves, changing the purple arc toward fixed epipole e and the anchor at a fixed angular fraction.
Turn the ray from K with both camera origins fixed. Its vanishing direction u moves, reshaping the arc toward the fixed epipole e. The large purple dot stays at the same angular fraction along the changing arc.

Move the anchor · change its frame

The key ray and purple arc stay fixed while the large anchor dot moves along the arc. Its local coordinate frame and the blue angle from query ray Q change together.
Keep the key ray and arc fixed, then move the large purple dot. Its local axes and the blue angle from query ray Q change. MeRoPE encodes the resulting relative frame rotation for each anchor.

In these diagrams, u denotes \(\mathbf{u}_\infty\), the key-ray direction at infinite depth; e points from the query camera toward K.

The moving dot illustrates the anchor construction. The model uses a fixed set of angular fractions along each arc, encoding all of their relative rotations together as \(\mathcal{U}^{\mathrm{disp}}\). Visual content determines whether a valid correspondence exists; the anchors supply candidate geometry without requiring a predicted depth map.

Put the geometric cues together

MeRoPE has three camera-geometry blocks: anchor-frame rotations \(\mathcal{U}^{\mathrm{disp}}\), relative ray-frame rotation \(\mathcal{U}^{\mathrm{rot}}\), and metric translation RoPE \(\mathcal{U}^{\mathrm{trans}}\). A fourth block, \(\mathcal{U}^{\mathrm{native}}\), retains the backbone's time and image-coordinate RoPE.

Block-diagonal MeRoPE operator between query and key features
Block-diagonal structure of \(\mathcal{U}_{ab}\) (Figure 3 in the paper). Separate feature bands encode anchor-frame rotations, relative ray-frame rotation, metric translation, and the backbone's time and image coordinates. The off-diagonal blocks are zero, so the four components do not mix.
\[ \mathcal{U}_{ab} =\mathcal{U}^{\mathrm{disp}}\oplus\mathcal{U}^{\mathrm{rot}} \oplus\mathcal{U}^{\mathrm{trans}}\oplus\mathcal{U}^{\mathrm{native}}, \qquad \mathcal{U}_{ab}^\top\mathcal{U}_{ab}=I. \]

The matrix \(I\) is the identity. Because every block is a rotation, \(\mathcal{U}_{ab}\) changes geometric phase without changing feature length. It encodes ray geometry and metric camera motion without allowing a longer baseline to amplify the query-key score.

Camera control across driving datasets

One MeRoPE model, trained with Wan2.2 TI2V-5B, controls camera motion on Waymo, Argoverse 2, and nuScenes. These selected held-out examples share the first nine observed frames and follow original, left-offset, or right-offset camera commands. See the paper for results on the full evaluation set.

Commanded pathRecovered camera pathOriginal path (BEV)

Residential neighborhood

More Waymo demos (3 scenes)

Palm-lined street

Urban transit corridor

Sweeping bend at dusk

Urban intersection

More Argoverse 2 demos (3 scenes)

Downtown crossing

Under the elevated roadway

Mural-lined street

Industrial district

More nuScenes demos (3 scenes)

City avenue

Tree-lined bend

Cross traffic by a brick arcade

Generalization across camera optics

We also test the ray-based encoding on PanShot, the diverse-camera benchmark introduced with UCPE [3], using a Wan2.1 T2V-1.3B backbone [7]. The examples include indoor and outdoor scenes, low light, and very wide fields of view.

More PanShot results

Real-to-Sim from historical revisits

Historical images act as visual anchors for generating the same place along a new camera path. Their visual tokens join the video tokens in self-attention, where MeRoPE encodes relative camera pose and ray geometry to help relate historical scene details to the new view.

More Real-to-Sim demos (3 scenes)

nuScenes · Nine conditioning frames. Top: reference cameras and two generated paths. Bottom: four representative historical inputs, labeled by capture date; L / R indicates which path uses each view.

BibTeX

@article{qiao2026merope,
  title  = {MeRoPE: Metric Rotary Position Embedding for Camera-Controlled Video Generation},
  author = {Qiao, Zhijian and Wang, Xinjiang and Chen, Jiajie and Huang, Haoming and
            Li, Meng and Chou, Chih-Chung and Wang, Jing and Shen, Shaojie},
  journal = {arXiv preprint arXiv:2609.01252},
  year    = {2026},
  url     = {https://arxiv.org/abs/2609.01252}
}

References

  1. VGGT: Visual Geometry Grounded Transformer.
  2. Depth Anything 3: Recovering the Visual Space from Any Views.
  3. Unified Camera Positional Encoding for Controlled Video Generation.
  4. GTA: A Geometry-Aware Attention Mechanism for Multi-View Transformers.
  5. Cameras as Relative Positional Encoding.
  6. RoFormer: Enhanced Transformer with Rotary Position Embedding.
  7. Wan: Open and Advanced Large-Scale Video Generative Models.
  8. nuScenes: A Multimodal Dataset for Autonomous Driving.