Skip to content

BlenderHQ/GroundTruth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GroundTruth (Blender Add-on)

Imports and exports RealityCapture/RealityScan-style XMP camera priors (xcr: namespace), either from a Blender camera animation or as one XMP per scene camera.

Features

  • Export one .xmp per frame (RC-style <xcr:Rotation>, <xcr:Position>, intrinsics).
  • Import or export one .xmp per camera in Multi-Camera mode.
  • Export a single Metashape/Agisoft XML from an animation range or from many scene cameras.
  • Render Frame + XMP and Render Animation + XMP:
    • Internal backend uses Blender’s normal render UI/preview.
    • External backend runs a background Blender render (reliable cancel).
  • Export XMP (Range) writes XMPs without rendering.
  • Import XMP Cameras creates or updates scene cameras from selected XMP files.
  • Export XMP Cameras writes one XMP per visible, selected, or all scene cameras.
  • Imported XMP intrinsics, distortion, groups, and double-precision pose values are stored on the camera for safer round trips.
  • Export Metashape XML (Range) writes one XML camera per animation frame without rendering.
  • Export Metashape XML Cameras writes one XML camera per visible, selected, or all scene cameras.
  • Principal point is exported as zero (xcr:PrincipalPointU/V = 0).
  • Distortion model:
    • Perspective: coefficients exported as zeros.
    • Brown: manual coefficient entry in the UI (k1 k2 k3 k4 t1 t2), and the add-on auto-selects the RC model:
      • brown3 / brown4 (if k4 != 0)
      • brown3t2 / brown4t2 (if t1 != 0 or t2 != 0)

Install

  1. Build the install zip:
    • python3 build_ground_truth_addon_zip.py
  2. In Blender: Edit → Preferences → Add-ons → Install… and pick ground_truth_blender.zip.
  3. Enable the add-on: GroundTruth.

Usage

Open a .blend with an animated camera and use:

  • View3D → Sidebar → GroundTruth panel (main controls)
  • Image Editor → Sidebar → GroundTruth (render-time status + cancel)

Key options:

  • Camera: defaults to the scene active camera.
  • Camera Mode: use Animation for one camera over frames, or Multi-Camera for one scene camera per XMP/XML camera.
  • Name Matching: controls whether Multi-Camera import updates existing cameras by object name, camera data name, case, and extension.
  • Preserve Imported XMP: reuses imported XMP metadata during export while the camera pose still matches the imported pose.
  • Use Scene Render Output: names XMP sidecars next to Blender’s render output (scene.render.filepath / frame_path).
  • Use Scene Frame Range: uses scene.frame_start/end/step for animation operations.
  • Write Metashape XML: after render, also writes Metashape XML into the output directory.

Output naming

XMP is written as a sidecar next to the rendered image:

  • .../frame_0001.png.../frame_0001.xmp

For still renders, Blender may write directly to scene.render.filepath; the add-on writes the matching .xmp next to that file.

In Multi-Camera mode, camera XMP files are written to Output Dir and named from the camera object names. Metashape XML camera labels also use camera object names; rename cameras to match photo filenames when you want Metashape to attach transforms to already loaded photos.

Use Clear Stored XMP on a selected camera if you want export to ignore imported metadata and use the current Blender camera settings instead.

Cancel behavior

  • Internal renders: Blender does not reliably expose a cancellable render operator via bpy. Cancel usually requires Esc in the render window. If Blender is launched with --enable-event-simulate, the add-on can attempt to send an Esc event.
  • External renders: cancel terminates/kills the background Blender process.

Notes (External Backend)

  • External renders require a .blend on disk. If the file is unsaved/dirty, a temporary copy is saved into the output directory.
  • The external process runs with isolated BLENDER_USER_* paths (to avoid broken user add-ons affecting the render).

About

Blender 5.0+ addon to render frames or animation with Camera intrinsics in sidecar XMP (RealityCapture/RealityScan)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages