[vtkusers] Texture in a vtk file

Nico Zimmer nicozimmer at gmx.de
Fri Aug 26 11:14:56 EDT 2005


Hi,

 

we have a 3D model (STL-format) and also an image as JPG or BMP .

Goal is to write a vtk-file with the model and the texture information from
texture map (image).

First, is it possible? 

 

So what we do is:

 

//Poly data from the STLreader

vtkPolyData poly = new vtkPolyData();

poly = carTopSurface.STLReader(vData.get(number-1).toString()).GetOutput();

 

 

  vtkJPEGReader gifReader = new vtkJPEGReader();

                gifReader.SetFileName("C:\\test.jpg");

            

 

                        vtkTexture texture = new vtkTexture();

                        texture.SetInput(gifReader.GetOutput());

                        texture.InterpolateOff();

 

vtkTextureMapToPlane tPlane = new vtkTextureMapToPlane();

                        tPlane.SetInput(poly);

                        tPlane.AutomaticPlaneGenerationOn();   

 

vtkPolyDataMapper STLMapper = new vtkPolyDataMapper();

                        STLMapper.SetInput(tPlane.GetPolyDataOutput());

                        

                                               

                        carTop.SetMapper(STLMapper);

                        carTop.SetTexture(texture);

                        

                        vtkPolyDataWriter writer = new vtkPolyDataWriter();

                        writer.SetInput(STLMapper.GetInput());

                        writer.SetFileName("mix.vtk");

                        writer.Write();

 

The texture Coordinates are in the file, but how we can put the color
values from the image to the file?

 

THANKS

 

Nico 

 

 

Geoinformatik und Multimedia

 

Zeughausstraße 76

D - 26121 Oldenburg

 

Tel.:    (+49) 441 408 69 41

Mob.: (+49) 163 249 52 36

 

email: epost at nicozimmer.de

 

 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.15/82 - Release Date: 25.08.2005
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050826/1b8acada/attachment.htm>


More information about the vtkusers mailing list