[vtkusers] seam around texture

David Gobbi david.gobbi at gmail.com
Thu Jan 12 18:46:34 EST 2012


Hi Sebastien,

If you are displaying images on a plane (i.e. rather than on a sphere
or on some other shape), have you tried vtkImageActor?  The
vtkImageActor will automatically generate texture tiles if the input
image is too large to fit a single texture.

Also, if you are using the git (prerelease) version of VTK, then you
can use the vtkImageResliceMapper.  It performs all the interpolation
operations on the CPU, which is a lot faster than you might think, and
this means that the size of the image is not limited by GPU memory at
all.

For tiling textures directly (as you have been attempting) you must be
very careful about the edges because of the way the GPU deals with
texture borders.  With textures, the "support region" for bilinear
interpolation is a 2x2 patch, and this means when the edge of the
texture is displayed, the interpolation requires the use of "border
pixels" which are one pixel beyond the edge of your texture.  I won't
go into this in detail because the online OpenGL guide describes it
well.  But the solution is to make sure that each of your "tiles"
shares one row of pixels (i.e. along the edge) with the adjacent tile.
 Then your texture coordinates at the corners of your planes be set so
to 0.5/N (where N is the texture width) at let left and at (1.0 -
0.5/N) at the right.  Se each "seam" cuts a row of pixels down the
middle, and these seams should be invisible if your geometry is set
correctly.

But as I mentioned before, vtkImageActor does tiling automatically,
and vtkImageResliceMapper displays images in such a way as to make
tiling unnecessary.

 - David



On Thu, Jan 12, 2012 at 4:21 PM, Sebastien <sebastien.calvi at yahoo.com> wrote:
> Hello all,
>
> I am pretty new with vtk and I am having issues with the handling of
> textures. I create a bunch of images through the Qt library (QImage) that i
> want to tile on a plane in a 3D space. So far it works but I am not happy
> with the result because I have seam all around my actors loaded with the
> textures, OR, if I set my texture with "SetInterpolate( TRUE )" then I can
> see that there is no seam anymore but instead I can observe a sort of
> "shift" (horizontal and vertical) of about 1 pixel and this for all my
> actors (all the texture).
>
> I have done some pretty extensive research before writing this and I have
> found the following thread:
>
>
> /A few weeks ago, texture edge clamping was added to vtkTexture. If
> you are using the CVS head of VTK (as opposed to a stable release),
> you might try EdgeClampOn() + RepeatOff() on your texture.
>
>    David
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Matthias Riechmann
> [[hidden email]]
> Sent: Saturday, December 06, 2008 16:23
> To: [hidden email]
> Subject: [vtkusers] Seams in textures
>
> Hi,
>
> I applied a cylindrical texture mapping to a polydata in order to render
> a texturized object. So far it works quite well but at the border
> between the texture coordinates 1.0 and 0.0 there is some stragne
> behavior. The class vtkTextureMapToCylinder calls this "seam" and tries
> to solve this by adding a mirrored instance of the texture. But in my
> case I need to apply an exact texture without any mirroring and
> duplicating. Does VTK provide any way of solving this issue? Or do I
> have to accept this as a feature of VTK?
>
>
> Matthias
> /
>
> So, I have tried what is said above but with no success. Actually as soon as
> I switch to RepeatOff() my textures do not even look the same than when it
> is in repeat mode ON.
>
> I try to perform this "Tiling" operation because the image that I have to
> display might be pretty big (couple of MB...).
>
> so, how come one can see these seam around the actors?
> Why is there this mirroring effect on the very edge (2 in fact) of my actor?
> Am I being a bit too obstinate with my solution, is there a different
> approach to handle that?
> Can I use a texture of even big size or am I going to be limited? (I believe
> that there is limitations about size of texture...).
>
> Thank you for your help,
> Seb.
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/seam-around-texture-tp5141316p5141316.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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