-
-
Notifications
You must be signed in to change notification settings - Fork 1
Module: SVO Voxelizer
- Multi-threaded.
- Asynchronous GPU operations.
- Progressive tree construction with priority-based triage.
- Progressive mip filtering, organised into waves for efficiency.
- Performant: Less than 4% GPU utilization on an RTX2080S.
- Auto-CPU usage scaling. Won't get in the way of your game logic.
- Easy to integrate, instantiable object.
// Instantiate SVO Tree
SVO = ScriptableObject.CreateInstance<NKLI.Nigiri.SVO.Tree>();
SVO.Create(attached_camera, max_depth, max_nodes);// Instantiate voxelizer
voxelizer = new NKLI.Nigiri.SVO.Voxelizer(SVO, emmissive_intensity, shadow_strength, occlusion_gain, gi_area_world_size);
// Dispose voxelizer
voxelizer.Dispose();// Destroy SVO
NKLI.Nigiri.Helpers.DestroyScriptableObject(ref SVO);
// Update voxelization parameters
voxelizer.UpdateParameters(emmissive_intensity, shadow_strength, occlusion_gain);// Voxelize scene
voxelizer.VoxelizeScene(_sample_count, position_texture, lighting_texture, mask_buffer);// Split nodes
voxelizer.SplitNodes();// Mipmap nodes
voxelizer.MipmapNodes();
attached_camera - Main camera
max_depth - Default max depth of the tree
max_nodes - Maximum nodes to store [Calculate VRAM as: (max_nodes * 16Bytes)]
emmissive_intensity - Emissive lighting intensity
shadow_strength - Strength of shadows
occlusion_gain - Ambiant occlusion gain
gi_area_world_size - World space axis length of GI area
NKLI.Nigiri.SVO.Tree.MaxDepth - Default, max tree depth
NKLI.Nigiri.SVO.Tree.RAM_Usage - Estimation of allocated RAM
NKLI.Nigiri.SVO.Tree.VRAM_Usage - Estimation of allocated VRAM
NKLI.Nigiri.SVO.Tree.Runtime_Thread_Split - Execution time of node split worker thread
NKLI.Nigiri.SVO.Tree.Runtime_Thread_Mipmap - Execution time of node mipmap worker thread
NKLI.Nigiri.SVO.Tree.Buffer_SVO_ByteLength - Byte length of SVO buffer
NKLI.Nigiri.SVO.Tree.SplitQueueMaxLength - Current size of split queue buffer
NKLI.Nigiri.SVO.Tree.MipmapQueueMaxLength - Current size of the mipmap queue buffer
NKLI.Nigiri.SVO.Tree.SplitQueueSparseCount - Number of node splits waiting to be processed
NKLI.Nigiri.SVO.Tree.MipmapQueueSparseCount - Number of mipmaps waiting to be processed
NKLI.Nigiri.SVO.Tree.AbleToSplit - Are there nodes waiting to be processed?
NKLI.Nigiri.SVO.Tree.AbleToMipmap - Are there mipmaps waiting to be processed?
NKLI.Nigiri.SVO.Voxelizer.SVO_Tree - Bound SVO Tree
NKLI.Nigiri.SVO.Voxelizer.Emissive_Intensity - Emissive lighting intensity
NKLI.Nigiri.SVO.Voxelizer.Shadow_Strength - Strength of shadows
NKLI.Nigiri.SVO.Voxelizer.Occlusion_Gain - Ambiant occlusion gain
NKLI.Nigiri.SVO.Voxelizer.GI_Area_Size - World space axis length of GI area
NKLI.Nigiri.SVO.Voxelizer.Debug_Filtering - Enable debug visualisation of mipmap filtering
NKLI.Nigiri.SVO.Voxelizer.UpdateParameters(emissiveIntensity, shadowStrength, occlusionGain)
- Updates voxelisation parameters
NKLI.Nigiri.SVO.Voxelizer.VoxelizeScene(sampleCount, positionTexture, lightingTexture, maskBuffer)
- Voxelise scene using the input render textures and mask buffer
NKLI.Nigiri.SVO.Voxelizer.SplitNodes()
- Processes the node split queue
NKLI.Nigiri.SVO.Voxelizer.MipmapNodes()
- Processes the node mipmap queue
NKLI.Nigiri.SVO.Tree.SetSplitQueue(_splitQueue)
- Submit custom split queue
_splitQueue - Byte array of uint32 offset values. Position zero denotes number of items
(Size of array must equal NKLI.Nigiri.SVO.Tree.SplitQueueMaxLength)
NKLI.Nigiri.SVO.Tree.SetMipMapQueue(_mipmapQueue)
- Submit custom mipmap queue
_mipmapQueue - Byte array of uint32 offset values. Position zero denotes number of items
(Size of array must equal NKLI.Nigiri.SVO.Tree.MipmapQueueMaxLength)
NKLI.Nigiri.SVO.Tree.ResumeMipmapWorker()
- Mipmap worker thread automatically suspends when it's finished processing a queue to
allow for it's output to be processed by the GPU. Calling this function will signal
the thread to look for a new queue to repeat the cycle.
(This is normally handled automatically if using the attached voxelization function)
NKLI.Nigiri.SVO.Tree.SuspendWorkers()
- Suspend all worker threads
This is useful if you want to freeze the SVO for a period to save GPU time
NOTE: Calling NKLI.Nigiri.SVO.Voxelizer.VoxelizeScene() will unfreeze workers automatically.
NKLI.Nigiri.SVO.Tree.ResumeWorkers()
- Resume all worker threads
This is useful if you want to freeze the SVO for a period to save GPU time
NOTE: Calling NKLI.Nigiri.SVO.Voxelizer.VoxelizeScene() will unfreeze workers automatically.
- SVO Traversal Node - Stores the Sparse Octree traversal data.
Scripts/NKLI.Nigiri.SVO.Tree.cs
Scripts/NKLI.Nigiri.SVO.Helpers.cs
Scripts/NKLI.Nigiri.SVO.SVONode.cs
Scripts/NKLI.Nigiri.SVO.TraversalNode.cs
Scripts/NKLI.Nigiri.SVO.Voxelizer.cs
Scripts/NKLI.Nigiri.SVO.TestUnitHooks.cs
Scripts/NKLI.Nigiri.Helpers.cs
Scripts/NKLI.Nigiri.Tools.MainThreadDispatcher.cs
Resources/NKLI_Nigiri_SVOVoxelizer.compute
Resources/NKLI_Nigiri_SVOVoxelizer_Functions.cginc
Resources/NKLI_Nigiri_SVOSplitter.compute
Resources/NKLI_Nigiri_SVOMipmapper.compute
Resources/NKLI_Nigiri_SVONode.cginc
Resources/NKLI_Nigiri_SVOTraversalNode.cginc
Resources/NKLI_Nigiri_MortonOrder2D.cginc