<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=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</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=DE link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Dear VTK users,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US>I want to use the new mulit-pass framework
in VTK implemented by François Bertel. At first, many thanks François for
implementing this framework! I need some multipass rendering for my research
project and I think you have provided a very good base for start-up with this. <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>For a better understanding how it works, I
tried to adopt a native multi-pass OpenGL example in VTK, with help of the
given framework. In doing so I oriented me at the given examples on the
according VTK Wiki sites. Unfortunately, I did not get the same result in VTK
like in OpenGL. I think I miss some important facts of understanding the VTK
rendering pipeline. So I hope somebody (maybe François directly) can help me to
have a better understanding of how the framework works.  Here comes what I
really do:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>In OpenGL I implemented an algorithm for hidden
line removing (It is based on the paper of Jarek R. Rossignac and Maarten van
Emerik: Hidden contours on a frame-buffer (1992) ). Here is a snippet of my OpenGL
code, where I have to render my geometry two times (2-passes).<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glClear (GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glEnable(GL_DEPTH_TEST);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glColor3f(0,0,0);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// Settings for
first pass<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glColorMask(GL_FALSE,
GL_FALSE, GL_FALSE,GL_FALSE);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glPolygonMode(GL_FRONT_AND_BACK,
GL_FILL);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>drawMyGeometryWithSolidFaces();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// Settings for
second pass<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glColorMask(GL_TRUE,
GL_TRUE, GL_TRUE,GL_TRUE);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glPolygonMode(GL_FRONT_AND_BACK,
GL_LINE);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glEnable(GL_POLYGON_OFFSET_LINE);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glPolygonOffset(-1.0,1.0);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>drawMyGeometryWithSolidFaces();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// Reset
polygon offsest<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>glDisable(GL_POLYGON_OFFSET_FILL);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>In VTK I derived a class &#8220;vtkHiddenLineDesignerPass&#8221;
from &#8220;vtkRenderPass&#8221; and tried to implement the same OpenGL steps.
The result is, that still all lines are rendered, also the hidden lines. I use
the following lines of code snippets in the &#8220;Render(const vtkRenderState
*s)&#8221;-function to adopt the OpenGL-code with VTK datastructures and calls:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>//** Getting necessary VTK-objects to turn
on/off some OpenGL-states.**/<o:p></o:p></span></p>

<p class=MsoNormal>vtkOpenGLRenderer *r=static_cast&lt;vtkOpenGLRenderer *&gt;(s-&gt;GetRenderer());<o:p></o:p></p>

<p class=MsoNormal><span lang=EN-US>vtkActor *actor = r-&gt;GetActors()-&gt;GetLastActor();<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>vtkPolyDataMapper *actorMapper = static_cast&lt;vtkPolyDataMapper*&gt;(actor-&gt;GetMapper());<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>vtkProperty *actorProp = actor-&gt;GetProperty();<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>                               <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>// Settings for the first pass //<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>glColorMask(GL_FALSE, GL_FALSE, GL_FALSE,GL_FALSE);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorProp-&gt;SetRepresentationToSurface();
//** For glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);**//<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>this-&gt;DelegatePass-&gt;Render(s);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>this-&gt;NumberOfRenderedProps += this-&gt;DelegatePass-&gt;GetNumberOfRenderedProps();<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>// Settings for the second pass //<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>actorProp-&gt;SetDiffuseColor(0,0,0);
//** For glColor3f(0,0,0); **//<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>glColorMask(GL_TRUE, GL_TRUE, GL_TRUE,GL_TRUE);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorProp-&gt;SetRepresentationToWireframe(); 
//** For glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); **//<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorMapper-&gt;SetResolveCoincidentTopology(1);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorMapper-&gt;SetResolveCoincidentTopologyToPolygonOffset();<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorMapper-&gt;SetResolveCoincidentTopologyPolygonOffsetFaces(0);
//** For glEnable(GL_POLYGON_OFFSET_LINE);**//<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorMapper-&gt;SetResolveCoincidentTopologyPolygonOffsetParameters(-1.0,1);
//** For glPolygonOffset(-1.0,1.0);**//<o:p></o:p></span></p>

<p class=MsoNormal>                <o:p></o:p></p>

<p class=MsoNormal><span lang=EN-US>this-&gt;DelegatePass-&gt;Render(s);<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>this-&gt;NumberOfRenderedProps += this-&gt;DelegatePass-&gt;GetNumberOfRenderedProps();<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>actorMapper-&gt;SetResolveCoincidentTopology(0);
//** For glDisable(GL_POLYGON_OFFSET_FILL);**//<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>In my VTK-class, where I use this rendering
pass, I process following rendering pipeline:<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// The
elementary passes.<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>vtkLightsPass *lights=vtkLightsPass::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>vtkDefaultPass
*defaultPass=vtkDefaultPass::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>                <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// Put them in
a sequence.<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>vtkRenderPassCollection
*passes=vtkRenderPassCollection::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>passes-&gt;AddItem(lights);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>passes-&gt;AddItem(defaultPass);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>vtkSequencePass
*seq=vtkSequencePass::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>seq-&gt;SetPasses(passes);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// Make the
sequence the delegate of a camera pass.<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>vtkCameraPass *cameraP=vtkCameraPass::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>cameraP-&gt;SetDelegatePass(seq);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>// Create the hidden
line removing pass and attach the camera pass as its delegate<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>vtkHiddenLineDesignerPass
*myPass=vtkHiddenLineDesignerPass::New();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>myPass -&gt;SetDelegatePass(cameraP);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>                <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'>vtkRenderer* renderer01= vtkRenderer::New();<o:p></o:p></p>

<p class=MsoNormal>renderer01-&gt;SetPass(myPass);<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US>Especially, my misunderstanding relies on when
to use native OpenGL-code and when using VTK-calls. I tried some variations of  the
code, presented above but without success. It would be very helpful if someone
can give me some hints.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US>Many thanks in advance,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>Rocco Gasteiger <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>--------------------------------------------------</span><span
lang=EN-US><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Dipl.-Ing.
Rocco Gasteiger</span><span lang=EN-US><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Otto-von-Guericke
University<br>
Faculty of Computer Science<br>
Department of Simulation and Graphics<br>
Universitätsplatz 2, 39106 Magdeburg, Germany<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Office: 
G29-223<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Phone:  
+49 391 67 127 59<br>
Fax:&nbsp;&nbsp;   +49 391 67 111 64</span><span lang=EN-US style='font-size:
12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>Website:
http://wwwisg.cs.uni-magdeburg.de/cvcms/  <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>--------------------------------------------------</span><o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

</div>

</body>

</html>