Add basic support for voxel rendering and styling#1685
Conversation
Update main See merge request cesium-gs/cesium-unreal!1
This comment was marked as outdated.
This comment was marked as outdated.
|
Finally getting around to @kring's comments...
This should be possible if you check Two Sided on the resulting material! Here's a closeup from being inside the cube but still seeing the voxels: This also allows you to fly into the voxel volume, but you just end up seeing a solid color of whatever voxel you're in. Maybe that's expected for this particular dataset??
I was still seeing this even after I switched to the Unlit lighting mode. It appears to be the result of the atmosphere's interaction with translucent materials. Here's the difference after I toggle
The sharp line across the back is the result of material being two-sided, but the light is still there when it's toggled off:
So I'm not sure how to get rid of this interaction. Maybe this is an artifact of using a cube mesh for rendering, rather than doing a separate post process / draw pass. I would be willing to explore the latter, but that will probably be another week or so of effort. Is it bad enough to hold up this PR? |
| TUniquePtr<FStaticMeshRenderData> RenderData = | ||
| MakeUnique<FStaticMeshRenderData>(); | ||
| RenderData->AllocateLODResources(1); | ||
| TUniquePtr<FStaticMeshRenderData> pRenderData = |
There was a problem hiding this comment.
This restores the loadPrimitive code so it only deals with typical 3D mesh data; the splats route has been moved to loadGaussianSplats
| pCesiumPrimitive = pGaussianSplat; | ||
| createMesh = false; | ||
| } else if (meshPrimitive.mode == CesiumGltf::MeshPrimitive::Mode::POINTS) { | ||
| if (meshPrimitive.mode == CesiumGltf::MeshPrimitive::Mode::POINTS) { |
There was a problem hiding this comment.
Same story here; splats / voxels have their own load___GameThread function
| void UCesiumVoxelRendererComponent::UpdateTiles( | ||
| const std::vector<Cesium3DTilesSelection::Tile::ConstPointer>& VisibleTiles, | ||
| const std::vector<double>& VisibleTileScreenSpaceErrors) { |
There was a problem hiding this comment.
Context: This approach tries to match CesiumJS, which uses a custom traversal algorithm. Their algorithm uses a priority queue based on screen space error to retain parent detail more aggressively (avoiding LOD skips and holes).
I'm happy to take other suggestions or experiment with this, esp. because I feel like it's somewhat wasteful to do sort based on SSE every frame when Native is already handling tiles to us. At the same time, there needs to be a heuristic to determine when it's acceptable to kick a tile from its megatexture slot, since that visibility info is not sync'd 1-to-1 with Native's.
|
Happy to mark this as ready for another review! I left a few comments that explain some of the decisions made, but please let me know if there's anything else I can clear up. I'm also happy to do a "pair programming" session to walk through some of the larger chunks of code. @azrogers, would love to have your eyes on this, especially since you've dabbled in non-traditional rendering techniques (i.e. splats) and I figure you'll bring a fresh perspective |





Description
Depends on CesiumGS/cesium-native#1188.
Depends on #1694, so merge that first.Depends on #1778, so merge that first.This PR adds support for loading and rendering tilesets with
3DTILES_content_voxels, parsing glTFs withEXT_primitive_voxelspayloads.Data courtesy of Swisstopo
This is a meaty set of changes, so I'll add a written walkthrough of the changes in a follow-up comment.
Author checklist
CHANGES.mdwith a short summary of my change (for user-facing changes).- [ ] I have added or updated unit tests to ensure consistent code coverage as necessary.Remaining Tasks
VoxelResources. It's a weird compromise between CesiumJS'sVoxelTraversaland the cesium-native traversal, and it falls apart for larger datasets.Testing plan
Reach out to me offline for the pictured test data.
Cesium3DTileset).UCesiumVoxelMetadataComponentto gather its properties.Compatibility checks: