Skip to main content

Mixed 2D and 3D

You can render 3D world content and 2D UI/HUD in the same frame loop.


Typical Pattern

worldRenderer is Renderer3D.Create();
hudRenderer is Renderer2D.Create();

worldRenderer.SetCamera(worldCamera);
hudRenderer.SetCamera(hudCamera);

canvas(window) {
OnFrame {
worldRenderer.Render(worldScene);
hudRenderer.Render(hudScene);
}
}

  • Keep world entities in one scene
  • Keep HUD entities in a separate scene
  • Use dedicated cameras for each layer
  • Keep clear color ownership in one renderer to avoid ambiguity

Practical Use Cases

  • 3D gameplay world + 2D health bar
  • 3D model viewer + 2D text overlay
  • 3D simulation + 2D debug panels

Next Steps