[vtkusers] Help with VtkDatasetsurface filter

Bhanu Hariharan bhanu at petrotel.com
Tue Apr 2 18:14:39 EDT 2013


Alex,
I will try your suggestions - using VTKActor to see difference and
different frame rates.

I have one more question that's not related to rendering performance. It
concerns opacity.

I was alteast expecting to see different images when I specify opacity < 1
for the grid.

Shouldn't a transparent image look different when I render all cells (all
layers) than when I render just surface cells?


Thanks again,
Bhanu



On Tue, Apr 2, 2013 at 4:49 PM, Alex Malyushytskyy <alexmalvtk at gmail.com>wrote:

> LOD (level of details)  technique consists of run time assessment of
> performance and building a special model which will be used in certain
> circumstances and on the one hand would look as close as possible to
> the original, but on another hand allows achieve desired or better
> performance.
> That what LOD actor does, crude models will be silently created and
> displayed during rotation or when actor is moved.
>
> Now assume there are 2 model - lets say 1st is your unstructured grid,
> another is result of dataSetSurfaceFilter.
> Since both are using LOD actors, the following might happen:
>
> 1st model is found to be too big to be displayed and as a result crude
> model with N1 number of nodes is created and displayed
> 2nd model is found to be too big to be displayed and as a result crude
> model with N2 number of nodes is created and displayed
> or it is small enough , so it is displayed as is (but lets say still
> have N2 nodes)
>
> Now N1 might be mostly the same as N2.
> And you see no difference in performance during transition or rotation.
> Basically this means that LOD actor does his job well enough.
> I bet if you were using regular actors you would see a huge
> performance increase.
>
> If you need further performance you may just specify different frame rate.
> From http://www.vtk.org/doc/release/4.0/html/classvtkLODActor.html:
>
> "To control the frame rate, you typically set the
> vtkRenderWindowInteractor DesiredUpdateRate and StillUpdateRate. This
> then will cause vtkLODActor to adjust its LOD to fulfill the requested
> update rate.
> For greater control on levels of detail, see also vtkLODProp3D. That
> class allows arbitrary definition of each LOD.
> "
>
> Hope this helps,
>
> Alex
>
>
>
>
> On Tue, Apr 2, 2013 at 2:18 PM, Bhanu Hariharan <bhanu at petrotel.com>
> wrote:
> > Alex,
> >
> > To be specific in one of my cases,  No. of surfaces rendered were reduced
> > from 6163542 to 373626 assuming grid has hexahedrons each with 6
> surfaces. I
> > got the number 373626 by doing
> >
> > dataSetSurfaceFilter->GetOutput()->GetNumberOfCells()
> >
> > Thats a significant reduction of number of surfaces. These are rendered
> > using VTKLODActor.
> >
> > Can you please explain what you mean by "actually shown primitives during
> > rotation". What are the shown primitives?
> >
> > I am just adding the output of the dataSetSurfaceFilter to a
> > vtkDataSetMapper and then to a vtkLODActor.
> >
> > All I know if no. of surfaces are reduced. Do I need to do/check
> something
> > else?
> >
> > If you need something specific to answer more specifically, I can provide
> > the details. It would be a great help.
> >
> > Thanks,
> > Bhanu
> >
> >
> > ---------- Forwarded message ----------
> > From: Alex Malyushytskyy <alexmalvtk at gmail.com>
> > Date: Tue, Apr 2, 2013 at 4:03 PM
> > Subject: Re: [vtkusers] Help with VtkDatasetsurface filter
> > To: "vtkusers at vtk.org" <vtkusers at vtk.org>
> >
> >
> > You may get only general advice asking general questions.
> > Compare  the number of nodes/cells you are you are getting from
> > vtkDataSetSurfaceFilter with
> > such in the unstructured grid,
> > Even though it may be significantly decreased in some cases, for
> > example if LOD actors are used,  they may decrease actually shown
> > primitives during rotation approximately to the same number and you
> > will not see any difference in the performance.
> >
> > Regards,
> >     Alex
> >
> >
> > On Tue, Apr 2, 2013 at 8:27 AM, Bhanu Hariharan <bhanu at petrotel.com>
> wrote:
> >> Hi All,
> >> I was wondering if anyone would be kind enough to answer the following
> >> query
> >> for me.
> >>
> >> I had posted this a while back and still havent found the reason why
> >> vtkDataSetSurfaceFilter hasn't made rendering any faster. The
> interaction
> >> and rendering time to rotate zoom etc seem to be just the same as
> though I
> >> rendered all cells in the unstructured grid.
> >> The reason I chose to introduce rendering just surface cells in the
> first
> >> place was to make rendering faster. But I am surprised it doesnt make
> any
> >> difference at all :(.
> >> Any words or ideas?
> >>
> >> Thanks so much
> >> Bhanu
> >>
> >>
> >>
> >> On Mon, Mar 11, 2013 at 4:30 PM, Bhanu Hariharan <bhanu at petrotel.com>
> >> wrote:
> >>>
> >>> One related question though. I started using Surface Filter really only
> >>> for performance reasons.
> >>>
> >>> I was thinking if I rendered just surface cells, the rendering and
> >>> rotation etc would be must faster.
> >>> However I do not find it any different than when I render all cells.
> What
> >>> am I missing?
> >>> Any reasons anyone can think of, please let me know.
> >>>
> >>>
> >>>
> >>> Thanks,
> >>> Bhanu
> >>>
> >>>
> >>>
> >>> On Mon, Mar 11, 2013 at 4:12 PM, Bhanu Hariharan <bhanu at petrotel.com>
> >>> wrote:
> >>>>
> >>>> David,
> >>>> As you suggested, I got it to work using SetGlobalIds and then
> >>>> retrieving
> >>>> that using GetGlobalIds. Many thanks for your patience and help.
> >>>>
> >>>>
> >>>> -Bhanu
> >>>>
> >>>>
> >>>> On Wed, Mar 6, 2013 at 11:41 AM, Bhanu Hariharan <bhanu at petrotel.com>
> >>>> wrote:
> >>>>>
> >>>>> David,
> >>>>>
> >>>>> I am using vtk 5.2 - is it possible that this function was not
> defined
> >>>>> in that version.
> >>>>>
> >>>>> I get the error that SetOriginalCellIdsName is not a member of
> >>>>> vtkDataSetSurfaceFilter   :(
> >>>>>
> >>>>> Bhanu
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Wed, Mar 6, 2013 at 10:36 AM, David E DeMarle
> >>>>> <dave.demarle at kitware.com> wrote:
> >>>>>>
> >>>>>> Give DSF a name for the array.
> >>>>>> SetOriginalCellIdsName("idsintoDSForsomething")
> >>>>>> Then retrieve it from the output like
> >>>>>> DSF->GetOutput()->GetCellData()->GetArray("idsintoDSForsomething")
> >>>>>>
> >>>>>>
> >>>>>> David E DeMarle
> >>>>>> Kitware, Inc.
> >>>>>> R&D Engineer
> >>>>>> 21 Corporate Drive
> >>>>>> Clifton Park, NY 12065-8662
> >>>>>> Phone: 518-881-4909
> >>>>>>
> >>>>>>
> >>>>>> On Wed, Mar 6, 2013 at 11:29 AM, Bhanu Hariharan <
> bhanu at petrotel.com>
> >>>>>> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>> David,
> >>>>>>>
> >>>>>>> I had turned on PassThroughCell. But I do not know how to access
> the
> >>>>>>> new Ids array after the fact.
> >>>>>>> VTK Doc says something about a 'OrginalCellIds' but I am not sure
> how
> >>>>>>> to access this.
> >>>>>>> So I extracted the output of DSF to a vtkPolyData but still cant
> >>>>>>> figure out how to get to that new Ids array.
> >>>>>>> Any help with that is really appreciated.
> >>>>>>>
> >>>>>>> I will try your other suggestion in the meantime.
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>> Bhanu
> >>>>>>>
> >>>>>>>
> >>>>>>> On Wed, Mar 6, 2013 at 9:25 AM, David E DeMarle
> >>>>>>> <dave.demarle at kitware.com> wrote:
> >>>>>>>>
> >>>>>>>> Sorry for the confusion, it has been a long time since I added
> that
> >>>>>>>> code the DataSetSurfaceFilter. Turning PassThroughCell/PointIds in
> >>>>>>>> fact
> >>>>>>>> generates a new Ids array, which you can retrieve after the fact
> to
> >>>>>>>> do the
> >>>>>>>> lookups into the data that is input to the DSF and extract
> >>>>>>>> particular
> >>>>>>>> cells/points by their offset (n'th cell in the cell array, n'th
> >>>>>>>> point in the
> >>>>>>>> point array)
> >>>>>>>>
> >>>>>>>> However I still recommend making your own ids array and using that
> >>>>>>>> instead of PassThrough. vtkIdFilter will generate them for you.
> The
> >>>>>>>> array
> >>>>>>>> marked as the active global ids array is treated specially by most
> >>>>>>>> filters
> >>>>>>>> in that they try to preserve it across operations (including
> >>>>>>>> threshold and
> >>>>>>>> DSF). We added this to VTK a few years ago specifically for this
> >>>>>>>> case of
> >>>>>>>> finding out where particular result values come from (and in
> >>>>>>>> particular for
> >>>>>>>> surface selection). So the Threshold and surface filter will push
> >>>>>>>> globalIDS
> >>>>>>>> forward just fine. Once you get a result, grab the active globaIDs
> >>>>>>>> array,
> >>>>>>>> look for the values in it, and look them up in the original data.
> >>>>>>>> The
> >>>>>>>> extract selections filter will do the job of looking them up in
> the
> >>>>>>>> original
> >>>>>>>> data and pulling them out as a new dataset.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> David E DeMarle
> >>>>>>>> Kitware, Inc.
> >>>>>>>> R&D Engineer
> >>>>>>>> 21 Corporate Drive
> >>>>>>>> Clifton Park, NY 12065-8662
> >>>>>>>> Phone: 518-881-4909
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Wed, Mar 6, 2013 at 10:02 AM, Bhanu Hariharan
> >>>>>>>> <bhanu at petrotel.com>
> >>>>>>>> wrote:
> >>>>>>>>>
> >>>>>>>>> David,
> >>>>>>>>> Thanks for replying. However I have a doubt.
> >>>>>>>>> Are you suggesting the VTKUnstructuredgrid should have an
> globalids
> >>>>>>>>> array? Is that what the member is called - globalIds? I actually
> >>>>>>>>> pass
> >>>>>>>>> VTKUnstructuredgrid  to a VTKThreshold filter and then pass that
> >>>>>>>>> filter to
> >>>>>>>>> VTKdatasetsurfacefilter.
> >>>>>>>>>
> >>>>>>>>> Perhaps you can post a couple lines of code. That would be very
> >>>>>>>>> helpful.
> >>>>>>>>> Thanks,
> >>>>>>>>> Bhanu
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> On Tue, Mar 5, 2013 at 6:55 PM, David E DeMarle
> >>>>>>>>> <dave.demarle at kitware.com> wrote:
> >>>>>>>>>>
> >>>>>>>>>> The input data should have a globalids array containing a unique
> >>>>>>>>>> value for each cell. If it does, extract will preserve it. After
> >>>>>>>>>> the
> >>>>>>>>>> extraction, use that array in the polydata to do the look up to
> >>>>>>>>>> the original
> >>>>>>>>>> cell in the unstructured grid.
> >>>>>>>>>>
> >>>>>>>>>> On Mar 5, 2013 6:00 PM, "Bhanu Hariharan" <bhanu at petrotel.com>
> >>>>>>>>>> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>> Hi All,
> >>>>>>>>>>>
> >>>>>>>>>>> I need some help doing the following. Please could one of you
> >>>>>>>>>>> guide me on how.
> >>>>>>>>>>>
> >>>>>>>>>>> I use a vtkDataSetSurfaceFilter on VTKUnstructuredGrid to
> render
> >>>>>>>>>>> skin of that grid. That works fine and I can see the number of
> >>>>>>>>>>> surfaces
> >>>>>>>>>>> shown by grabbing the
> >>>>>>>>>>> dataSetSurfaceFilter->GetOutput()->GetNumberOfCells().
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> I need a way to map the surface back to the original cell id.
> >>>>>>>>>>> That
> >>>>>>>>>>> is if I have 2 cells and I render just skin, number of surfaces
> >>>>>>>>>>> rendered are
> >>>>>>>>>>> 10. I need to be able to pick on any of these 10 surfaces and
> map
> >>>>>>>>>>> them back
> >>>>>>>>>>> to either of the the 2 grid cells.
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> http://www.vtk.org/doc says :
> >>>>>>>>>>>
> >>>>>>>>>>> If PassThroughCellIdsOn is 1, then the output polygonal dataset
> >>>>>>>>>>> will have a celldata array that holds the cell index of the
> >>>>>>>>>>> original 3D cell
> >>>>>>>>>>> that produced each output cell. This is useful for cell
> picking.
> >>>>>>>>>>> I turned the PassThroughCellIds On and I have UseStrips turned
> >>>>>>>>>>> off.
> >>>>>>>>>>>
> >>>>>>>>>>> Then I did
> >>>>>>>>>>> vtkPolyData *surfacePolyData =
> dataSetSurfaceFilter->GetOutput();
> >>>>>>>>>>>
> >>>>>>>>>>> But I do not see how I can access that celldata array that
> holds
> >>>>>>>>>>> the original 3D cells for the surfaces.
> >>>>>>>>>>>
> >>>>>>>>>>> Please can anyone advise on how.
> >>>>>>>>>>>
> >>>>>>>>>>> Thanks in advance.
> >>>>>>>>>>> Bhanu
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> _______________________________________________
> >>>>>>>>>>> Powered by www.kitware.com
> >>>>>>>>>>>
> >>>>>>>>>>> Visit other Kitware open-source projects at
> >>>>>>>>>>> http://www.kitware.com/opensource/opensource.html
> >>>>>>>>>>>
> >>>>>>>>>>> Please keep messages on-topic and check the VTK FAQ at:
> >>>>>>>>>>> http://www.vtk.org/Wiki/VTK_FAQ
> >>>>>>>>>>>
> >>>>>>>>>>> Follow this link to subscribe/unsubscribe:
> >>>>>>>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
> >>>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >> _______________________________________________
> >> Powered by www.kitware.com
> >>
> >> Visit other Kitware open-source projects at
> >> http://www.kitware.com/opensource/opensource.html
> >>
> >> Please keep messages on-topic and check the VTK FAQ at:
> >> http://www.vtk.org/Wiki/VTK_FAQ
> >>
> >> Follow this link to subscribe/unsubscribe:
> >> http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130402/c9763b5b/attachment.htm>


More information about the vtkusers mailing list