[vtkusers] Re: Re: Slow rendering of derived class of vtkImplicitFunction (David.Pont at ForestResearch.co.nz)

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Thu Oct 9 17:33:05 EDT 2003


Hi,
   Yes after a bit more thought I was not sure vtkLODActor could help, and
yes different contour filters will not make a big impact, the slow part is
vtkSampleFunction.
I will track down the code etc I have and forward it to you soon. I will
send you a PDF of a paper now (off the list).
  regards
     Dave Pont


|---------+---------------------------->
|         |           "#LIM LAY NA#"   |
|         |           <wolken at pmail.ntu|
|         |           .edu.sg>         |
|         |           Sent by:         |
|         |           vtkusers-admin at vt|
|         |           k.org            |
|         |                            |
|         |                            |
|         |           10/10/2003 07:42 |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                |
  |       To:       <vtkusers at vtk.org>                                                                                             |
  |       cc:                                                                                                                      |
  |       Subject:  [vtkusers] Re: Re: Slow rendering of derived class of vtkImplicitFunction (David.Pont at ForestResearch.co.nz)    |
  >--------------------------------------------------------------------------------------------------------------------------------|




Hi, thanks for the advice. I've tried vtkLODActor but it doesn't seem to
have much effect. The same goes for the specialised contour filters,
vtkMarchingContourFilter, vtkMarchingCubes, vtkKitwareContourFilter. I've
also tried
vtkTriangleFilter and vtkStripper. I need to keep the sampling at least
50*50*50 because at anything less than that, the
rendered shape is very distorted. Are you suggesting that I write my own
SampleFunction? I'm not very sure how to do that.
Can I view some sample code that you used for implicit polygonization?
Would really appreciate it. Thanks.

Hi,
   My guess is that vtkSampleFunction is the part that takes the most t=
ime. You use SetSampleDimensions to define the number of samples, for
exampl= e 50*50*50 =3D 125,000 samples. Your implicit function
EvaluateFunction w= ill 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 basic design philosophy in vtk is to favour generality in algorithms, for
good reason. Producing a volume (structured points) from an implicit
function is smart because there are many vtk classes that can be used on
this type of data. Check the literature and you will find examples of
'fast' algorithms for creating implicit surfaces (Google 'implicit
polygon'). I played around with implicit polygonization by Velho (source
code available off the internet) some years back, but never had a real need
for it. The vtk philosophy would encourage you to implement a faster but
more specialised algorithm... (and would encourage you to contribute it
back=

;-P). Take a look at the documentation for vtkContourFilter and note th= e
'See also' for an example of a generic algorithm and its more specialis= ed
friends. So how are your C++ skills? they look just fine from your example
code.=  You could implement a new vtk class to do fast polygonization of
implicit surfaces in a few days... and have interactive blobs.

The only other way around might be to use vtkLODActor and feed it one (= or
more) low resolution (low SampleDimensions) pipelines and one at the
desired resolution... ??

regards
   Dave P.








More information about the vtkusers mailing list