[vtkusers] Path caching doesn't work with assemblies?

Eran Guendelman erang at stanford.edu
Fri Jun 22 22:37:48 EDT 2007


I was testing out rendering speeds in vtk, and have an example with say 
1000 actors (a 10x10x10 lattice of spheres; the actors all share the 
same mapper and underlying sphere source geometry).  I compared:

a) adding all 1000 actors to the renderer
b) grouping the 1000 actors into a single vtkAssembly, and adding the 
assembly to the renderer.

I measuring the time taken to render the scene as I tumbled the view 
(using the trackball camera interactor).  I found that option (b) was 
around 10x slower than (1), and was trying to investigate the cause of 
this.  (vtkPropAssembly was not much better)  I basically found that 
vtkAssembly::RenderOpaqueGeometry was recomputing the paths each time it 
was rendered.  vtkAssembly::UpdatePaths finds that this->GetMTime() is 
bigger than this->PathTime, and this causes the paths to be recomputed. 
  And this happens even with no changes to the underlying geometry or 
anything between frames, just simply tumbling the view.

I found that the reason this->GetMTime() is bigger than this->PathTime 
is because whenever we do render the paths in RenderOpaqueGeometry(), 
the calls to prop3D->PokeMatrix(NULL) causes Modified() to be called on 
that prop.

So basically we have the ridiculous situation that:

- paths are computed if the assembly or its children have been modified 
recently
- rendering causes the assembly's children to be marked as modified
- therefore paths are computed each time!

Am I missing something here or is this defeating the purpose of avoiding 
recomputing the paths unnecessarily using the MTime comparisons?

Thanks.



More information about the vtkusers mailing list