Skip to content

Examples

Freya includes example applications demonstrating various engine features. Shared helpers live in Examples/Common/ (FreyaExamplesCommon).

IndustrialPipeLamp

Location: Examples/IndustrialPipeLamp/

Deferred PBR reference: lamps, animated lights, shadow-caster modes (0–4), light gizmos (F3), and a secondary window (F10). Quality / deferred views live in the ImGui debug panel.

cd build/Examples/IndustrialPipeLamp
./IndustrialPipeLamp

SsaoDebug

Location: Examples/SsaoDebug/

SSAO debug scene (DamagedHelmet, Dragon, ally_ship). Quality, deferred views, and SSAO knobs live in the ImGui debug panel.

cd build/Examples/SsaoDebug
./SsaoDebug

SkinnedFox

Location: Examples/SkinnedFox/

Crowd skinned demo: Blend2D locomotion, layers, look/IK, CPU or GPU skin paths, animation LOD, and anim_prof metrics. See Animation.

cd build/Examples/SkinnedFox
./SkinnedFox

CellBulbasaur

Location: Examples/CellBulbasaur/

Cell + edge post-process, custom G-buffer techniques (cell / triplanar / unlit), and toggleable posts (outline, color_grade, underwater, heat_haze, glow). World-space HealthBar / Text nameplates demo BillboardAlign::Screen (Cell) vs Cylindrical (PBR). Hotkeys: F4F11. Ground uses a tiled albedo for triplanar (F10). TAA/bloom stay available from options.

cd build/Examples/CellBulbasaur
./CellBulbasaur

Creating a new example

  1. Add Examples/<Name>/Main.cpp and Resources/ as needed.
  2. Add a short CMakeLists.txt:
add_freya_example(MyExample SOURCES Main.cpp)
# optional: IBL studio|outdoor|both|none  (default: studio)
  1. Register it in Examples/CMakeLists.txt with add_subdirectory(MyExample).

Reuse helpers from FreyaExamples:::

  • FlyCam — RMB look + WASD (options for flatten / look-gated move)
  • CreateGroundPlane — procedural ground quad
  • FindClipContaining — animation clip name search
  • CycleQuality / QualityName — Low→…→Off quality enums
  • DebugOverlay — Dear ImGui panel (quality / SSAO debug views / CPU + per-stage GPU ms via Vulkan timestamps)
  • ConfigureLogging — console + *.log file sink (FREYA_LOG_FILE, FREYA_LOG_CONSOLE=0)

Debug overlay

All four examples enable FreyaExamples::DebugOverlay on startup. The panel shows:

  • Timing — CPU frame/update ms, render resolution, and GPU ms per IFrameStage from Renderer::PollFrameGpuTiming (Vulkan timestamps on desktop). This is not Mali HWCPipe (PTILES / late-ZS); those counters are Arm-only.
  • Quality — Shadow / SSAO / TAA / Bloom / VSync
  • Debug views — deferred G-buffer / SSAO / shadows (DeferredDebugView), debug draw, SSAO knobs

The scene is rendered to an offscreen viewport (SetViewportTarget) and blitted behind ImGui on the swapchain UI pass (BeginUI / EndUI). FlyCam ignores mouse look while ImGui wants mouse capture; WASD stays available.

Running Examples

To build and run examples:

# Build from project root
cmake -B build -S . -G Ninja -DFREYA_BUILD_EXAMPLES=ON
cmake --build build

# Run an example (cwd must be the binary directory)
cd build/Examples/SkinnedFox && ./SkinnedFox