[vtkusers] Per triangle texturing. Please help!!

Samuel Marcos godofredoiii at gmail.com
Wed Sep 5 06:43:50 EDT 2007


Ok, deepcopying the output of vtkTextureMapToPlane to a polydata, changing
polydata's point data and mapping that polydata works fine. The question is:
where are the texture coordinates saved to?  I printed  the  polydata copied
from vtkTextureMapToPlane but it has 0 Tcoords. However I map it with a
Polydatamapper and add it to an actor with a texture and it has the correct
texture coordinates of vtkTextureMapToPlane.

On 9/4/07, Wes Turner <wes.turner at kitware.com> wrote:
>
> You shouldn't change the point coordinates at the output of a filter ...
> the output is generated automatically based on the input to the filter and
> your changes will be lost the next time that the filter executes.  If you
> need to change the point coordinates, you need to first disconnect the
> output from the pipeline.  An easy way to do this is to declare a new
> PolyData and do a deep copy from the output of the filter into the new
> PolyData.  Once you do this, you should find that any changes you make to
> the new persist.
>
> - Wes
>
> On 9/4/07, Samuel Marcos < godofredoiii at gmail.com> wrote:
> >
> > Hi Tim, many thanks
> > I've read something similar in another thread. I've been trying to add
> > texture coords in a simple example using vtkjpegreader, but I don't get any
> > good results. What I do is to add Tcoords to a polydata, then map the
> > polydata whit a Polydatamapper and then add the mapper and a texture to the
> > actor. Is that correct?
> > Also I would like to keep the question of my first post hot: Is it
> > possible to change Polydata point values in a vtkTextureMapToPlane but
> > keeping the rest of the information?
> >
> > On 9/3/07, Tim Hutton <tim.hutton at gmail.com> wrote:
> > >
> > > Hi Godofredo,
> > >
> > > VTK doesn't support per-face texturing natively. You can get the same
> > > effect by splitting the vertices - duplicating them so that at a
> > > junction between e.g. 6 triangles, there are 6 vertices, all with the
> > > same spatial coordinates but different texture coordinates.
> > >
> > > If you look in vtkOBJReader that's the approach it uses where
> > > necessary, to read-in the OBJ format (which does support per-face
> > > textures).
> > >
> > > To manipulate the texture coordinates, just use
> > > my_polydata->GetPointData()->GetTCoords().
> > >
> > > Tim
> > >
> > > On 03/09/07, Godofredo < godofredoiii at gmail.com> wrote:
> > > >
> > > > Sorry for replying myself but I'm frustrated. Another question I
> > > have: Is it
> > > > possible to change Polydata point values in a vtkTextureMapToPlane?
> > > I've
> > > > tried doing:
> > > >  vtkTextureMapToPlane *planeMap = vtkTextureMapToPlane::New();
> > > > planeMap->GetPolyDataOutput()->SetPoints(vPoints);
> > > > Where vPoints is the new array of point values.
> > > >
> > > > But this doesn't seem to work at all.
> > > >
> > > >
> > > > Godofredo wrote:
> > > > >
> > > > > Hi. I'm trying to add texture to a region of a 3d polydata. The
> > > texture is
> > > > > a .jpeg file and the polydata is a triangulated point cloud. I
> > > would like
> > > > > to know if it's possible to manually assign a region of the .jpeg
> > > image to
> > > > > each triangle. I don't know if this can be done with the tcoords
> > > field.
> > > > > Any guidance will be apreciated as I'm a bit stuck. Many thanks in
> > > > > andvance
> > > > >
> > > >
> > > > --
> > > > View this message in context: http://www.nabble.com/Per-triangle-texturing.-Please-help%21%21-tf4371233.html#a12460175
> > >
> > > > Sent from the VTK - Users mailing list archive at Nabble.com.
> > > >
> > > > _______________________________________________
> > > > 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
> > > >
> > >
> > >
> > > --
> > > Tim Hutton - http://www.sq3.org.uk
> > >
> > > Take the Organic Builder challenge -
> > > http://www.sq3.org.uk/Evolution/Squirm3/OrganicBuilder/
> > >
> >
> >
> > _______________________________________________
> > 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/20070905/6510ff88/attachment.htm>


More information about the vtkusers mailing list