Rendering Hosts Snapshots and UI Tiles
Host or helper | Use it when | Key controls |
|---|---|---|
Chart3DComponent | The chart belongs in a 3D scene as real world-space geometry. | Definition or ChartAsset, data asset or source, PlotSize, axes, shadows, environment, Rebuild and RebuildMeshes. |
Chart3DCameraRig | The chart needs a dedicated orbit camera or reproducible preview pose. | Chart3DPose, projection mode, distance, reset, optional child camera. |
ChartRaycaster and shared interaction | A scene chart should receive pointer input without a collider. | Camera raycaster, EventSystem, selection, hover, orbit, wheel or pinch zoom. |
Chart3DSnapshot | You need static textures, PNGs, preview tiles, gallery cards, or store imagery. | AutoFrame, supersample, transparent background, RenderTo, EncodeToPng. |
Chart3DTexture | A Canvas RawImage should show a live 3D chart. | Own or Source content, view pose and projection, theme, output size, quality, Invalidate and timing. |
Chart3DImage | A MaskableGraphic should show a live 3D chart with masking or custom UI material behavior. | Own or Source content, view, masking, material, preserve aspect, Invalidate and timing. |
Chart3DSnapshotOptions | Output must be consistent across previews, documentation, and marketing captures. | Theme, Appearance, pose, projection, plot size, framing, resolution and supersampling. |
World Space Rendering
- Chart3DComponent renders a Chart as world-space 3D geometry.
- It owns the surface mesh, a line mesh for axes/grid/rules, TextMeshPro label objects, optional shadow/environment handling, and instanced symbol batches.
- Chart3DCameraRig applies Chart3DPose and Chart3DCameraProjection through an optional child camera.
- Add ChartRaycaster to the camera and use an EventSystem for scene pointer events. The shared input path supports hover and tooltips, mark selection, drag orbit, double-tap reset, and wheel or pinch zoom; chart colliders are not required.
- Chart3DTexture renders a live 3D chart into a RawImage for Canvas dashboards.
- Chart3DImage is a MaskableGraphic variant for masks, rounded-corner materials, and custom Graphic workflows.
UI Outputs and Snapshot Ownership
Chart3DTexture renders into a Canvas RawImage and Chart3DImage is a maskable Graphic. In Own mode each hosts its own inline definition or ChartAsset, data and transitions. In Source mode it mirrors a Chart3DComponent's content and plot size. Each output owns a private view, so orbiting one output does not turn the scene chart or another output. Use Chart3DElement for UI Toolkit with the same definition, assets and data-source model.
Outputs redraw when chart data, theme, options, pixel size or pose changes. Refresh Hz adds periodic renders for stateful content that changes without notifying the chart; zero is the normal change-driven mode. Invalidate() requests a redraw. Manual timing renders only when Refresh is called. Auto Rotate turns the view in Play Mode and leaves Edit Mode at its initial pose.
using System.IO;
using ChartGuru;
public static class SnapshotPngExample
{
public static void Save(
Chart chart,
Chart3DSnapshotOptions options,
string writablePath)
{
byte[] png = Chart3DSnapshot.EncodeToPng(chart, options);
File.WriteAllBytes(writablePath, png);
}
}
Chart3DComponent.Capture(Chart3DCaptureOptions) returns a caller-owned RGBA texture with the host's plot size, appearance and framing, independently of the scene camera. OverridePose, Pose and Projection choose a different capture view. A running transition is captured at its destination. Destroy the returned texture when finished.
Chart3DSnapshot.RenderTo renders into a caller-provided RenderTexture without CPU readback. Render returns a caller-owned Texture2D; RenderOrbit returns caller-owned frame textures. Destroy those textures after use. EncodeToPng releases its intermediate texture. Chart3DSnapshotOptions uses the shared Theme and optional Appearance overrides.
UI Toolkit Output
Use Chart3DElement in UXML or code for a live spatial chart. It supports SetChart, SetData, MorphTo, Pose, Projection, AutoRotate, Zoom, Lift and PlayLift, plus shared tooltips. Subscribe to DataPointClicked, DataPointSelected, DataPointHovered, SelectionCleared or TooltipChanged for application UI. UIToolkitChartBinder can bind a named 3D element in a UIDocument or compatible PanelRenderer.