← Back

ofxOGraf

github.com/Jonathhhan/ofxOGraf · @Jonathhhan
OF 0.12 Animation Graphics Bridges

ofxOGraf is an openFrameworks addon for creating and rendering portable broadcast graphics using templates from SceneBuilder or After Effects.

2 0 Last commit 2mo ago Created 3mo ago

Branches ahead of main

These branches have commits not yet on main — could be unmerged fixes or work in progress worth a look.

copilot/pages-hosting-setup 2 commits ahead · last commit 3mo ago

README

ofxOGraf



ofxOGraf is a tool-neutral openFrameworks authoring and runtime addon for portable broadcast graphics. Templates can be created directly with SceneBuilder or CodeTemplate; After Effects is an optional importer.

After Effects composition
        ↓ export_broadcast_scene_v2.jsx
Broadcast Scene JSON
        ↓ ofxOGraf
openFrameworks (native or Emscripten/WebAssembly)
        ↓ OfBroadcastGraphic.js
EBU OGraf v1 renderer


The existing AE path is not a binary .mogrt converter: it imports AE's scriptable scene model. Native scenes use the neutral Broadcast Scene 0.3 model, while unsupported source-specific features remain extensions or deterministic baked-frame fallbacks.

What is included



Renderer scope



Implemented:

Fidelity boundaries:

See docs/renderer-support.md for the feature matrix and fallback strategy.

Export from After Effects



For an existing After Effects-authored MOGRT, run import_mogrt_to_broadcast_scene.jsx instead. After Effects extracts the project, the wrapper asks for its root composition, and then invokes the normal exporter. See docs/mogrt-import.md; Premiere-authored MOGRTs are outside this path.

1. Open an AE project and make the desired composition active. 2. Run after-effects/export_broadcast_scene_v2.jsx using File → Scripts → Run Script File. 3. Save the resulting .scene.json. 4. Review report.unsupported and report.warnings in the output. Run bake_unsupported_layers.jsx in AE when the report calls for a baked fallback. 5. Copy the scene and exported assets to example-basic/bin/data/ for native testing or ograf/ for packaging.

Native openFrameworks build



Use openFrameworks Project Generator on example-basic, then build it normally for your platform. It constructs and renders a neutral lower third directly in C++ with SceneBuilder. For procedural drawing, implement CodeTemplate and host it with CodeTemplateHost. The optional example-imgui inspector remains independent of the core addon. See docs/native-authoring.md and docs/essential-controls.md.

example-basic also registers the compiled native-lower-third sample and exposes it to Emscripten. In OGraf, select it with code-template="native-lower-third" plus template-definition="./template-definition.json"; the normal scene attribute remains the declarative path.

Emscripten build



Install the openFrameworks Emscripten platform/toolchain, then build the OGraf target:

scripts\build-ograf.ps1


This keeps the classic localhost preview separate from the OGraf ES-module build, stages ograf/dist/ofxOGraf.{js,wasm,data}, and creates build/ofxOGraf-graphic.zip. The OGraf module factory is createOfxOGrafModule.

To compile the openFrameworks examples for browser preview:

scripts\build-emscripten-examples.ps1


This builds example-basic, example-tutorials, and example-imgui into bin\em\... with index.html, index.js, and index.wasm outputs.

To build and host a specific example locally:

scripts\build-emscripten-examples.ps1 -Examples example-tutorials -Serve -ServeExample example-tutorials -Port 8080


Then open http://localhost:8080/ in your browser.

OGraf package



Package the contents of ograf/, including the generated dist artifacts and every scene asset. Serve the directory over HTTP for local preview; ES modules and WASM generally do not work reliably from file://.

Create a server-ready ZIP after the Emscripten artifacts exist:

scripts\package-ograf.ps1


The packager validates the manifest and referenced runtime files, generates package-integrity.json and package-bom.json, enforces offline assets, and creates a deterministic archive. Verify the delivered artifact with scripts\verify-ograf-package.ps1 build\ofxOGraf-graphic.zip. For integration steps and the renderer conventions discovered in SuperFlyTV's implementation, see docs/testing-with-ograf-server.md.

For a CodeTemplate, pass its serialized descriptor and asset root explicitly:

scripts\package-ograf.ps1 
  -TemplateDefinition build\template-definition.json 
  -AssetRoot build\data


The packager validates the descriptor before staging, copies only its declared data/ assets, validates that staged filesystem again, hashes the final allowlist, and then creates the ZIP. See docs/package-integrity.md.

The manifest declares both real-time and non-real-time support. In non-real-time mode, setActionsSchedule() stores the action timeline and goToTime() rebuilds scheduled state when seeking backward before positioning the WASM timeline at the requested millisecond.

Validation



With Node.js available:

node scripts/validate.mjs
node tests/feature-contract.mjs
node tests/controls-contract.mjs
node tests/authoring-contract.mjs
node tests/code-template-contract.mjs
node tests/css-text-overlay-contract.mjs
node tests/golden-frame-contract.mjs
node scripts/validate-template-definition.mjs
node tests/code-template-delivery-contract.mjs
node tests/package-contract.mjs
node tests/package-integrity-contract.mjs
node tests/scene-migration-contract.mjs
node --check ograf/OfBroadcastGraphic.js
node --check ograf/EssentialControls.js


The committed ograf/dist/.gitkeep is intentional; generated WASM artifacts are ignored.

Production hardening



Before on-air use, add AE-vs-runtime golden-frame tests for the exact templates, fonts, effects, and GPU drivers in the deployment environment. Register project-specific text/effect handlers for anything that must remain editable and bake the rest.

Standards basis



The package targets the stable EBU OGraf Graphics specification v1. Its manifest uses the normative v1 schema and its custom element implements the required default export and lifecycle methods. The separate OGraf Server/Control API is intentionally outside this addon so draft API changes cannot leak into the scene runtime.

Get this addon

HTTPS
SSH