[vtkusers] vtkImageStack with blending options

David Gobbi david.gobbi at gmail.com
Mon May 9 14:50:11 EDT 2016


Hi Simon,

Yes, vtkImageStack pastes the images one-by-one into the frame buffer, and
the reasoning behind this is that the images might have different
geometries.  In this case, combining them into a single texture is
difficult.  My main reason for creating vtkImageStack was, in fact, to cure
the problem of z-buffer fighting when layering images that had different
geometries.

I'm looking again at the VTKTextureBlendingMode, and you are correct, it
cannot be used here (and it isn't even implemented in the OpenGL2
backend!).  But adding methods to vtkTexture and vtkImageSliceMapper so
that glBlendFunc can be tweaked should be relatively straightforward.  I
could definitely help with that.

Cheers,
 - David




On Thu, May 5, 2016 at 10:29 PM, Simon Drouin <drouin.simon at gmail.com>
wrote:

> Hi David,
>
> Didn't realize OpenGL2 backend was using vtkTexture. We are still on the
> old OpenGL backend (hopefully we will switch soon).
>
> We have had our own (very simple) version of vtkImageStack based on
> vtkTexture for a while. Ours uses multi texturing to combine images, which
> is limited by the number of textures the OpenGL driver allows. I've been
> wanting to replace it with vtkImageStack for that reason but was always
> stopped by the lack of control of blending with vtkImageStack.
>
> I think modifying vtkImageStack is a little more work than you suggest
> though. vtkTexture has control for blending (I guess you are referring to
> VTKTextureBlendingMode), but nothing that would be compatible with
> vtkImageStack. VTKTextureBlendingMode controls how multiple textures are
> combined together and with incoming fragment color rather than how the
> fragment is blended into the frame buffer. My understanding is that
> vtkImageStack combines images in the framebuffer, so to control blending
> you have to be able to set glBlendFunc and glBlendEquation for each
> vtkImageSlice.
>
> I think one extra option that would be interesting for vtkImageStack is to
> allow rendering of all images in a texture rather than directly in the
> frame buffer. It would allow to combine all images in the stack in a very
> flexible way before rendering to the screen.
>
> What do you think?
>
> I'll try to find a time slot to work on those ideas. If I find the time
> I'll contact you to help me push the code to VTK.
>
> Cheers.
>
> s.
>
> On Tue, May 3, 2016 at 1:59 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>
>> Hi Simon,
>>
>> The vtkTexture class provides some control over blending modes, and this
>> feature could also be added to vtkOpenGLImageSliceMapper (which uses
>> vtkTexture internally, for the OpenGL2 backend).  If it was added there,
>> then it could be used with vtkImageStack or anywhere else that the
>> vtkImageSlice/vtkImageActor classes are used.
>>
>> I've had this feature on my mind for a long while, but I haven't had any
>> work projects that need it yet.  If you want to tinker around with
>> vtkOpenGLImageSliceMapper and get things working to your satisfaction, I'd
>> gladly help to get your changes into VTK.
>>
>>  - David
>>
>>
>> On Tue, May 3, 2016 at 11:41 AM, Simon Drouin <drouin.simon at gmail.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> Looking for a class that behaves similarly to vtkImageStack but that
>>> allows for different types of blending between the slices ( basically,
>>> expose OpenGL controls for blending, i.e. glBlendFunc, and
>>> glBlendEquation). Is there a class that does that in VTK without relying on
>>> CPU-based image processing?
>>>
>>> Thanks in advance.
>>>
>>> Simon Drouin
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160509/3f8983fe/attachment.html>


More information about the vtkusers mailing list