<br><font size=2 face="sans-serif">Hi Rocco,</font>
<br>
<br><font size=2 face="sans-serif">Here is a general picture of the different
ways you can implement advanced rendering effects in VTK : </font>
<br><font size=2 face="sans-serif">*shaders : each vtkProp can have a shader,
this is mostly used in single pass algorithms</font>
<br><font size=2 face="sans-serif">*painters : you can implement a per-prop
multipass algorithm in a painter, as is done in the plugin example in ParaView/Example/Plugins/HiddenLinesRemoval
which does exactly what you need.</font>
<br><font size=2 face="sans-serif">*renderpass : this framework is intended
for algorithm that need global information of all props : you can implement
post-processing algorithms like screen-space ambient occlusion or edge-detection
filters, and algorithms that require several passes of all the props, like
shadow mapping.</font>
<br>
<br><font size=2 face="sans-serif">Best,</font>
<br><font size=2 face="sans-serif">Stephane<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>post@rocco-gasteiger.de</b>
</font>
<br><font size=1 face="sans-serif">Envoyé par : vtkusers-bounces@vtk.org</font>
<p><font size=1 face="sans-serif">23/11/2009 10:51</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif">vtkusers@vtk.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">[vtkusers] Request to VTK Multi-Pass
Rendering</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3 face="Calibri">Dear VTK users,</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">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. </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">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:</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">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).</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);</font>
<br><font size=3 face="Calibri">glEnable(GL_DEPTH_TEST);</font>
<br><font size=3 face="Calibri">glColor3f(0,0,0);</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">// Settings for first pass</font>
<br><font size=3 face="Calibri">glColorMask(GL_FALSE, GL_FALSE, GL_FALSE,GL_FALSE);</font>
<br><font size=3 face="Calibri">glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);</font>
<br><font size=3 face="Calibri">drawMyGeometryWithSolidFaces();</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">// Settings for second pass</font>
<br><font size=3 face="Calibri">glColorMask(GL_TRUE, GL_TRUE, GL_TRUE,GL_TRUE);</font>
<br><font size=3 face="Calibri">glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);</font>
<br><font size=3 face="Calibri">glEnable(GL_POLYGON_OFFSET_LINE);</font>
<br><font size=3 face="Calibri">glPolygonOffset(-1.0,1.0);</font>
<br><font size=3 face="Calibri">drawMyGeometryWithSolidFaces();</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">// Reset polygon offsest</font>
<br><font size=3 face="Calibri">glDisable(GL_POLYGON_OFFSET_FILL);</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">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:</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">//** Getting necessary VTK-objects to turn
on/off some OpenGL-states.**/</font>
<br><font size=3 face="Calibri">vtkOpenGLRenderer *r=static_cast<vtkOpenGLRenderer
*>(s->GetRenderer());</font>
<br><font size=3 face="Calibri">vtkActor *actor = r->GetActors()->GetLastActor();</font>
<br><font size=3 face="Calibri">vtkPolyDataMapper *actorMapper = static_cast<vtkPolyDataMapper*>(actor->GetMapper());</font>
<br><font size=3 face="Calibri">vtkProperty *actorProp = actor->GetProperty();</font>
<br><font size=3 face="Calibri">
</font>
<br><font size=3 face="Calibri">// Settings for the first pass //</font>
<br><font size=3 face="Calibri">glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);</font>
<br><font size=3 face="Calibri">glColorMask(GL_FALSE, GL_FALSE, GL_FALSE,GL_FALSE);</font>
<br><font size=3 face="Calibri">actorProp->SetRepresentationToSurface();
//** For glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);**//</font>
<br><font size=3 face="Calibri">this->DelegatePass->Render(s);</font>
<br><font size=3 face="Calibri">this->NumberOfRenderedProps += this->DelegatePass->GetNumberOfRenderedProps();</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">// Settings for the second pass //</font>
<br><font size=3 face="Calibri">actorProp->SetDiffuseColor(0,0,0); //**
For glColor3f(0,0,0); **//</font>
<br><font size=3 face="Calibri">glColorMask(GL_TRUE, GL_TRUE, GL_TRUE,GL_TRUE);</font>
<br><font size=3 face="Calibri">actorProp->SetRepresentationToWireframe();
//** For glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); **//</font>
<br><font size=3 face="Calibri">actorMapper->SetResolveCoincidentTopology(1);</font>
<br><font size=3 face="Calibri">actorMapper->SetResolveCoincidentTopologyToPolygonOffset();</font>
<br><font size=3 face="Calibri">actorMapper->SetResolveCoincidentTopologyPolygonOffsetFaces(0);
//** For glEnable(GL_POLYGON_OFFSET_LINE);**//</font>
<br><font size=3 face="Calibri">actorMapper->SetResolveCoincidentTopologyPolygonOffsetParameters(-1.0,1);
//** For glPolygonOffset(-1.0,1.0);**//</font>
<br><font size=3 face="Calibri">
</font>
<br><font size=3 face="Calibri">this->DelegatePass->Render(s);</font>
<br><font size=3 face="Calibri">this->NumberOfRenderedProps += this->DelegatePass->GetNumberOfRenderedProps();</font>
<br><font size=3 face="Calibri">actorMapper->SetResolveCoincidentTopology(0);
//** For glDisable(GL_POLYGON_OFFSET_FILL);**//</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">In my VTK-class, where I use this rendering
pass, I process following rendering pipeline:</font>
<br><font size=3 face="Calibri">// The elementary passes.</font>
<br><font size=3 face="Calibri">vtkLightsPass *lights=vtkLightsPass::New();</font>
<br><font size=3 face="Calibri">vtkDefaultPass *defaultPass=vtkDefaultPass::New();</font>
<br><font size=3 face="Calibri">
</font>
<br><font size=3 face="Calibri">// Put them in a sequence.</font>
<br><font size=3 face="Calibri">vtkRenderPassCollection *passes=vtkRenderPassCollection::New();</font>
<br><font size=3 face="Calibri">passes->AddItem(lights);</font>
<br><font size=3 face="Calibri">passes->AddItem(defaultPass);</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">vtkSequencePass *seq=vtkSequencePass::New();</font>
<br><font size=3 face="Calibri">seq->SetPasses(passes);</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">// Make the sequence the delegate of a
camera pass.</font>
<br><font size=3 face="Calibri">vtkCameraPass *cameraP=vtkCameraPass::New();</font>
<br><font size=3 face="Calibri">cameraP->SetDelegatePass(seq);</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">// Create the hidden line removing pass
and attach the camera pass as its delegate</font>
<br><font size=3 face="Calibri">vtkHiddenLineDesignerPass *myPass=vtkHiddenLineDesignerPass::New();</font>
<br><font size=3 face="Calibri">myPass ->SetDelegatePass(cameraP);</font>
<br><font size=3 face="Calibri">
</font>
<br><font size=3 face="Calibri">vtkRenderer* renderer01= vtkRenderer::New();</font>
<br><font size=3 face="Calibri">renderer01->SetPass(myPass);</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">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.</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri">Many thanks in advance,</font>
<br><font size=3 face="Calibri">Rocco Gasteiger </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Courier New">--------------------------------------------------</font>
<br><font size=3 face="Courier New">Dipl.-Ing. Rocco Gasteiger</font>
<br><font size=3 face="Courier New">Otto-von-Guericke University<br>
Faculty of Computer Science<br>
Department of Simulation and Graphics<br>
Universitätsplatz 2, 39106 Magdeburg, Germany</font>
<br><font size=3 face="Courier New"> </font>
<br><font size=3 face="Courier New">Office: G29-223</font>
<br><font size=3 face="Courier New">Phone: +49 391 67 127 59<br>
Fax: +49 391 67 111 64</font>
<br><font size=3 face="Courier New">Website: http://wwwisg.cs.uni-magdeburg.de/cvcms/
</font>
<br><font size=3 face="Courier New">--------------------------------------------------</font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font>
<br><font size=3 face="Calibri"> </font><tt><font size=2>_______________________________________________<br>
Powered by www.kitware.com<br>
<br>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br>
<br>
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br>
<br>
Follow this link to subscribe/unsubscribe:<br>
http://www.vtk.org/mailman/listinfo/vtkusers<br>
</font></tt>
<br>
<pre>
Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.
Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.
Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
____________________________________________________
This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.
If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.
E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
</pre>