[vtkusers] VTKTetra opacity gradient [kind of emergency]

Cory Quammen cory.quammen at kitware.com
Thu Jun 16 18:58:16 EDT 2016


Hi Sean,

I think you are getting mixed up two definitions of the overloaded
term "gradient." It sounds like you want an opacity gradient. The
gradient referred to by volumeProperty.SetGradientOpacity refers to
setting opacity values according to the gradient of a scalar field in
the data set.

In fact, what you want to do is define a scalar opacity function that
is transparent at one end and opaque at the other, then assign data
values to the points of your tetrahedron so that one end's value(s)
map to the transparent opacities in the scalar opacity function while
the other end's value(s) map to the opaque end of the scalar opacity
function.

HTH,
Cory

On Fri, Jun 17, 2016 at 12:07 AM, Sean Con <fluidandsolidearth at gmx.de> wrote:
> Hi all
>
> Consider this :
>
> # tetraheder #1
>             unstructuredGrid = vtk.vtkUnstructuredGrid()
>             unstructuredGrid.SetPoints(pointsLocal) # pointsLocal already
> defined
>
>             tetra= vtk.vtkTetra()
>             tetra.GetPointIds().SetId(0,0)
>             tetra.GetPointIds().SetId(1,1)
>             tetra.GetPointIds().SetId(2,3)
>             tetra.GetPointIds().SetId(3,4)
>
>             cellArray = vtk.vtkCellArray()
>             cellArray.InsertNextCell(tetra)
>             unstructuredGrid.SetCells(vtk.VTK_TETRA, cellArray)
>
>             unstructuredGrids.append(unstructuredGrid)
>
>            mapper = vtk.vtkDataSetMapper()
>     mapper.SetInputData(unstructuredGrid)
>     actor = vtk.vtkActor()
>     actor.SetMapper(mapper)
>     actors.append(actor)
>
>
>
> So I have my tetrahedra
>
> Now, I want to color the tetrahedra using opacity gradient. The top vetrx
> will have the solid color, the bottom triangluar plane will have complete
> transparency. I know I can use volumeProperty.SetGradientOpacity - but that
> only works with volumeProperty, not with vtktetra / dataset mapper.
>
> Please help.
> Thank you
>
>
>
> Sayandeep Khan
>
> Student, M.Sc. Meteorologie
> Meteorologiesches Institut der
> Rheinische Friedrich-Wilhelms-Universität Bonn
>
> Wissenschaftlicher Beirat
> Forschungsgemeinschaft Alternative Raumfahrt
>
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list