[vtkusers] Slow Performance with 2K actors (*.obj file)
Sonya Blade
sonyablade2010 at hotmail.com
Mon Jun 16 08:01:52 EDT 2014
I can not guarantee that all the actors will have the same geometry, the loaded shape was just for the testing purposes, in any case it'll completely depend on end-user input. AFAIK there are even better techniques if geometry is identical such as impostor, proxy object in OpenGL.
I'm trying to follow the instructions given here http://www.cmake.org/Wiki/index.php?title=VTK/FAQ&redirect=no#VTK_is_slow.2C_what_is_wrong.3F (FAQ/How to handle large data sets in VTK, )
It mentions that "By default VTK keeps a copy of all intermediate results between filters in a pipeline" which is quite unnecessary for my case. In order to switch it off I should have vtkPolyDataReader so later on I can apply the following statement in order to test the performance.
// C++ vtkPolyDataReader *reader = vtkPolyDataReader::New(); reader->GetOutput()->ReleaseDataFlagOn();
The glitch here is: I do have ObjReader instead of vtkPolyReader, vtkPOlyReader doesn't load the *.obj file,in order to eliminate that do I have to load the obj file with ObjReader and copy it to the PolyReader ? If so how can I do it?
Regards,
From: VTK at calculoandamios.com
To: sonyablade2010 at hotmail.com; dlrdave at aol.com; vtkusers at vtk.org
Subject: RE: [vtkusers] Slow Performance with 2K actors (*.obj file)
Date: Mon, 16 Jun 2014 13:25:02 +0200
If all the actors have the same geometry, then you can use Shallowcopies (actor.ShallowCopy ) in a way similar to: // Visualize vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputConnection(reader->GetOutputPort()); vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper(mapper); renderer->AddActor(actor); for (int i=0;i<2000;i++){ vtkSmartPointer<vtkActor> actor2 = vtkSmartPointer<vtkActor>::New(); actor2->ShallowCopy(actor); renderer->AddActor(actor2);} This will reduce both the time of loading as the polydata and the mapper are created only once and also it will improve the interaction experience.There are only some parameters that can be change, like position or orientation but not the geometry in the new actors. Regards, Carlos De: vtkusers [mailto:vtkusers-bounces at vtk.org] En nombre de Sonya Blade
Enviado el: lunes, 16 de junio de 2014 8:09
Para: David Cole; vtkusers at vtk.org
Asunto: Re: [vtkusers] Slow Performance with 2K actors (*.obj file) Ok thanks David for entry point, Probably construing the scene from many actors was not a good idea if you look at it from VTK side,but due to the design architecture I should have each object as a seperate entity which might have the the supplied *.obj shape or any other arbitrary shape provided by end-user and those shapes should be interactable, modifiable, etc If it wasn't AddActor() proc then what other methods I can use for that ? Regards,
> To: sonyablade2010 at hotmail.com; vtkusers at vtk.org
> Subject: Re: [vtkusers] Slow Performance with 2K actors (*.obj file)
> From: dlrdave at aol.com
> Date: Sun, 15 Jun 2014 08:01:59 -0400
>
> You should probably only have 10s or 100s of actors in any given
> renderer. 1000s or more *actor* objects are known to be slow.
>
> Unless somebody else chimes in and contradicts me, with a speed up
> hint, it's probably best to restructure your code to use fewer actors.
>
>
> HTH,
> David C.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140616/b1735c78/attachment.html>
More information about the vtkusers
mailing list