[vtkusers] How to visualize thousands of actors with good performance

Pascal Augustin pascal at rogue-research.com
Thu Sep 30 15:35:49 EDT 2010


> 
> Good idea. Unfortunately I am not familiar with tcl as we use vtk in c++ only. If you could share the results with me/us, that would be great.
> 

Hi, 

 As you've previously  mentioned, rendering 10000s of actors was much faster in vtk 4.4. Using the following Python script, I've obtained these results:

VTK 4.4.2: Rotating 10000 spheres takes about 30 seconds.

VTK 5.0.4: Rotating 10000 spheres takes about 2 minutes. What is interesting is that for the first few seconds, it is actually faster than in 4.4.2. Then, it suddenly stalls for about 20 seconds. Afterwards, it continues rotating slowly but at a regular pace. 


#------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/env python
#

import vtk

ren = vtk.vtkRenderer()
append = vtk.vtkAppendPolyData()
for j in range(1, 100):
	for i in range(1, 100):
		sphere = vtk.vtkSphereSource()
		sphere.SetRadius(1.0)
		sphere.SetCenter(2 * i, 2 * j, 0)
		sphere.SetThetaResolution(16)
		sphere.SetPhiResolution(16)
		sphereMapper = vtk.vtkPolyDataMapper()
		sphereMapper.SetInput(sphere.GetOutput())
		sphereActor = vtk.vtkActor()
		sphereActor.SetMapper(sphereMapper)
		ren.AddActor(sphereActor)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(500, 500)

for i in range(0, 15):
	renWin.Render()
	ren.GetActiveCamera().Roll(24)




More information about the vtkusers mailing list