Hello everyone! I want to render (2D and 3D) many shapes, mostly polyhedrons and partially voxels. I group them into groups (do not worry how we decide on the grouping but it can be in the order of thousands) and we need to be able to change each group’s color and opacity.
Our current flow (described into detail later) does not scale as expected e.g., a testcase with 150,000 voxels and 850,000 polyhedrons grouped in 15,385 groups renders with 0.4fps on 2D and with 0.3fps on 3D which makes the application unusable, so I am wondering how to improve it.
Current flow:
- Parse data (don’t worry about that)
- Create a list of
vtkAppendFilter
(withMergePointsOn()
), a filter for each group of shapes - Create a
vtkUnstructuredGrid
for each group of shapes like this:
-If the shape is a cuboid, insert in grid asvtkVoxel
-If the shape is polyhedron, insert in grid asvtkPolyhedron
- For each
vtkAppendFilter
create avtkActor
like this:
1.CreatevtkDataSetMapper
and set input data:vtkAppendFilter->GetOutput()
2.CreatevtkActor
and set the mapper - Colors and opacities are changed interactively for every
vtkActor
Some important notes:
- We have limited hardware resources: no GPU
- Shapes can be abutting or overlapping but usually only within the same group
- We want the edges of the shapes to be visible (currently we do it with
vtkActor::GetProperty().SetEdgeVisibilityOn()
) - Currently using
vtk-7.1.1
(withQt-5.15.8
) withOpenGL-2.1
I have been looking for a solution in many posts here and around the web with no luck so here are some questions:
- Do you see any flaws in our flow? Because to my knowledge, this is a standard flow
- Given the type of geometry/shapes are the selected VTK structures the most appropriate (
vtkAppendFilter
,vtkUnstructuredGrid
,vtkDataSetMapper
,vtkActor
)? - Last… is there a way to improve performance outside the code e.g. with some OpenGL settings? As mentioned earlier, GPU is not available and OpenGL cannot be upgraded.