<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> </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> </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> </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> </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> </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> </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> </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> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>In VTK I derived a class “vtkHiddenLineDesignerPass”
from “vtkRenderPass” 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 “Render(const vtkRenderState
*s)”-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> </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<vtkOpenGLRenderer *>(s->GetRenderer());<o:p></o:p></p>
<p class=MsoNormal><span lang=EN-US>vtkActor *actor = r->GetActors()->GetLastActor();<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>vtkPolyDataMapper *actorMapper = static_cast<vtkPolyDataMapper*>(actor->GetMapper());<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>vtkProperty *actorProp = actor->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->SetRepresentationToSurface();
//** For glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);**//<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>this->DelegatePass->Render(s);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>this->NumberOfRenderedProps += this->DelegatePass->GetNumberOfRenderedProps();<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 second pass //<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>actorProp->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->SetRepresentationToWireframe();
//** For glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); **//<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>actorMapper->SetResolveCoincidentTopology(1);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>actorMapper->SetResolveCoincidentTopologyToPolygonOffset();<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>actorMapper->SetResolveCoincidentTopologyPolygonOffsetFaces(0);
//** For glEnable(GL_POLYGON_OFFSET_LINE);**//<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>actorMapper->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->DelegatePass->Render(s);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>this->NumberOfRenderedProps += this->DelegatePass->GetNumberOfRenderedProps();<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>actorMapper->SetResolveCoincidentTopology(0);
//** For glDisable(GL_POLYGON_OFFSET_FILL);**//<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><o:p> </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->AddItem(lights);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>passes->AddItem(defaultPass);<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>vtkSequencePass
*seq=vtkSequencePass::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>seq->SetPasses(passes);<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>// 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->SetDelegatePass(seq);<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>// 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 ->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->SetPass(myPass);<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </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> </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> </o:p></span></p>
<p class=MsoNormal><o:p> </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> </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: +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> </o:p></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
</div>
</body>
</html>