[vtk-developers] [EXTERNAL] Software vs hardware interpolation

David Gobbi david.gobbi at gmail.com
Wed Mar 21 11:22:22 EDT 2012


Hi Thomas,

What mapper are you using?  The vtkImageMapper?  A vtkActor with a
vtkTexture?  Or a vtkImageActor?  All three use different OpenGL
paths.

>From your images, I'm going to guess, like Kenneth, that you are using
a vtkTexture.  If OpenGL only supports power-of-two textures, the
vtkTexture code will resample its input to the nearest power of two,
i.e. a 5x5 texture is resampled (in software) to 8x8.  If OpenGL
supports non-power-of-two textures, the 5x5 texture is displayed
directly.

Back when I used vtkTexture to display images (eight years ago or so),
I always padded my images up to a power of two and remapped the
texture coordinates, specifically to avoid this unwanted resampling
step in vtkTexture.  Afterwards, I switched to vtkImageActor which
handles non-power-of-two images just fine.  Recently, I wrote a whole
new set of image mappers which are included in VTK 5.10.

 - David


On Wed, Mar 21, 2012 at 8:21 AM, Moreland, Kenneth <kmorel at sandia.gov> wrote:
> I don't claim to be an expert here, but the interpolation method (nearest
> vs. linear) is controlled via an OpenGL flag to glTexParameter.  If VTK is
> not properly setting this flag, this could be a bug, but a look at
> vtkOpenGLTexture looks as if the flag should be set correctly.
>
> Traditionally (circa 15 years ago) the nearest lookup was considered faster
> and the linear lookup was considered more accurate.  Nowadays, graphics
> cards have special interpolating hardware in their texture units that allows
> them to do the linear interpolation with no extra time cost.  It could be
> that the driver for this particular hardware is doing the linear
> interpolation anyway since there is no added time cost.
>
> VTK has been dealing with rendering difference between software and hardware
> rendering as well as differences between different hardware architectures
> for, like, ever.  Thus, the VTK testing framework accepts multiple valid
> images for any test.  You just add image files with the same name but with
> _1, _2, etc. added to the filename.  (There are lots of examples in the
> existing baselines.)
>
> So, the easy solution is just to check in a new image into the baseline
> image repository.  The real question is, how much do you really care that
> you are getting linear instead of nearest interpolation?  Do you have a use
> case other than this pathological test?
>
> -Ken
>
> From: "Kilgus, Thomas" <t.kilgus at Dkfz-Heidelberg.de>
> Date: Wed, 21 Mar 2012 14:24:39 +0100
> To: "vtk-developers at vtk.org" <vtk-developers at vtk.org>
> Subject: [EXTERNAL] [vtk-developers] Software vs hardware interpolation
>
> Hi,
>
>
>
> as mentioned in my previous post
> (http://vtk.1045678.n5.nabble.com/software-rendering-td5557078.html ), I
> observed different interpolation behaviors in software and hardware
> rendering of images in VTK.
>
>
>
> Here you can see an example:
> http://cdash.mitk.org/testDetails.php?test=2749290&build=107877
>
>
>
> The test shows the result of an image rendered with software rendering. The
> input 5x5 pixel image is scaled (interpolated) to 8x8. If you render the
> same image with hardware support, a nearest neighbor interpolation will be
> applied and the result will look like the ValidImage on the bottom of the
> page. I don’t think that any interpolation can be considered wrong or right,
> but I think both, software and hardware rendering, should have a common
> default behavior.
>
>
>
> Please can anyone comment on this? Is there any possibility to enforce the
> same interpolation in software rendering? For reliable testing in different
> environments it is necessary both rendering methods act with the same
> default behavior, since it is not deterministic whether your machine is able
> to render with hardware support or with software rendering. (For instance a
> VPN connection established to a windows machine blocks the GPU for some
> reason, Virtual Machines show different behavior etc.)
>
>
>
> Regards
>
> Thomas
>
>
>
> _______________________________________________ Powered by www.kitware.com
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html Follow this link to
> subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list