<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 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>I derived my own render pass class from vtkRenderPass and
want to perform two render passes in it. My scene consists of two objects A and
B. For each object, I want to store its depth values in a depth texture by
using frame buffer objects (fbo). For accomplishing this task, I call two times
“this->DelegatePass->Render(&myRenderState)” within my
derived rendering class. My delegate rendering pass is a vtkDefaultPass. For rendering
A I set opacity of B to zero and for object B I do it the same for A. Here is a
pseudo code snippet of what I have done. <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>void vtkMyRenderPass::Render()<o:p></o:p></p>
<p class=MsoNormal>{<o:p></o:p></p>
<p class=MsoNormal> //
Perform some tests<o:p></o:p></p>
<p class=MsoNormal> //
…<o:p></o:p></p>
<p class=MsoNormal> //
Create fbo and render state<o:p></o:p></p>
<p class=MsoNormal> //
Get actor for object B<o:p></o:p></p>
<p class=MsoNormal> actorB->SetOpacity(0.0)<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal> //
Create first depth texture and assign it to fbo<o:p></o:p></p>
<p class=MsoNormal> //
Perform first render pass<o:p></o:p></p>
<p class=MsoNormal> this->DelegatePass->Render(&newRenderState);<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal> //
Reset opacity of actorB <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>// Get actor for
object A<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> </span>actorA->SetOpacity(0.0)<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal> //
Create second depth texture and assign it to fbo<o:p></o:p></p>
<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>// Perform
second render pass <o:p></o:p></span></p>
<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>this->DelegatePass->Render(&newRenderState);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>// Reset opacity
of actorA <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>It works fine so far. But I notice a strong performance leak
during interaction due to the second offscreen rendering. Can anybody give me a
hint what the reason for this is? <span lang=EN-US>My render window is 300x300
and I use a GeForce 9800 GT. Do I have to write a separate render pass class
for each render pass and collect them in a vtkRenderPassCollection (e.g. vtkMyRenderPassA
and vtkMyRenderPassB, for object A and B)?<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 and best regards,<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><o:p> </o:p></span></p>
</div>
</body>
</html>