[vtkusers] Opacity of vtkActor2D
Gerrick Bivins
gbivins at objectreservoir.com
Fri Jul 11 11:43:13 EDT 2008
Hello,
I don¹t know much about the imagemapper and the image pipeline but from a GL
perspective, it sounds like you have
a glTexEnv problem. Sounds like your image is being applied with DECAL mode
(I think this is GL¹s default mode).
This basically means that the rgb value in your image (texture in GL speak)
is being used for the output fragment color an ignoring the values
of rgba on your primative.
That said you¹ll need to change the mode to something like MODULATE so that
the fragment output will (basically) be the multiplication
of the underlying primative rgba values and the rgba values of the image
(texture) at each fragment.
If you can get your video source to a vtkTexture like so:
...
texture = vtkTexture
texture.setInputConnection( video.GetOuputPort())
texture.setBlendingMode( VTK_TEXTURE_BLENDING_MODE_MODULATE )
..
Then change your actor to a vtkTexturedActor2D
actor = vtkTexturedActor2D
actor.setTexture( texture );
...
maybe that will do what you want.
Gerrick
On 7/11/08 10:07 AM, "dream_noir" <kyle.charbonneau at gmail.com> wrote:
> Just to clarify here is a small example program that shows what I am trying to
> do:
> from vtk import *
> import time
>
> video = vtkVideoSource()
> video.SetFrameRate(30)
> video.SetFrameSize(640, 400, 1)
> video.Record()
>
> mapper = vtkImageMapper()
> mapper.SetInputConnection(video.GetOutputPort())
> mapper.SetColorWindow(233)
> mapper.SetColorLevel(138.5)
>
> actor = vtkActor2D()
> actor.GetProperty().SetOpacity(0.3)
> actor.SetMapper(mapper)
>
> cone = vtkConeSource()
> cone.SetHeight( 3.0 )
> cone.SetRadius( 1.0 )
> cone.SetResolution( 10 )
>
> coneMapper = vtkPolyDataMapper()
> coneMapper.SetInputConnection( cone.GetOutputPort() )
>
> coneActor = vtkActor()
> coneActor.SetMapper( coneMapper )
>
> ren = vtkRenderer()
> ren.AddActor2D(actor)
> ren.AddActor(coneActor)
>
> renWind = vtkRenderWindow()
> renWind.AddRenderer(ren)
>
> for i in range (0, 2000):
> time.sleep(0.03)
> renWind.Render()
> You can't see the cone behind the video source despite setting the opacity.
> Any ideas?
>> dream_noir wrote:
>> I have a vtkActor2D object .that I'm putting a video source in to display in
>> my app. I add this actor to a renderer with the AddActor2D method. Now I want
>> this Actor2D to be transparent so I can see the scene behind it.
>> Unfortunately, using the GetProperty()/SetProperty() methods to get or set
>> the Property2D object and change the opacity there does nothing. The video is
>> still opaque and completely blocks the scene behind it. What can I do? Is
>> this a bug or am I going about it wrong?
>
>
> View this message in context: Re: Opacity of vtkActor2D
> <http://www.nabble.com/Opacity-of-vtkActor2D-tp18385577p18405991.html>
> Sent from the VTK - Users mailing list archive
> <http://www.nabble.com/VTK---Users-f14274.html> at Nabble.com.
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080711/ddb0bd37/attachment.htm>
More information about the vtkusers
mailing list