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

Nenad Vujicic nenadus at gmail.com
Wed May 4 11:20:48 EDT 2011


Dear Utkarsh,

Thank You very much on Your answer.

Yes, my plug-in is exporter, which means I define it in class derived
from vtkExporter. It extracts all possible scene information from
vtkExporter::RenderWindow object (in both Qt-client and python-client
modes) and writes these data to very special format using proprietary
software. Because output format is a bit specific, I have to convert
scalar values to texture first and then to export the texture, I
cannot output interpolated scalars or colors.

Like in my pseudo-code, I first take currently active renderer (from
vtkExporter::RenderWindow) and collect geometry / topology /
other_info from it using my pseudo-code. After this step, I write
collected data to my format using other software without problems.
However, I have problems with transforming scalars to texture. Btw,
I'm sure collected data is fine, because I can preview it using other
software.. Also, it works perfect under v3.8.*.

Do You have any idea?

Thanks,
Nenad.


On Wed, May 4, 2011 at 3:04 PM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> 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