<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        mso-fareast-language:EN-GB;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For correct transparent blending, add a vtkDepthSortPolyDataFilter (or whatever it’s called). Just before the mapper, it needs the camera to be set so that
it can get the correct distance order of each polygon.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">JB<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> vtkusers-bounces@vtk.org [mailto:vtkusers-bounces@vtk.org]
<b>On Behalf Of </b>max perlman<br>
<b>Sent:</b> 22 May 2013 08:20<br>
<b>To:</b> vtkusers@vtk.org<br>
<b>Subject:</b> [vtkusers] Mesh Opacity<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<div>
<pre style="margin-left:36.0pt"><span style="color:black">Dear VTKers,<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">I want to show a mesh(that i read from an obj file using vtkobjreader) and when i reduce opacity, not to see the triangles from which it is made.<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">How can i achieve this?<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">Part of the code:<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> reader = vtkOBJReader.New();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> reader.SetFileName(filePath);<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> reader.Update();</span><o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt"><span style="color:black">vtkPolyDataNormals boneNormals = new vtkPolyDataNormals();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">boneNormals.SetInputConnection(reader.GetOutputPort());<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">boneNormals.SetFeatureAngle(60.0);</span><o:p></o:p></pre>
<pre style="margin-left:36.0pt"><span style="color:black">vtkPolyDataMapper mapper1 = vtkPolyDataMapper.New();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">mapper1.SetInputConnection(boneNormals.GetOutputPort());<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">actor1 = vtkActor.New();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">actor1.SetMapper(mapper1);<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">renderWindow = renderWindowControl1.RenderWindow;<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">// set background color<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">renderer.SetBackground(0.5, 0.5, 0.5);<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">renderer.AddActor(actor1);<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"><o:p> </o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">renderer.ResetCamera();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black">renderWindow.Render();</span><o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt"><span style="color:black">private void button8_Click(object sender, EventArgs e)<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> {<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> if (j > 0)<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> {<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> j -= 0.1;<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> actor1.GetProperty().SetOpacity(j);<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> renderWindow.Render();<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> }<o:p></o:p></span></pre>
<pre style="margin-left:36.0pt"><span style="color:black"> }</span><o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt"><span style="color:black">Thank you,</span><o:p></o:p></pre>
<pre style="margin-left:36.0pt"><span style="color:black">Max</span><o:p></o:p></pre>
</div>
</div>
</body>
</html>