[vtkusers] Odd opacity issue
Gib Bogle
g.bogle at auckland.ac.nz
Sun Aug 10 19:26:13 EDT 2014
Hi Bill,
This example confirms that depth peeling is not supported. I wonder why, since my system apparently has the required openGL extensions. I was able to check this with an excellent tool, GLEW, the OpenGL Extension Wrangler Library: http://glew.sourceforge.net/
BTW, it would be useful if this link replaced the one to glview on this page:
http://www.vtk.org/Wiki/VTK_FAQ#How_do_I_check_which_OpenGL_versions_or_extensions_are_supported_by_my_graphic_card_or_OpenGL_implementation.3F
I can't see a convenient way to use the vtkDepthSortPolydata in my case without making significant changes to my code. Rather than a single actor, my scene has multiple actors, and I modify their positions each time step. If I understand correctly, what I would need to do is work with translucentGeometry input connections instead of with actors. I think I would need to remove all input connections then remake them after modifying the sphere center positions. Or is there a way to get the input connection info and modify the sphere center position without rebuilding everything?
Apart from the probable performance implications of doing this scene reconstruction every time step, there is another drawback in my case. I want to be able to control actor opacity individually - by making some actors opaque while the rest are translucent I can highlight them.
Best
Gib
________________________________________
From: Bill Lorensen [bill.lorensen at gmail.com]
Sent: Sunday, 10 August 2014 11:20 p.m.
To: Kim Rosenbohm
Cc: Gib Bogle; vtkusers at vtk.org
Subject: Re: [vtkusers] Odd opacity issue
Maybe this example will be useful:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CorrectlyRenderingTranslucentGeometry
Bill
On Sun, Aug 10, 2014 at 6:17 AM, Kim Rosenbohm <kim.rosenbohm at posteo.de> wrote:
> Hi Gib.
>
> I'm a newbie to VTK and haven't used the DepthPeeling class myself, so I
> probably can't help you much... :/
> I guess if you used OpenGL rendering, get no errors and the class tells you
> that "renderer->GetLastRenderingUsedDepthPeeling();" it should work.
> Maybe you have to fiddle around with the settings a bit. Or the
> implementation in your VTK version is broken...
>
> Best of luck,
>
> Kim
>
> Am 10.08.2014 04:37, schrieb Gib Bogle:
>
> My card uses OpenGL 4.1 and supports all the required extensions. Depth
> peeling does not work though.
> ________________________________
> From: Kim Rosenbohm [kim.rosenbohm at posteo.de]
> Sent: Sunday, 10 August 2014 11:57 a.m.
> To: Gib Bogle; vtkusers at vtk.org
> Subject: Re: [vtkusers] Odd opacity issue
>
> Hi Gib.
>
> Proper blending of transparent objects is only possible by rendering them in
> the correct order.
> This can be tricky and if objects or polygons overlap you even won't get
> away with sorting them...
> You probably want depth peeling for order-independent transparency:
> http://www.vtk.org/Wiki/VTK/Depth_Peeling
>
> Best Regards,
>
> Kim
>
> Am 10.08.2014 01:48, schrieb Gib Bogle:
>
> The problem is simply demonstrated with the opacity example:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/Opacity
>
> Adding this line:
> sphereActor->SetPosition(1.0,0.0,0.0);
> and setting the opacity of both actors to 0.99 gives an unexpected and
> unattractive result.
>
> I see that there have been posts about problems with opacity/transparency as
> far back as 2006. Maybe there is a solution...
> ________________________________
> From: vtkusers [vtkusers-bounces at vtk.org] on behalf of Gib Bogle
> [g.bogle at auckland.ac.nz]
> Sent: Sunday, 10 August 2014 11:25 a.m.
> To: vtkusers at vtk.org
> Subject: [vtkusers] Odd opacity issue
>
> Hi,
> I'm using vtkRenderWindowInteractor (VTK 5.10) in Qt, rendering spheres.
> I'm trying to implement a degree of transparency, like this:
>
> actor->GetProperty()->SetOpacity(opacity);
>
> applied to all the spheres.
>
> If opacity is less than 1 the image immediately changes in unexpected ways.
> See the two attached images, with opacity = 1.0 and 0.99. It looks as if
> spheres have had their positions and sizes changed. But when I rotate the
> scene it becomes apparent that something else is happening. Some of the
> "foreground" spheres move from left to right (for example) while others
> apparently in the foreground are moving right to left. It seems that the
> order of rendering of the spheres, which normally places the most remote
> first and the nearest last, has somehow been messed up, so that spheres at
> the back are being rendered last so that they appear to be the closest.
> Maybe the order has been simply reversed, but the visual effect is made more
> confusing by parallax - my brain is interpreting the bigger spheres as
> closer.
>
> Is this a well-known issue, and is there a simple way to fix it?
>
> Thanks
> Gib
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtkusers
mailing list