[vtkusers] Multiple texture mapping

Wes Turner wes.turner at kitware.com
Wed Jan 9 16:03:39 EST 2008


Tolga,

I believe VTK only supports a single texture per object.  If you want to
apply multiple textures you have a few choices.  A simple way if your
textures don't overlap, is to just make multiple copies of the object and
texture each with a different texture.  By placing a transparent border
around your texture and setting the texturing parameters correctly, you can
get a reasonable appearance.  If this doesn't meet your needs, you have 2
other approaches.  The first is to find a way to divide your object up into
multiple objects each with its own texture, or you need to find a way to
create a single texture map from your multiple individual images.  For the
former, look at:
*
*W. Turner, T. Drake, M. Osterkamp, D. Kaiser, J. Miller, P. Tu, C. Wilson,
*Using computer vision to map LASER ultrasound onto CAD geometries, *Review
of Quantitative Nondestructive Evaluation, 22, American Institute of Physics
(2003)

and for the latter look at:

ROCCHINI, C., CIGNONI, P., AND MONTANI, C. Multiple textures stitching and
blending on 3d objects. In Eurographics Rendering Workshop 1999 (June 1999),
Eurographics. http://citeseer.ist.psu.edu/rocchini99multiple.html


On 1/9/08, Tolga Birdal <tbirdal at gmail.com> wrote:
>
> Hello,
>
> I am currently trying to form a 3D object from OBJ files. What I would
> like to do is to map multiple textures on the object. I know that the
> texture coordinates are in vtkPolyDataMapper but I couldn't make use of
> it. vtkImageAppend simply didn't work well. There are different textures
> for different places on the object.
> Is this supported in VTK?
>
> So far, I could only load a single texture using vtkTexture. Here is the
> code (The code is written in C# but exactly same with C++):
>
>             vtkOBJReader vo = new vtkOBJReader();
>             vo.SetFileName(@"C:\Objs\idle.obj");
>             vo.Update();
>
>             vtkPolyDataMapper stlMapper= new vtkPolyDataMapper();
>             stlMapper.SetInput(vo.GetOutput());
>
>             stlActor.SetMapper(stlMapper);
>
>             vtkJPEGReader bmp1 = ReadTexture(@"C:\Objs\idle_hi.jpg");
>
>             //other textures to load
>             //vtkJPEGReader bmp2 = ReadTexture(@"C:\Objs\idle_L_hi.jpg");
>             //vtkJPEGReader bmp3 = ReadTexture(@"C:\Objs\idle_R_hi.jpg");
>
>             vtkTexture vt = new vtkTexture();
>             vt.InterpolateOn();
>
>             vt.AddInputConnection(bmp1.GetOutputPort());
>
>             stlActor.SetTexture(vt);
>
>             vtkRenderer ren1 = new vtkRenderer();
>             ren1.AddActor (stlActor);
>             vtkFormsWindowControl1.GetRenderWindow().AddRenderer(ren1);
>             vtkFormsWindowControl1.GetRenderWindow().Render();
>
>
> And here is the ReadTexture method:
>
> private vtkJPEGReader ReadTexture(string fn)
>         {
>             vtkJPEGReader v = new vtkJPEGReader();
>             v.SetFileName(fn);
>             v.Update();
>             return v;
>         }
>
> Thanks for any help,
> Tolga
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Wesley D. Turner, Ph.D.
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x120
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080109/bc936b2e/attachment.htm>


More information about the vtkusers mailing list