[vtkusers] VTKTetra opacity gradient [kind of emergency]

Cory Quammen cory.quammen at kitware.com
Fri Jun 17 06:14:08 EDT 2016


Sayandeep,

This example will show you how to set up a transfer function with opacity:

http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Rendering/Core/Testing/Python/TestOpacityVectors.py

and this example will show you how to assign point scalars to a cube,
but you can modify it to a tetrahedron:

http://www.vtk.org/Wiki/VTK/Examples/Python/DataManipulation/Cube.py

Hope that gets you going,
Cory

On Fri, Jun 17, 2016 at 11:56 AM, Sean Con <fluidandsolidearth at gmx.de> wrote:
> Hi
> Thank you for the reply.
>
> How do I proceed with a scalergradient and a Tetra?
> Thank you
>
> Sayandeep Khan
>
> Student, M.Sc. Meteorologie
> Meteorologiesches Institut der
> Rheinische Friedrich-Wilhelms-Universität Bonn
>
> Wissenschaftlicher Beirat
> Forschungsgemeinschaft Alternative Raumfahrt
>
>
> Gesendet: Freitag, 17. Juni 2016 um 00:58 Uhr
> Von: "Cory Quammen" <cory.quammen at kitware.com>
> An: "Sean Con" <fluidandsolidearth at gmx.de>
> Cc: "vtkusers at vtk.org" <vtkusers at vtk.org>
> Betreff: Re: [vtkusers] VTKTetra opacity gradient [kind of emergency]
> 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.



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


More information about the vtkusers mailing list