Hi Stefan,

While still having that in mind: my recall of the VTK rendering process is as 
follows (might be wrong, this is my memory):

- VTK iterates the props of a window four times, asking each to render (for 
different modes such as translucent, opaque, overlay)

MITK injects itself as follows:
- it adds a special MITK prop into the scene
- when this prop is rendered:
  - it will in turn iterate all MITK mappers to collect their vtkProps (this is 
what you describe below, but note that this is executed while VTK already 
started its frame rendering)
  - it will iterate all of those vtkProps to delegate rendering to them

The mitk::Annotation problem arises because mitk::TextAnnotation3D add a 
vtkProp directly to the vtkRenderWindow. That is, TextAnnotation3D adds 
something to the outer VTK loop while the inner MITK loop is executed.

Best,
Daniel


> "Dinkelacker, Stefan" <[email protected]> hat am 18. Juni 2019 
> um 13:06 geschrieben:
> 
> 
> Thank you for sharing! I would actually expect GenerateData() to be executed 
> before the rendering and the rendering pass to simply call GetVtkProp() to 
> get its data to render. Interesting that is may be different now in VTK 8.
> 
> -----Original Message-----
> From: Daniel Maleike [mailto:[email protected]] 
> Sent: Tuesday, June 18, 2019 12:05 PM
> To: Dinkelacker, Stefan <[email protected]>; 
> [email protected]
> Subject: RE: [mitk-users] TextOverlay3D updates one frame later
> 
> Hi Stefan,
> 
> thanks for your answer. I had a deeper look now that I would like to shared.
> 
> It does not look as if one should change text overlays from within mappers:
>  - mappers' GenerateData() method is called while VTK is already rendering 
> (traversing props, asking them to render)
>  - switching an annotation on/off will add/remove another prop (VTK follower) 
> to/from the renderer (window?)
> 
> While I think/hope that VTK takes measures to avoid chaos when its prop list 
> changes during rendering, it seems to not automatically render again when 
> this happens. Seems to make sense, probably you wouldn't want this in 
> applications.
> 
> My summary: adding/removing MITK annotations from within mappers is not 
> supported at the moment. When still doing so the UI level should trigger the 
> change and enforce a double rendering afterwards.
> 
> While debugging I stumbled upon code in mitk::VtkPropRenderer (around 
> WriteSimpleText and m_TextCollection - marked deprecated since four years) 
> that is better suited for real overlays: it collects some 'special overlay 
> information' during rendering and then renders them after everything else - 
> but still during the same rendering call. This might serve as an inspiration 
> if anybody wants to improve. However, this approach would not work for the 
> TextAnnotation3D which is an object in the 3D scene and not an overlay!
> 
> Kind regards,
> Daniel
> 
> 
> > "Dinkelacker, Stefan" <[email protected]> hat am 18. Juni 
> > 2019 um 09:23 geschrieben:
> > 
> > 
> > Hi Daniel,
> > 
> > I didn't look into 3d annotation details yet and can't tell you anything 
> > about the rendering order or if it is a MITK issue or a VTK issue. AFAIK 
> > the Connectomics mapper wasn't used for a while now and we would need to 
> > check. I guess there is also some test data in the test repo if you want to 
> > give it a shot.
> > 
> > However, I can at least assure you that it is okay to use annotations in 
> > mappers. :-)
> > 
> > Best,
> > Stefan
> > 
> > -----Original Message-----
> > From: Daniel Maleike [mailto:[email protected]] 
> > Sent: Monday, June 17, 2019 4:07 PM
> > To: [email protected]
> > Subject: [mitk-users] TextOverlay3D updates one frame later
> > 
> > Hi everybody,
> > 
> > I have a question regarding mitk::TextAnnotation3D. As far as I can see, 
> > this replaces mitk::TextOverlay3D from the 2016.11 release.
> > 
> > I am just modifying a custom mapper to use TextAnnotation3D instead of 
> > TextOverlay3D. I took orientation from documentation and 
> > Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsNetworkMapper3D.cpp.
> > Most works fine with one exception: when I change the visibility of the 
> > text annotation, this change takes only effect one rendered frame later.
> > 
> > I guess this is because of rendering order - perhaps the overlay gets 
> > rendered first by VTK and only then my mapper gets to work? (did not yet 
> > debug that deep)
> > 
> > Questions:
> > - is TextAnnotation3D supposed to be used by mappers? How are visibility 
> > changes supposed to work? Or should I fall back to managing my own VTK text 
> > follower?
> > - is this effect known for ConnectomicsNetworkMapper3D?
> > - is there a way to workaround this effect / to influence rendering order?
> > 
> > Thanks for any input,
> > Daniel
> > 
> > 
> > _______________________________________________
> > mitk-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mitk-users


_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to