[vtkusers] [vtk-developers] VTK 6.3 OpenGL2 - vtkTextActor blurred text when used with vtkFixedPointVolumeRayCastMapper

Aashish Chaudhary aashish.chaudhary at kitware.com
Fri Nov 20 20:39:10 EST 2015


Simon,

You branch has been merged:
https://gitlab.kitware.com/vtk/vtk/merge_requests/932. Thank for the patch.

- Aashish

On Fri, Nov 20, 2015 at 9:37 AM, Ken Martin <ken.martin at kitware.com> wrote:

> That is the standard blend save/restore code so I think that should do the
> trick. Thanks for digging into it.
>
> On Fri, Nov 20, 2015 at 8:32 AM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
>> Hi Simon,
>>
>> Thanks! I am okay with merging this change but in general restoring to
>> previous state is tricky as for that you need to know the previous state. I
>> think restoring to a default state (which you did) makes more sense.
>> Although in VTK we don't have clear guideline on this. I am reviewing your
>> changes..
>>
>>
>> On Fri, Nov 20, 2015 at 8:26 AM, Simon ESNEAULT <simon.esneault at gmail.com
>> > wrote:
>>
>>> Hello,
>>>
>>> I've created a merge request for this bug :
>>> https://gitlab.kitware.com/vtk/vtk/merge_requests/932
>>>
>>> The class vtkOpenGLRayCastImageDisplayHelper is changing OpenGL blend
>>> state, but never restores the state as it was before, resulting in some
>>> incorrect blend later.
>>> I don't know if it's the correct fix, but it certainly look like the
>>> reason for this bug, and it solve the bug here.
>>> Can someone review this merge ?
>>>
>>> Regards
>>> Simon
>>>
>>>
>>> 2015-11-18 9:38 GMT+01:00 Simon ESNEAULT <simon.esneault at gmail.com>:
>>>
>>>> Morning !
>>>>
>>>> http://www.vtk.org/Bug/view.php?id=15838
>>>>
>>>> Let me know if there is anything I can do to solve this.
>>>>
>>>> Simon
>>>>
>>>> 2015-11-17 16:50 GMT+01:00 Aashish Chaudhary <
>>>> aashish.chaudhary at kitware.com>:
>>>>
>>>>>
>>>>>
>>>>> On Tue, Nov 17, 2015 at 3:36 AM, Simon ESNEAULT <
>>>>> simon.esneault at gmail.com> wrote:
>>>>>
>>>>>> Dear Aashish,
>>>>>>
>>>>>> Yes the root cause is probably located in vtkTexturedActor2D, or in
>>>>>> vtkOpenGLTexture::Load( vtkRenderer* ) which looks like the responsible
>>>>>> class for loading the texture.
>>>>>> Shall I fill a bug ?
>>>>>>
>>>>>
>>>>> Yes, please.
>>>>>
>>>>> - Aashish
>>>>>
>>>>>
>>>>>> Thanks
>>>>>> Simon
>>>>>>
>>>>>> 2015-11-16 17:49 GMT+01:00 Aashish Chaudhary <
>>>>>> aashish.chaudhary at kitware.com>:
>>>>>>
>>>>>>> I see so its not just related to volume rendering and it seems to be
>>>>>>> a vtkTextActor2D problem? In that can probably Ken / David Lonie wants to
>>>>>>> take a look at it. Nonetheless, we will follow up on this bug.
>>>>>>>
>>>>>>> - Aashish
>>>>>>>
>>>>>>> On Mon, Nov 16, 2015 at 11:12 AM, Simon ESNEAULT <
>>>>>>> simon.esneault at gmail.com> wrote:
>>>>>>>
>>>>>>>> Hello Aashish,
>>>>>>>>
>>>>>>>> Thanks !
>>>>>>>> After doing some test, I realized the patch I've just sent is not
>>>>>>>> the correct fix at all, because the text is not rendered properly when we
>>>>>>>> don't use a vtkFixedPointVolumeRayCastMapper anymore.
>>>>>>>>
>>>>>>>> I believe the problem is probably larger than this and probably has
>>>>>>>> nothing to do with the freetype text generation, but more with the
>>>>>>>> vtkTexturedActor2D rendering part used together with a
>>>>>>>> vtkFixedPointVolumeRayCastMapper on the new rendering backend, when the
>>>>>>>> texture has some transparent pixel in it ...
>>>>>>>>
>>>>>>>> Attached there is a new example that demonstrate that a
>>>>>>>> vtkTextActor AND a vtkTexturedButtonRepresentation2D are not correctly
>>>>>>>> drawn in that case :
>>>>>>>> - OpenGL1 backend
>>>>>>>> <http://picpaste.com/pics/OGL1-Texture-okay.1447690100.png> : Transparent
>>>>>>>> pixel in Texture are correctly drawn
>>>>>>>> - OpenGL2 backend
>>>>>>>> <http://picpaste.com/pics/OGL2-Texture-not-okay.1447690272.png> :
>>>>>>>> Transparent pixel in Texture are not correctly drawn (clamped to white ?)
>>>>>>>>
>>>>>>>> The example is more simple than the previous one and does not need
>>>>>>>> any additional data.
>>>>>>>>
>>>>>>>> Hope that helps !
>>>>>>>> -Simon
>>>>>>>>
>>>>>>>> 2015-11-16 16:11 GMT+01:00 Aashish Chaudhary <
>>>>>>>> aashish.chaudhary at kitware.com>:
>>>>>>>>
>>>>>>>>> Simon,
>>>>>>>>>
>>>>>>>>> Thanks for the report. I will follow up with other developers on
>>>>>>>>> this bug.
>>>>>>>>>
>>>>>>>>> - Aashish
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Nov 16, 2015 at 6:08 AM, Simon ESNEAULT <
>>>>>>>>> simon.esneault at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> Trying to solve this problem, I found out that if one call
>>>>>>>>>> "vtkFreeTypeTools::GetInstance()->DebugTexturesOn();" before to render a
>>>>>>>>>> string with a vtkTextActor, the text is properly rendered with a yellow dot
>>>>>>>>>> at the anchor point, and with a transparent gray background.
>>>>>>>>>> - DebugTexturesOn :
>>>>>>>>>> http://picpaste.com/pics/Blurred.1447668943.PNG
>>>>>>>>>> - DebugTexturesOff :
>>>>>>>>>> http://picpaste.com/pics/Not-Blurred.1447669009.PNG
>>>>>>>>>>
>>>>>>>>>> Now digging into the code in vtkFreeTypeTools.cxx, I suspect this
>>>>>>>>>> is a blending problem. When we activate Texture Debugging, a gray
>>>>>>>>>> background is first drawn, and after that in the method RenderCharacter(
>>>>>>>>>> ... ) line 1887; we either blend the rendered text with the background or
>>>>>>>>>> not.
>>>>>>>>>>
>>>>>>>>>> Attached is a diff file that solves the problem for me. I do not
>>>>>>>>>> really understand why, so maybe a developer with more VTK's knowledge can
>>>>>>>>>> integrate this properly :)
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Simon
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2015-11-13 16:43 GMT+01:00 Simon ESNEAULT <
>>>>>>>>>> simon.esneault at gmail.com>:
>>>>>>>>>>
>>>>>>>>>>> Hi All,
>>>>>>>>>>>
>>>>>>>>>>> All vtkTextActor are rendered blurred when using with
>>>>>>>>>>> vtkFixedPointVolumeRayCastMapper in the same renderer in vtk 6.3 with the
>>>>>>>>>>> new rendering backend.
>>>>>>>>>>>
>>>>>>>>>>> Here are some snapshots :
>>>>>>>>>>>  - OpenGL1
>>>>>>>>>>> <http://picpaste.com/pics/OGL1-not-blurred.1447428990.png>
>>>>>>>>>>>  - OpenGL2
>>>>>>>>>>> <http://picpaste.com/pics/OGL2-blurred.1447429027.png>
>>>>>>>>>>>
>>>>>>>>>>> Attached some code that reproduces the problem, to be used with
>>>>>>>>>>> this <https://www.dropbox.com/s/ptqwi0ebv75kt35/volume.zip>
>>>>>>>>>>> volume. Visible on OSX and Windows to our knowledge, probably on more OS.
>>>>>>>>>>>
>>>>>>>>>>> The text is rendered properly when used with the old backend or
>>>>>>>>>>> when using a vtkGPUVolumeRayCastMapper instead of
>>>>>>>>>>> the vtkFixedPointVolumeRayCastMapper.
>>>>>>>>>>>
>>>>>>>>>>> Shall I feel a bug, is this a known issue ?
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Simon
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------------------------------------------
>>>>>>>>>>> Simon Esneault
>>>>>>>>>>> Rennes, France
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------------------------------------------
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> ------------------------------------------------------------------
>>>>>>>>>> Simon Esneault
>>>>>>>>>> Rennes, France
>>>>>>>>>> ------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>> Search the list archives at:
>>>>>>>>>> http://markmail.org/search/?q=vtkusers
>>>>>>>>>>
>>>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>>>>>>>         *
>>>>>>>>> *| http://www.kitware.com/company/team/chaudhary.html
>>>>>>>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> ------------------------------------------------------------------
>>>>>>>> Simon Esneault
>>>>>>>> Rennes, France
>>>>>>>> ------------------------------------------------------------------
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>>>>>       *
>>>>>>> *| http://www.kitware.com/company/team/chaudhary.html
>>>>>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> ------------------------------------------------------------------
>>>>>> Simon Esneault
>>>>>> Rennes, France
>>>>>> ------------------------------------------------------------------
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>>
>>>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>>>     *
>>>>> *| http://www.kitware.com/company/team/chaudhary.html
>>>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> ------------------------------------------------------------------
>>>> Simon Esneault
>>>> Rennes, France
>>>> ------------------------------------------------------------------
>>>>
>>>
>>>
>>>
>>> --
>>> ------------------------------------------------------------------
>>> Simon Esneault
>>> Rennes, France
>>> ------------------------------------------------------------------
>>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>> *
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>>
>>
>
>
> --
> Ken Martin PhD
> Chairman & CFO
> Kitware Inc.
> 28 Corporate Drive
> Clifton Park NY 12065
> 518 371 3971
>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee.  Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message.  Thank you.
>



-- 



*| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
*| http://www.kitware.com/company/team/chaudhary.html
<http://www.kitware.com/company/team/chaudhary.html>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151120/f21e4447/attachment.html>


More information about the vtkusers mailing list