|
| VctVoxelizer (IdType id, RenderSystem *renderSystem, HlmsManager *hlmsManager, bool correctAreaLightShadows) |
|
| ~VctVoxelizer () |
|
void | addItem (Item *item, bool bCompressed, uint32 indexCountSplit=0u) |
|
void | autoCalculateRegion (void) |
| Does nothing if VctVoxelizer::setRegionToVoxelize( false, ... ) was called. More...
|
|
void | build (SceneManager *sceneManager) |
|
void | dividideOctants (uint32 numOctantsX, uint32 numOctantsY, uint32 numOctantsZ) |
|
TextureGpu * | getAlbedoVox (void) |
|
VctVoxelizer::DebugVisualizationMode | getDebugVisualizationMode (void) const |
|
TextureGpu * | getEmissiveVox (void) |
|
HlmsManager * | getHlmsManager (void) |
|
IdType | getId () const |
| Get the unique id of this object. More...
|
|
TextureGpu * | getNormalVox (void) |
|
RenderSystem * | getRenderSystem (void) |
|
TextureGpuManager * | getTextureGpuManager (void) |
|
Vector3 | getVoxelCellSize (void) const |
|
Vector3 | getVoxelOrigin (void) const |
|
Vector3 | getVoxelResolution (void) const |
|
Vector3 | getVoxelSize (void) const |
|
bool | operator() (const IdObject *left, const IdObject *right) |
|
bool | operator() (const IdObject &left, const IdObject &right) |
|
void | removeAllItems (void) |
| Removes all items added via VctVoxelizer::addItem. More...
|
|
void | removeItem (Item *item) |
| Removes an item added via VctVoxelizer::addItem. More...
|
|
void | setDebugVisualization (VctVoxelizer::DebugVisualizationMode mode, SceneManager *sceneManager) |
|
void | setRegionToVoxelize (bool autoRegion, const Aabb ®ionToVoxelize, const Aabb &maxRegion=Aabb::BOX_INFINITE) |
| Call this function before VctVoxelizer::autoCalculateRegion. More...
|
|
void | setResolution (uint32 width, uint32 height, uint32 depth) |
| Changes resolution. More...
|
|
The voxelizer consists in several stages.
The main ones that requre explanation are:
- Download the vertex buffers to CPU, then upload it again to GPU in an homogeneous format our compute shader understands. We do the same with the index buffer, except we perform GPU -> GPU copies. We can't use the buffers directly because in many APIs we can't bind the index buffer as an UAV easily. This step is handled by VctVoxelizer::buildMeshBuffers. Not implemented yet: when rebuilding the voxelized scene, this step can be skipped if no meshes were added since the last change (and the buffers weren't freed to save memory)
- Iterate through every Item and convert the datablocks to the simplified version our compute shader uses. VctMaterial handles this; done in VctVoxelizer::placeItemsInBuckets.
- During step 2, we also group the items into buckets. Each bucket can be batched together to dispatch a single compute shader execution; because they share all the same settings (and we haven't run out of material buffer space)
- The items grouped in buckets may be split into 8 instance buffers; in order to cull each octant of the voxel; thus avoiding having all voxels try to check for all instances (performance optimization).