[vtkusers] vtkLookUpTable transparency bug?

Jon Payne jpayne at hgl-dynamics.com
Fri Aug 12 08:03:47 EDT 2011


Hi Artem,

I am remembering further. If you set the opacity on the actor (with your 
polyDataMapper) to 0.95 then it will work as long as you don't rotate 
the surface because depth culling will still take place. I remember I 
got that far.

I'm not sure how you disable depth culling. Maybe try depth peeling?
http://www.vtk.org/Wiki/VTK/Depth_Peeling

Hope you solve it,
Cheers,
Jon
> SetOpacity, I mean.
>> Hi Artem,
>>
>> But did you try setting the whole surface to be very slightly 
>> transparent? Not via the lookup table but calling SetAlpha(0.95) on 
>> the actor? Otherwise it will still draw everything, even the 
>> transparent coloured bits, as though they were opaque (hiding the 
>> pixels behind).
>>
>> Cheers,
>> Jon
>>> Hi, Jon,
>>>
>>> I did assign alpha 0.5 to the 'invisible' part -- it appears, that
>>> transparency works only for some subsets of possible graphics
>>> positions -- see attached pictures.
>>>
>>> Thank you for trying to help, by the way.
>>>
>>> Best wishes
>>> Artem
>>>
>>>> Hi Artem,
>>>>
>>>> I can't remember exactly but have you tried setting the alpha of 
>>>> the whole
>>>> surface to 0.95? The reason is that somehow VTK/OpenGL needs to 
>>>> know to
>>>> ignore the z-buffer value (I think) so that pixels behind other 
>>>> pixels which
>>>> are now transparent are still drawn.
>>>>
>>>> Cheers,
>>>> Jon
>>>> On 12/08/2011 09:08, Artem Babayan wrote:
>>>>> Hi, Thomas
>>>>>
>>>>> If you look at the second picture, you will see, that some of the
>>>>> 'colorful' graphic is covered by the white (or background color) 
>>>>> field
>>>>> -- this white bit is the part of the graphics which correspond to
>>>>> 'undefined' values and have alpha=0. So it is not transparent -- I
>>>>> cannot see remaining graphics through it.
>>>>>
>>>>> To make it more clear (or more confusing) -- with alpha=1  the first
>>>>> picture would look like a colorful 'mountain' in the flat black
>>>>> 'field' extended to the vertical boundaries of the domain. With
>>>>> alpha=0 the black 'field' is of background color, so it is invisible
>>>>> on the first picture, but if I tilt the graphics slightly backwards
>>>>> (as on the second picture) part of the 'field' comes in front of the
>>>>> 'mountain' and you can see, that it is not actually transparent.
>>>>>
>>>>> Best wishes
>>>>> Artem
>>>>>
>>>>>
>>>>>
>>>>> On 12 August 2011 08:42, Kilgus, Thomas<t.kilgus at dkfz-heidelberg.de>
>>>>>   wrote:
>>>>>> Hi Artem,
>>>>>>
>>>>>> I don't if I get you right, but the pictures look correct. If you 
>>>>>> set the
>>>>>> alpha value of something to 0, you will see the color of the 
>>>>>> stuff behind
>>>>>> it. I guess in your case there is nothing behind it and that's 
>>>>>> why the
>>>>>> background color can be seen?
>>>>>>
>>>>>> Best regards
>>>>>> Thomas
>>>>>>
>>>>>> -----Ursprüngliche Nachricht-----
>>>>>> Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im
>>>>>> Auftrag von Artem Babayan
>>>>>> Gesendet: Donnerstag, 11. August 2011 19:13
>>>>>> An: vtkusers at vtk.org
>>>>>> Betreff: [vtkusers] vtkLookUpTable transparency bug?
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to visualise a 2D scalar field as a 3D 'landscape'. 
>>>>>> Some of
>>>>>> the numbers are just indicators of 'undefined' values, so I do 
>>>>>> not want to
>>>>>> show them at all.
>>>>>>
>>>>>> I set these 'undefined' numbers to the values which correspond to 
>>>>>> the
>>>>>> first row of vtkLookUpTable and then assign this row 'transparent'
>>>>>> alpha=0:
>>>>>>
>>>>>>      lut->SetTableValue(0, 0, 0, 0, 0);
>>>>>>
>>>>>> However, there are 2 problems:
>>>>>>
>>>>>> 1) This results in 'background' color, not 'transparent' -- see 
>>>>>> second
>>>>>> picture -- the transparent part actually closes some part of the 
>>>>>> graphics.
>>>>>> 2) On one Unix system I haven't even got transparency -- the
>>>>>> 'transparent' part was drawn in black color (as corresponds to 
>>>>>> the table
>>>>>> value).
>>>>>>
>>>>>> So am I doing something wrong here or is it a bug in vtkLookUpTable?
>>>>>>
>>>>>> Also, may be there is a smarter way not to show 'undefined' values?
>>>>>>
>>>>>> Best wishes
>>>>>> Artem
>>
>> _______________________________________________
>> 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://www.vtk.org/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://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list