[vtkusers] Slow rendering of derived class of vtkImplicitFunction

Christophe Franco cfranco at amsatec.fr
Thu Oct 9 03:17:36 EDT 2003


David.Pont at ForestResearch.co.nz wrote:

 > Hi,
 >    My guess is that vtkSampleFunction is the part that takes the most 
  time.
 > You use SetSampleDimensions to define the number of samples, for example
 > 50*50*50 = 125,000 samples. Your implicit function EvaluateFunction 
will be
 > called for each of these, and I see your EvaluateFunction uses exp and
 > sqrt.
 > This volume is then contoured to produce a surface, the contouring
 > algorithms are relatively efficient, but this might be the next slowest
 > part.
 > If you use smaller SampleDimensions you will note a dramatic 
(exponential)
 > increase in speed, but you will also notice a poor representation of the
 > surface. The problem with vtkSampleFunction is that in order to 
sample the
 > surface at high resolution you have to sample a lot of dead space 
away from
 > the surface.


A way to reduce slightly this slowliness without sacrifying quality of 
the representation can be reducing the sampling "box" to the minimum 
size. This way, with less samples, you can get the same result.

But I think a major problem with this vtkSampleFunction is that it can 
only sample on a 3D rectangular box, with faces aligned onto X, Y and Z 
axis. In many cases, it would be much more efficient to use a box more 
related to the function sampled, then to apply a rotation. Or is it 
already possible and I have missed something ?

Because I have quite the same problem, using vtkCone and vtkCylinder (to 
build 3D arrows), and even after calculating the minimum coordinates in 
X, Y and Z for a given cone or cylinder (which axis are not always 
aligned with X, Y nor Z), it still takes me at lease 10*10*10 samples to 
have a decent representation (and more than CPU time, it takes me huge 
amounts of memory, for a cone + a cylinder, about 2.5MB of RAM)





More information about the vtkusers mailing list