[Paraview] Problems with 'interpolate scalars before mapping' in v3.10

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed May 4 09:04:42 EDT 2011


Nenad,

I am not sure I understand where this code is being put. You say it's
an exporter? Meaning it exports to something like a vrml/x3d file? But
that doesn't seem right since you say you are using the
PolyDataMapper.

What is this plugin trying to achieve?

Utkarsh

On Wed, May 4, 2011 at 8:31 AM, Nenad Vujicic <nenadus at gmail.com> wrote:
> Hello everyone,
>
> I'm having some problems with porting my ParaView exporter plug-in to
> v3.10, because ParaView started using vtkCompositeDataSet internally
> instead of keeping components merged. The problem is in performing
> transformation of scalars to texture using vtkScalarsToColorsPainter
> class. Here is approximately my code (questions come after
> pseudo-code):
>
> for every actor in currently active renderer:
>  for every component of composite data object (I retrieve
> vtkDataObject* with vtkCompositeDataIterator::GetCurrentDataObject()
> call)
>
>    // prepare new actor which defines component
>    dynamic cast vtkDataObject* data_object to vtkPolyData* poly_data;
>    create new vtkPolyDataMapper* pdm;
>    pdm->ShallowCopy(composite_mapper);
>    pdm->SetInput(poly_data);
>    allocate new actor and do actor->ShallowCopy(ptrActor) //
> ptrActor) is selected actor from currently active renderer - line 1
>    actor->SetMapper(pdm);
>
>    // perform converting from scalars to texture
>    ConvertScalarsToColors(actor);
>
> Routine ConvertScalarsToColors(vtkActor*) is defined in following way:
>
> L1 get actor's poly_data and mapper references,
> L2 create s2c - instance of MyVtkScalarsToColorsPainter (derived from
> vtkScalarsToColorsPainter for allowing setting its protected
> attributes),
> L3 initialize s2c parameters from mapper and poly_data
> L4 if s2c->CanUseTextureMapForColoring(poly_data) returns true,
> s2c->PrepareForRendering(), get texture and texture coordinates and
> sets them to passed actor
>
> Q1: First problem is in L3 when setting s2c parameters. Original
> mapper has turned on InterpolateScalarsBeforeMapping flag, but new one
> doesn't have it. How to safely copy properties of
> vtkCompositePolyDataMapper2 to vtkPolyDataMapper or I shouldn't do it?
>
> Q2: Even if I override above problem by turning on manually
> InterpolateScalarsBeforeMapping, I get very bad texture on output. It
> looks like scalars were not interpolated before mapping, sometimes
> even more distorted..
>
> The same code works with v3.8 perfectly. I also tried to apply
> vtkCompositeDataGeometryFilter to composite data object and to apply
> ConvertScalarsToColors() to result (even without creating new actor),
> but without success. Strange thing is that when I try this with
> manually created VTK scene (out of ParaView) it works perfectly and
> texture looks great!
>
> I would appreciate any help!
>
> Best regards,
> Nenad.
> _______________________________________________
> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list