VoxelGIData
Baked data and parameters for a VoxelGI volume.
VoxelGIData stores a prepared octree and indirect-light parameters. The normal workflow is VoxelGI.Bake → Data → external .rbin saving. Make an independent resource copy to apply different settings to one bake; changing shared Data affects volumes using it.
The example returns a resource owned by the caller. Assigning volume.Data makes the volume retain the copy; release your own reference when no longer needed. This copies already baked data rather than rebaking geometry.
using System;
using Reckfell;
public static class VoxelDataCopies
{
// Caller owns the returned resource. The source stays unchanged.
public static VoxelGIData WithEnergy(VoxelGIData source, float energy)
{
ArgumentNullException.ThrowIfNull(source);
if (!float.IsFinite(energy) || energy < 0f)
throw new ArgumentOutOfRangeException(nameof(energy));
var copy = (VoxelGIData)source.Duplicate(true);
copy.Energy = energy;
return copy;
}
}See the VoxelGI guide for workflow and diagnosis.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelGIDataConstructor
public VoxelGIData();Creates a resource without baked geometry. Normally use VoxelGI.Bake and VoxelGI.Data, or load an existing .rbin. A resource existing does not itself mean usable GI-volume data exists.
Properties8
BiasProperty
public float Bias { get; set; }Initial cone-trace distance in voxel coordinates, distinct from NormalBias. Helps reduce self-occlusion, but excessive values can skip thin occluders. A new resource getter returns 1.5; this alone does not prove pixel equivalence of every renderer default. The inspector hint 0…8 does not clamp the setter.
DynamicRangeProperty
public float DynamicRange { get; set; }VoxelGI buffer energy encoding range, default 2. Used to scale energy down and restore it during calculations; use a finite positive value. The inspector hint 1…8 does not clamp the setter. This is not camera exposure or a quality setting without precision tradeoffs.
EnergyProperty
public float Energy { get; set; }Indirect-light multiplier, default 1. Setting 0 removes the tested VoxelGI contribution without disabling direct light or emissive-material visibility. The inspector hint 0…64 does not clamp the setter: 65 is retained, for example. Use a finite nonnegative value.
InteriorProperty
public bool Interior { get; set; }When true excludes sky contribution from VoxelGI; defaults to false. Useful for closed rooms, but does not disable direct lights or repair geometry holes. Changing it does not rebuild static meshes.
NormalBiasProperty
public float NormalBias { get; set; }Offsets the sampling position along its normal in voxel coordinates, default 0. Unlike Bias it moves the sample origin rather than only changing initial distance along the cone. Adjust gradually while checking light leaks. The inspector hint 0…8 does not clamp the setter.
PropagationProperty
public float Propagation { get; set; }Energy propagation coefficient used while building VoxelGI levels, default 0.5. The inspector hint 0…1 does not clamp the setter; stay within the normal range unless you have verified another regime. Higher values do not guarantee physically correct brightness; compare with Energy and UseTwoBounces.
UseTwoBouncesProperty
public bool UseTwoBounces { get; set; }Enables a second indirect-light bounce pass; defaults to true. May change brightness and light distribution. Does not promise free quality improvement: check the image and GPU time on the target scene. Does not rebake geometry.
_DataProperty
public Reckfell.Collections.Dictionary _Data { get; set; }Internal serialization dictionary, not a stable external format. Contains bounds, octree_size, octree_cells, octree_data, level_counts, to_cell_xform and either raw octree_df or compressed L8 PNG octree_df_png. Do not confuse PNG with Allocate raw bytes. Reading constructs a serialization representation; writing requires a complete consistent dataset and calls Allocate. Energy/Bias and other properties are stored separately. Use Duplicate(true) for ordinary copies and ResourceSaver with .rbin for files.
Methods22
Allocate2 overloads
public void Allocate(Transform3D toCellXform, Aabb aabb, Vector3 octreeSize, byte[] octreeCells, byte[] dataCells, byte[] distanceField, int[] levelCounts);Low-level upload of a consistent set of already prepared voxel buffers. Does not voxelize a mesh or replace Bake. octreeCells/dataCells use 32/16 bytes per cell; distanceField takes raw L8 bytes. Use Duplicate(true) for ordinary copying.
Old GPU buffers are freed before some input checks: this operation is not atomic and does not guarantee previous state survives an error. Returns void; do not use with untrusted or arbitrarily constructed arrays. Supply consistent data and inspect errors. Input C# arrays do not remain a live view of GPU data.
| Name | Type | Default |
|---|---|---|
toCellXform | Transform3D | — |
aabb | Aabb | — |
octreeSize | Vector3 | — |
octreeCells | byte[] | — |
dataCells | byte[] | — |
distanceField | byte[] | — |
levelCounts | int[] | — |
toCellXformLocal-volume-to-cell transform from the same dataset.
aabbLocal volume bounds from the same bake.
octreeSizeGrid dimensions along each axis; use positive integral dimensions from a valid bake.
octreeCellsInternal structure: length must be a multiple of 32 bytes. Length alone does not establish validity.
dataCellsData for the same cells: 16 bytes per cell, half the octreeCells length.
distanceFieldRaw L8 3D distance-field data matching those dimensions; not the PNG bytes in _Data.
levelCountsCell count at each level of the same octree.
public void Allocate(Transform3D toCellXform, Aabb aabb, Vector3 octreeSize, ReadOnlySpan<byte> octreeCells, ReadOnlySpan<byte> dataCells, ReadOnlySpan<byte> distanceField, ReadOnlySpan<int> levelCounts);Low-level upload of a consistent set of already prepared voxel buffers. Does not voxelize a mesh or replace Bake. octreeCells/dataCells use 32/16 bytes per cell; distanceField takes raw L8 bytes. Use Duplicate(true) for ordinary copying.
Old GPU buffers are freed before some input checks: this operation is not atomic and does not guarantee previous state survives an error. Returns void; do not use with untrusted or arbitrarily constructed arrays. Supply consistent data and inspect errors. The span overload does not retain references to managed input memory after the call.
| Name | Type | Default |
|---|---|---|
toCellXform | Transform3D | — |
aabb | Aabb | — |
octreeSize | Vector3 | — |
octreeCells | ReadOnlySpan<byte> | — |
dataCells | ReadOnlySpan<byte> | — |
distanceField | ReadOnlySpan<byte> | — |
levelCounts | ReadOnlySpan<int> | — |
toCellXformLocal-volume-to-cell transform from the same dataset.
aabbLocal volume bounds from the same bake.
octreeSizeGrid dimensions along each axis; use positive integral dimensions from a valid bake.
octreeCellsInternal structure: length must be a multiple of 32 bytes. Length alone does not establish validity.
dataCellsData for the same cells: 16 bytes per cell, half the octreeCells length.
distanceFieldRaw L8 3D distance-field data matching those dimensions; not the PNG bytes in _Data.
levelCountsCell count at each level of the same octree.
GetBiasfloat
public float GetBias();Returns Bias. Initial cone-trace distance in voxel coordinates, distinct from NormalBias. Helps reduce self-occlusion, but excessive values can skip thin occluders. A new resource getter returns 1.5; this alone does not prove pixel equivalence of every renderer default. The inspector hint 0…8 does not clamp the setter.
floatCurrent Bias value.
GetBoundsAabb
public Aabb GetBounds();Returns local bounds stored by Bake or Allocate, not automatically transformed world-space Entity bounds.
AabbStored local Aabb.
GetDataCellsbyte[]
public byte[] GetDataCells();Returns byte[] internal cell data, 16 bytes per cell in a valid bake. This is not a Color array or an artist-editable texture. Editing the returned C# array does not change the resource.
byte[]Copy of internal cell data.
GetDynamicRangefloat
public float GetDynamicRange();Returns DynamicRange. VoxelGI buffer energy encoding range, default 2. Used to scale energy down and restore it during calculations; use a finite positive value. The inspector hint 1…8 does not clamp the setter. This is not camera exposure or a quality setting without precision tradeoffs.
floatCurrent DynamicRange value.
GetEnergyfloat
public float GetEnergy();Returns Energy. Indirect-light multiplier, default 1. Setting 0 removes the tested VoxelGI contribution without disabling direct light or emissive-material visibility. The inspector hint 0…64 does not clamp the setter: 65 is retained, for example. Use a finite nonnegative value.
floatCurrent Energy value.
GetLevelCountsint[]
public int[] GetLevelCounts();Returns int[] cell counts for each octree level. In the checked valid bake the sum equals GetOctreeCells().Length / 32. Editing the C# array does not change the resource.
int[]Copy of cell counts per level.
GetNormalBiasfloat
public float GetNormalBias();Returns NormalBias. Offsets the sampling position along its normal in voxel coordinates, default 0. Unlike Bias it moves the sample origin rather than only changing initial distance along the cone. Adjust gradually while checking light leaks. The inspector hint 0…8 does not clamp the setter.
floatCurrent NormalBias value.
GetOctreeCellsbyte[]
public byte[] GetOctreeCells();Returns a byte[] containing the internal octree structure. A valid bake uses 32 bytes per cell. The returned C# array is independent: editing it does not modify GPU data. Reading may require renderer data retrieval; avoid unnecessary per-frame calls.
byte[]Copy of internal octree cells.
GetOctreeSizeVector3
public Vector3 GetOctreeSize();Returns stored cell counts along three axes as Vector3. These are discrete grid dimensions, not meters or VoxelGI Size.
Vector3Grid dimensions per axis.
GetPropagationfloat
public float GetPropagation();Returns Propagation. Energy propagation coefficient used while building VoxelGI levels, default 0.5. The inspector hint 0…1 does not clamp the setter; stay within the normal range unless you have verified another regime. Higher values do not guarantee physically correct brightness; compare with Energy and UseTwoBounces.
floatCurrent Propagation value.
GetToCellXformTransform3D
public Transform3D GetToCellXform();Returns the stored transform from local volume coordinates to cell coordinates, not the VoxelGI GlobalTransform.
Transform3DStored transform to cell coordinates.
IsInteriorbool
public bool IsInterior();Returns Interior. When true excludes sky contribution from VoxelGI; defaults to false. Useful for closed rooms, but does not disable direct lights or repair geometry holes. Changing it does not rebuild static meshes.
boolCurrent Interior value.
IsUsingTwoBouncesbool
public bool IsUsingTwoBounces();Returns UseTwoBounces. Enables a second indirect-light bounce pass; defaults to true. May change brightness and light distribution. Does not promise free quality improvement: check the image and GPU time on the target scene. Does not rebake geometry.
boolCurrent UseTwoBounces value.
SetBiasvoid
public void SetBias(float bias);Sets Bias. Initial cone-trace distance in voxel coordinates, distinct from NormalBias. Helps reduce self-occlusion, but excessive values can skip thin occluders. A new resource getter returns 1.5; this alone does not prove pixel equivalence of every renderer default. The inspector hint 0…8 does not clamp the setter.
| Name | Type | Default |
|---|---|---|
bias | float | — |
biasNew Bias value; follow the property usage limits.
SetDynamicRangevoid
public void SetDynamicRange(float dynamicRange);Sets DynamicRange. VoxelGI buffer energy encoding range, default 2. Used to scale energy down and restore it during calculations; use a finite positive value. The inspector hint 1…8 does not clamp the setter. This is not camera exposure or a quality setting without precision tradeoffs.
| Name | Type | Default |
|---|---|---|
dynamicRange | float | — |
dynamicRangeNew DynamicRange value; follow the property usage limits.
SetEnergyvoid
public void SetEnergy(float energy);Sets Energy. Indirect-light multiplier, default 1. Setting 0 removes the tested VoxelGI contribution without disabling direct light or emissive-material visibility. The inspector hint 0…64 does not clamp the setter: 65 is retained, for example. Use a finite nonnegative value.
| Name | Type | Default |
|---|---|---|
energy | float | — |
energyNew Energy value; follow the property usage limits.
SetInteriorvoid
public void SetInterior(bool interior);Sets Interior. When true excludes sky contribution from VoxelGI; defaults to false. Useful for closed rooms, but does not disable direct lights or repair geometry holes. Changing it does not rebuild static meshes.
| Name | Type | Default |
|---|---|---|
interior | bool | — |
interiorNew Interior value; follow the property usage limits.
SetNormalBiasvoid
public void SetNormalBias(float bias);Sets NormalBias. Offsets the sampling position along its normal in voxel coordinates, default 0. Unlike Bias it moves the sample origin rather than only changing initial distance along the cone. Adjust gradually while checking light leaks. The inspector hint 0…8 does not clamp the setter.
| Name | Type | Default |
|---|---|---|
bias | float | — |
biasNew NormalBias value; follow the property usage limits.
SetPropagationvoid
public void SetPropagation(float propagation);Sets Propagation. Energy propagation coefficient used while building VoxelGI levels, default 0.5. The inspector hint 0…1 does not clamp the setter; stay within the normal range unless you have verified another regime. Higher values do not guarantee physically correct brightness; compare with Energy and UseTwoBounces.
| Name | Type | Default |
|---|---|---|
propagation | float | — |
propagationNew Propagation value; follow the property usage limits.
SetUseTwoBouncesvoid
public void SetUseTwoBounces(bool enable);Sets UseTwoBounces. Enables a second indirect-light bounce pass; defaults to true. May change brightness and light distribution. Does not promise free quality improvement: check the image and GPU time on the target scene. Does not rebake geometry.
| Name | Type | Default |
|---|---|---|
enable | bool | — |
enableNew UseTwoBounces value; follow the property usage limits.