Hi Daniel, I think the solution is as easy as implementing vtkGLMapperProp::RenderTranslucentPolygonalGeometry accordingly. Until now, only vtkGLMapperProp::RenderOpaqueGeometry is implemented and we do not have any GLMappers which are using transparency.
Regards Christoph On Tue, 2016-06-28 at 16:01 +0200, Daniel Maleike wrote: > Dear friends of rendering issues, > > I recently implemented an OpenGL based mapper for a custom data object and > ran into a problem with > mitk::GLMapper::MitkRender() [1]. This function assumes that everything that > is ever rendered by a > mapper is opaque. This breaks the correct rendering order proposed by VTK > which is first opaque > objects then translucent ones. Is there any reason for the current behavior > or the restriction to > opaque objects? Otherwise I'd propose to reformulate the method as below. > This version works fine > for me. Any objections? > > Kind regards, > Daniel > > [1] > http://mitk.org/git/?p=MITK.git;a=blob;f=Modules/LegacyGL/mitkGLMapper.cpp;h=043e31b62419c5f3a > 00784e1c2f80579504361a9;hb=1f2ae20d52c6f4437dbb3ce94860cb858b4ba8a7 > > void > mitk::GLMapper::MitkRender(mitk::BaseRenderer* renderer, > mitk::VtkPropRenderer::RenderType type) > { > bool visible = true; > GetDataNode()->GetVisibility(visible, renderer, "visible"); > if ( !visible ) return; > > float opacity = 1.0; > GetDataNode()->GetOpacity(opacity, renderer); > > // Ensure that Paint is called only once _and_ at the right moment, i.e. > // when VTK decides that opaque or translucent objects should be rendered. > // If this is not done right, then we'd either render multiple time and/or > // get problems with mixing opaque and translucent objects. > if ( opacity < 1.0 && type == mitk::VtkPropRenderer::Translucent ) { > Paint(renderer); > } else if ( opacity >= 1.0 && type == mitk::VtkPropRenderer::Opaque ) { > Paint(renderer); > } > } > > > > -- > Dr. Daniel Maleike, Mint Medical GmbH > Friedrich-Ebert-Straße 2, 69221 Dossenheim/Heidelberg > Geschäftsführer: Dr. Matthias Baumhauer, Registergericht Mannheim, HRB 709351 ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
