<HTML>
<HEAD>
<TITLE>Re: [vtkusers] Opacity of vtkActor2D</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
Hello,<BR>
I don&#8217;t know much about the imagemapper and the image pipeline but from a GL perspective, it sounds like you have <BR>
&nbsp;a glTexEnv problem. Sounds like your image is being applied with DECAL mode (I think this is GL&#8217;s default mode).<BR>
<BR>
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<BR>
&nbsp;of rgba on your primative.<BR>
&nbsp;That said you&#8217;ll need to change the mode to something like MODULATE so that the fragment output will (basically) be the multiplication<BR>
&nbsp;of the underlying primative rgba values and the rgba values of the image (texture) at each fragment.<BR>
<BR>
If you can get your video source to a vtkTexture like so:<BR>
...<BR>
&nbsp;&nbsp;&nbsp;texture = vtkTexture<BR>
&nbsp;&nbsp;&nbsp;texture.setInputConnection( video.GetOuputPort())<BR>
&nbsp;&nbsp;&nbsp;texture.setBlendingMode( &nbsp;&nbsp;&nbsp;&nbsp;VTK_TEXTURE_BLENDING_MODE_MODULATE )<BR>
..<BR>
Then change your actor to a vtkTexturedActor2D<BR>
&nbsp;&nbsp;&nbsp;actor = vtkTexturedActor2D<BR>
&nbsp;&nbsp;&nbsp;actor.setTexture( texture );<BR>
...<BR>
&nbsp;<BR>
&nbsp;maybe that will do what you want.<BR>
Gerrick<BR>
<BR>
<BR>
On 7/11/08 10:07 AM, &quot;dream_noir&quot; &lt;kyle.charbonneau@gmail.com&gt; wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Just to clarify here is a small example program that shows what I am trying to do: <BR>
from vtk import *<BR>
import time<BR>
<BR>
video = vtkVideoSource()<BR>
video.SetFrameRate(30)<BR>
video.SetFrameSize(640, 400, 1)<BR>
video.Record()<BR>
<BR>
mapper = vtkImageMapper()<BR>
mapper.SetInputConnection(video.GetOutputPort())<BR>
mapper.SetColorWindow(233)<BR>
mapper.SetColorLevel(138.5)<BR>
<BR>
actor = vtkActor2D()<BR>
actor.GetProperty().SetOpacity(0.3)<BR>
actor.SetMapper(mapper)<BR>
<BR>
cone = vtkConeSource()<BR>
cone.SetHeight( 3.0 )<BR>
cone.SetRadius( 1.0 )<BR>
cone.SetResolution( 10 )<BR>
<BR>
coneMapper = vtkPolyDataMapper()<BR>
coneMapper.SetInputConnection( cone.GetOutputPort() )<BR>
<BR>
coneActor = vtkActor()<BR>
coneActor.SetMapper( coneMapper )<BR>
<BR>
ren = vtkRenderer()<BR>
ren.AddActor2D(actor)<BR>
ren.AddActor(coneActor)<BR>
<BR>
renWind = vtkRenderWindow()<BR>
renWind.AddRenderer(ren)<BR>
<BR>
for i in range (0, 2000):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(0.03)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;renWind.Render()<BR>
You can't see the cone behind the video source despite setting the opacity. Any ideas? <BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><B>dream_noir wrote:<BR>
</B>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? <BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<HR ALIGN=LEFT SIZE="3" WIDTH="300">View this message in context: Re: Opacity of vtkActor2D <a href="http://www.nabble.com/Opacity-of-vtkActor2D-tp18385577p18405991.html">&lt;http://www.nabble.com/Opacity-of-vtkActor2D-tp18385577p18405991.html&gt;</a> <BR>
Sent from the VTK - Users mailing list archive <a href="http://www.nabble.com/VTK---Users-f14274.html">&lt;http://www.nabble.com/VTK---Users-f14274.html&gt;</a> &nbsp;at Nabble.com.<BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_______________________________________________<BR>
This is the private VTK discussion list.<BR>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><BR>
Follow this link to subscribe/unsubscribe:<BR>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>