[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
Tue Oct 14 19:04:16 EDT 2003


Hi there,
   OK I have located and dusted off the code I had. I have played around
with it and got a version that just barely works. It can and will crash
and/or do weird things, consider yourself a beta-tester!
I will send you 3 files (off list): vtkImplicitPolygonizer.cpp and .h and a
mainline that gives an example (copied from iceCream.tcl). See the example
for how to set useful parameters.
The class needs input from a vtkImplicitFunction, I presume you have
already wrapped your implicit function up as one of these because you were
using it with vtkSampleFunction.
The algorithm is efficient, the iceCream example is rendered in 1-2s,
probably an order of magnitude faster than using vtkSampleFunction,
vtkContourFilter.
The vtkImplicitPolygonizer class is still quite unstable! I will work on
improving it as I find spare time. If you can pinpoint cases causing
specific problems that will help me improve the implementation.

  regards
       Dave P


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




Hi, thanks a lot for all the information. It really helped but I'm new
at all this and I don't really know how to implement all that's written
in the paper into my own sample function. Is your code written for vtk?
I would really appreciate any snippets of code because I'm really stuck
at this timing problem. Thanks

-----Original Message-----
From: David.Pont at ForestResearch.co.nz
[mailto:David.Pont at ForestResearch.co.nz]
Sent: Friday, October 10, 2003 5:33 AM
To: #LIM LAY NA#
Cc: vtkusers at vtk.org; vtkusers-admin at vtk.org
Subject: Re: [vtkusers] Re: Re: Slow rendering of derived class of
vtkImplicitFunction (David.Pont at ForestResearch.co.nz)


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.






_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers








More information about the vtkusers mailing list