[Paraview] Setting color / transparency for polydata

David E DeMarle dave.demarle at kitware.com
Mon Dec 6 15:18:43 EST 2010


In paraview the actor and mapper are combined into a representation. The
standard representations are Outline, Points, WireFrame, SurfaceWithEdges,
Glyph and Volume. You will have to pore over the wiki and plugins to find
examples of how to make a new representation.

You might be able to get it to work with less effort by filling out a 4 RGBA
color array, using A for opacity of course. ParaView is not particularly
good at directly rendering color values without mapping through a lookup
table however. You will have to turn off scalar mapping on the Display tab
and you will also likely need to enable VTK's DepthSortPolyData filter as
well.

good luck!

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109


On Wed, Nov 17, 2010 at 10:10 AM, Rafael Küng <rafi.kueng at gmx.ch> wrote:

> Hi there
>
> For my bachelor thesis, I'm doing a reader in c++ to read in large amount
> of points and display them (from a solar system simulation output in a
> sqlite db), but i fail at setting transparency for certain points. Can
> anybody please point me to a tutorial or give me a hint? I did look around
> and saw i probably need a mapper or actor, with a lookuptable, (at least in
> vtk only it works like this) but i didn't find an example how to convert
> this to paraview. (witch would be great, because i'm totally new to pv and
> vtk).
> How and where do i have to attach the mapper to?
> I did get the coloring working, but no clue how to continue from here.
>
> Many Thanks
>
> Rafael Kueng
> University of zurich
>
> Here's a draft of my code:
>
> int vtkSQLiteReader::RequestData(vtkInformation*,
>        vtkInformationVector**,vtkInformationVector* outputVector)
> {
>
>        vtkPolyData * out = vtkPolyData::GetData(outputVector);
>
>        if (!this->dataIsRead)
>                // only read if it's not been read before
>        {
>                readSnapshots(); //reads in the coordinates and velocities
> of particles
>                readTracks(); //reads in the tracks of the particles
>
>                this->dataIsRead = true;
>        }
>
>        out->SetPoints(this->Position);
>        out->SetVerts(this->Cells);
>        out->SetLines(this->Tracks);
>        out->GetPointData()->AddArray(this->Velocity);
>
>        // update the colors in every update
>        generateColors();
>        out->GetPointData()->SetScalars(this->colors);
>
>        return 1;
> }
>
>
> int vtkSQLiteReader::generateColors()
> {
>        this->colors = vtkSmartPointer<vtkUnsignedCharArray>::New();
>        this->colors->SetName("Colors");
>        this->colors->SetNumberOfComponents(3);
>        this->colors->SetNumberOfTuples(this->nParticles);
>
>        for (int i = 0; i<this->nParticles;i++)
>        {
>                // heres some code to choose the color per point..
>                red = 255;
>                green = 255;
>                blue = 255;
>
>                this->colors->InsertTuple3(i,
>                                red,
>                                green,
>                                blue);
>        }
>        return 1;
> }
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101206/1e228014/attachment-0001.htm>


More information about the ParaView mailing list