[vtkusers] 3D-2D graphics problems

Jorrit Schaap jorrit at lkeb.azl.nl
Wed Oct 11 03:25:21 EDT 2000

Hi Elizabeth,

>     1. I sometimes need to define 2D lines on the plane itself. Under
> vtk 2.4 I could create vtkActor2Ds and make polylines of any desired
> color that appeared to be drawn on that plane. Under 3.1 I can make
> polylines that appear in the correct locations, but the colors are
> always black unless I take away the plane. If the plane is not there,
> SetColor() works fine. If it is there, all I get is black polylines. If
> I query the actor about what it thinks its color should be it gives me
> the right answer--but it continues to draw itself black. Have tried
> changing the LayerNumber, which seems to make no difference to anything
> at all. Suggestion?

I have a vague feeling that I've seen something like this before. I think it is the combination
of textured polydata and actor2d's in the same renderer. Sometime I have the problem that the
textures from different planes suddenly appear on another plane. I have been trying to find the
bug myself, but I can't seem to make the error appear in a deterministic way.
I know, this totaly doesn't help you, but I hope somebody else has seen this before, and can
help use both.

>     2. The vtkVolumes have a nice feature of allowing one to set
> variable opacities according to the intensity values of the dataset by
> using a vtkPiecewiseFunction and calling SetScalarOpacity. I really like
> this, and would like to apply it to my textured plane. However, I can't
> find a way to get this to work.  How can I set variable opacity
> according to intensity value for a textured plane?

You can use a vtkLookupTable. It maps scalar values to RGBA values. (basicaly the
vtkColorTransferFunction is a vtkLookupTable. Look at the inheritance, especialy at
For the texture you can set its lookuptable.

>     3. Placing a textured plane on the origin and rotating/translating
> 3D objects "in front of" it means that I have to take over the mouse
> callbacks and apply SetUserMatrix to each of the perhaps hundreds of 3D
> objects involved. I can't move the camera because otherwise its
> relationship to the plane changes. It would be preferable to texture map
> a vtkActor2D that always remains "in back of" the 3D objects. However, I
> can't figure out how to texture map a vtkActor2D. Suggestion?

Well, basicaly you can't texturemap a vtkActor2D. Why don't you use a normal vtkActor? You can
make a plane using a vtkPlaneSource, a vtkPolyDataMapper, a vtkActor, and then setting the
texture to the actor. As you know, you can position the vtkActor anywhere.

Good luck, Jorrit.

> Many thanks
> Liz
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers

More information about the vtkusers mailing list