Fwd: Fwd: [vtkusers] Texture Mapping Problem....Please Help !!!!!

Deepak Roy cdeepakroy at gmail.com
Tue Jan 17 18:50:13 EST 2006


---------- Forwarded message ----------
From: Deepak Roy <cdeepakroy at gmail.com>
Date: Jan 17, 2006 5:49 PM
Subject: Re: Fwd: [vtkusers] Texture Mapping Problem....Please Help !!!!!
To: Ankur Deshmukh <adeshmuk at uccs.edu>

Hey Ankur,

I am not sure, on to what geometry your are trying to map your texture. And
also whether you are repeating the texture all over your medical dataset.

I'll go ahead and describe what i did in my case. Hope it is of some help to
you.

My geomtery is a Triangular mesh - an open surface representation of a Human
Body. It is initially in the form of a VRML file and i have written custom
vtkPolyDataSource Filter that gives me a vtkPolyData of the surface geometry
i have.

Once this is done, here is the pseudocode i followed:

****************************************************************************************************************************

vtkPolyData *pVtkMesh = FromVrmlFile( <vrml-model-file> );

// create mesh polydata mapper

vtkPolyDataMapper *pMeshMapper = vtkPolyDataMapper::New();

pMeshMapper->SetInput( pVtkMesh );

// read texture image from file

vtkImageReader2Factory *pImageReaderFactory = vtkImageReader2Factory::New();


vtkImageReader2 *pTextureImageReader = vtkImageReader2::New();

pTextureImageReader =
pImageReaderFactory->CreateImageReader2(strTextureFile);

pTextureImageReader->SetFileName(strTextureFile);

// build texture

vtkTexture *pModelTexture = vtkTexture::New();

pModelTexture->SetInput( pTextureImageReader->GetOutput() );

pModelTexture->InterpolateOff();

pModelTexture->RepeatOff();

// create and setup actor

vtkActor * pTorsoTextureActor = vtkActor::New();

pTorsoTextureActor->SetMapper( pMeshMapper );

pTorsoTextureActor->SetTexture( pModelTexture );

*************************************************************************************************************

Regards,

Deepak














On 1/17/06, Ankur Deshmukh <adeshmuk at uccs.edu > wrote:
>
> Hey Deepak,
>
> I am having problems with mapping my texture to a medical data set. I
> was wondering if you could send me your code on how you have achieved
> the texture mapping.
>
> Thanks
> Ankur
>
> Deepak Roy wrote:
>
> > Hello Marc,
> >
> > Seems like a lot of mutually benefiting discussion. I like it.
> >
> > Infact i was looking for a way to play with the clamping and
> > interpolation options of the texture in VTK. But i found no way to do
> > this.
> >
> > All vtkTexture provides us is Interpolate On/Off and Repeat On/Off.
> >
> > Do you know how to change the way the texture interpolation is done.
> >
> > I hope this might solve my problem.
> >
> > Eagerly waiting for your reply .....
> >
> > Regards,
> >
> > Deepak
> >
> >
> >
> > On 1/17/06, *Marc Cotran* < marc at cotran.ca <mailto:marc at cotran.ca>>
> wrote:
> >
> >     Hi Deepak,
> >
> >     Quick question: does using Flat interpolation instead of Gouraud or
> >     Phong get rid of the cracks?
> >
> >     It does for me...
> >
> >     Marc
> >
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >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
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060117/0354ad6b/attachment.htm>


More information about the vtkusers mailing list