Renderer: Rendering Instance
An LCC rendering instance, responsible for data loading and rendering control of a single 3DGS scene. It is created via LCCManager.GetRender() and cannot be instantiated directly.
| Namespace | LCCCore |
Properties
| Property | Type | Access | Description |
|---|---|---|---|
Transform | Transform | Read-only | The Transform component to which the rendering instance is attached |
IsEnable | bool | Read-only | Whether the rendering instance is active; default true |
IsRenderAll | bool | Read-only | Whether the full LOD0 data is being rendered (vs. streaming / LOD traversal mode); default false |
Methods
The methods are grouped by purpose:
Data Loading and Lifecycle
Load
public void Load(string _filePath, Action<float> _onProgress, Action _onComplete, Action<string> _onError = null)
Loads a 3DGS data file. Supports .lcc2 (local file or HTTP remote) and the native formats .ply / .sog / .spz / .splat / .ksplat (local files only).
| Parameter | Type | Description |
|---|---|---|
_filePath | string | Data file path (local path or HTTP URL) |
_onProgress | Action<float> | Loading progress callback, can be null |
_onComplete | Action | Loading complete callback, can be null |
_onError | Action<string> | Loading failure callback (optional), with the error description as the parameter |
Notes:
- The
_onCompletecallback fires after the data actually lands on the GPU. - Operations such as shadow reception and effect triggering must be called inside the
_onCompletecallback. - Native formats always use the SingleRender full-load path (no LOD chunking); progress is reported via
_onProgressand failures via_onError. - The
MultiRendermode does not allow HTTP data sources or native formats. - HTTP supports only
.lcc2; native formats are local paths only and SingleRender mode only. SetPlatformType()/SwitchRenderPass()/SetMainCamera()and other prerequisites must be completed first.- You must call
Unload()orDispose()before callingLoad()again; callingLoad()while loading is in progress is rejected and triggers_onError.
Example:
renderer.Load("D:/data/scene.lcc2",
p => Debug.Log($"Loading {p:P0}"),
() => {
Debug.Log("Load complete");
lccManager.SetShadowReceive(true);
});
Unload
public void Unload()
Releases the currently loaded data and returns to the "created but not loaded" state, keeping the instance's manager registration. The same Renderer instance can be reused by repeatedly cycling Load → Unload → Load.
Notes:
- Difference from
Dispose(): the manager registration is not removed and the instance can be reused. - After
Unload(),IsEnableisfalse; callingLoad()again resets all data state. - Only executes when data has finished loading; returns immediately when not loaded or already
Dispose()d.
Example:
renderer.Unload();
renderer.Load(newFilePath, null, () => Debug.Log("Reloaded"));
Dispose
public void Dispose()
Destroys the rendering instance and releases all GPU resources and memory. The instance cannot be used after destruction, and all public methods become ineffective automatically.
Notes:
- Automatically notifies the LCCManager to remove the reference after the call.
Example:
renderer.Dispose();
renderer = null;
Runtime Control and Queries
SetEnable
public void SetEnable(bool _enable)
Sets the activation state of the rendering instance. When disabled, it does not participate in rendering or LOD selection.
| Parameter | Type | Description |
|---|---|---|
_enable | bool | Whether to activate |
Notes:
- Does not release resources and can be reactivated at any time.
Example:
renderer.SetEnable(false); // Hide
renderer.SetEnable(true); // Show
SetAlpha
public void SetAlpha(float alpha)
Sets the current Renderer's independent opacity. Unlike the process-level global alpha of LCCManager.SetAlpha(), this API only affects the current Renderer. Final alpha = splat coverage × LCCManager global alpha × this Renderer's alpha.
| Parameter | Type | Description |
|---|---|---|
alpha | float | Independent opacity of the current Renderer, range [0, 1], auto-clamped when exceeded |
Notes:
- Only takes effect on the MultiRender / RenderCore path (PC / Mac); on that path each splat carries a renderID, and the shader indexes the per-Renderer alpha array by renderID.
- The FullRender / Mobile path has no renderID, so this API is a no-op there (the value is cached and automatically applied when switching to the RenderCore path later).
Example:
renderer.SetAlpha(0.5f);
SetRenderAll
public void SetRenderAll(bool _renderAll)
Sets whether to use the full rendering mode (fully render LOD0 data). It takes effect on the next Load() call and does not affect the currently loaded dataset.
| Parameter | Type | Description |
|---|---|---|
_renderAll | bool | Whether to fully render |
Notes:
- Supported only on PC / Mac platforms; no effect on mobile / VR.
- Query the current state with the
IsRenderAllproperty.
Example:
renderer.SetRenderAll(true);
renderer.Load(filePath, null, () => Debug.Log("Full loaded"));
SetColliderEnable
// Return value: bool, true=set successfully, false=the data has no collider or the instance is inactive
public bool SetColliderEnable(bool _enable)
Toggles the collider feature. Once enabled, IntersectsSphere() / IntersectsCapsule() and RaycastMesh() become available.
| Parameter | Type | Description |
|---|---|---|
_enable | bool | Whether to enable the collider |
Notes:
- The data must contain a Collider node, otherwise
falseis returned. - The Renderer must be active.
Example:
bool ok = renderer.SetColliderEnable(true);
if (!ok) Debug.LogWarning("Data does not contain a collider");
SetEnvironment
public void SetEnvironment(bool _env)
Toggles environment data rendering. Environment data is a low-precision background point cloud used to fill distant views.
| Parameter | Type | Description |
|---|---|---|
_env | bool | Whether to render environment data |
Notes:
- The data must contain environment nodes.
- Environment data is independent of the main data's LOD system.
Example:
renderer.SetEnvironment(true);
GetBounds
public void GetBounds(out Vector3 max, out Vector3 min)
Gets the axis-aligned bounding box (world coordinates) of the rendered data.
| Parameter | Type | Description |
|---|---|---|
max | out Vector3 | Maximum point of the bounding box (world coordinates) |
min | out Vector3 | Minimum point of the bounding box (world coordinates) |
Notes:
- Returns
Vector3.zerowhen the data is not fully loaded. - Can be used for camera positioning and view angle calculation.
Example:
renderer.GetBounds(out Vector3 max, out Vector3 min);
Vector3 center = (max + min) / 2f;
Vector3 size = max - min;
GetSourceType
// Return value: SourceType
public SourceType GetSourceType()
Gets the source type of the loaded data; see SourceType.
Notes:
- Returns
SourceType.Nonewhen the data is not loaded.
GetDataType
// Return value: DataType
public DataType GetDataType()
Gets the format type of the loaded data; see DataType.
Notes:
- Returns
DataType.Nonewhen the data is not loaded.
GetMeta (From File Path)
// Return value: bool, true=read successfully
public bool GetMeta(string _filePath, out SplatMeta _metaData)
Reads the metadata of 3DGS data from the specified file path without fully loading the data.
| Parameter | Type | Description |
|---|---|---|
_filePath | string | Data file path |
_metaData | out SplatMeta | Output metadata |
Notes:
- Supports local paths and HTTP URLs.
- Only reads the file header metadata and does not load point cloud data.
- Returns
falsewhen the path is empty or the file does not exist.
Example:
if (renderer.GetMeta(filePath, out SplatMeta meta))
{
Debug.Log(meta.source);
Debug.Log(meta.dataType);
}
GetMeta (From Loaded Data)
// Return value: bool, true=read successfully
public bool GetMeta(out SplatMeta _metaData)
Gets the metadata of the currently loaded data. If the data has not finished loading, it tries to read from the file path.
| Parameter | Type | Description |
|---|---|---|
_metaData | out SplatMeta | Output metadata |
Example:
if (renderer.GetMeta(out SplatMeta meta))
{
Debug.Log(meta.source);
}
GetMeshBlockInfos
// Return value: List<LCCMeshBlockInfo>, collision Mesh block metadata; null when there is no Mesh or it is unavailable
public List<LCCMeshBlockInfo> GetMeshBlockInfos()
Returns the metadata of all collision Mesh blocks (id, world / local bounding box, vertex count, face count). Zero I/O, zero parsing — only reads the meta already in memory. See LCCMeshBlockInfo.
Notes:
- PC / Mac platform + local data source only; must be called on the main thread.
- Typical usage: first use it to get each block's world bounding box, pick the needed ids, then call
GetMeshes(ids)to read only those blocks. - Native formats (PLY / SOG / SPZ / splat / ksplat) have no Mesh and return
null(normal, no log).
Example:
var infos = renderer.GetMeshBlockInfos();
foreach (var info in infos)
{
Debug.Log($"{info.id}: verts={info.vertexCount}, faces={info.faceCount}");
}
GetMeshes
// Return value: List<LCCMeshBlock>, all collision Mesh geometry data; null when unavailable
public List<LCCMeshBlock> GetMeshes()
Synchronously returns the geometry data of all collision Mesh blocks (vertices + triangle indices, in local coordinates). This is a heavy operation (synchronous disk read + parsing + allocation), so call it once and cache it yourself — never call it every frame. See LCCMeshBlock.
Notes:
- PC / Mac platform + local data source only; must be called on the main thread.
- For large scenes, use
GetMeshBlockInfos()to pick ids +GetMeshes(ids)to avoid allocating a huge amount of managed memory at once. - A single block can have more than 65535 vertices, so
mesh.indexFormat = IndexFormat.UInt32must be set before building the Mesh.
Example:
var meshes = renderer.GetMeshes();
foreach (var block in meshes)
{
// block.vertices / block.triangles are in the object's local coordinate system
}
GetMeshes (By id)
// Return value: List<LCCMeshBlock>, collision Mesh geometry data of the specified ids; null when there is no hit
public List<LCCMeshBlock> GetMeshes(IEnumerable<string> _ids)
Synchronously returns the collision Mesh block geometry data (in local coordinates) of the specified ids. The ids are provided by GetMeshBlockInfos().
| Parameter | Type | Description |
|---|---|---|
_ids | IEnumerable<string> | The set of target block ids (provided by GetMeshBlockInfos()) |
Notes:
- Unknown ids are skipped with a warning; duplicate ids are deduplicated (no repeated disk reads); the return order is the traversal order of ids (after deduplication).
- Returns
nullwith a warning when the input isnull, empty, or has no hits. - Other constraints are the same as
GetMeshes().
Example:
var ids = new List<string> { "block-0", "block-3" };
var meshes = renderer.GetMeshes(ids);