Difference between revisions of "ParaView:Texture"
|Line 14:||Line 14:|
Revision as of 17:43, 28 August 2006
ParaView supports basic texture-mapping functionality. It allows you to load one or more images files and apply them as textures to datasets that contain texture coordinates. (ParaView contains filters to generate texture coordinates for datasets without them.)
In order to use texture mapping in ParaView, you must first load the image(s) you wish to use. Do this by selecting Load Texture from the File menu. This will display a file selection dialog. From it you may select a .bmp, .jpg, .png, .ppm, or .tif file to load.
Once the texture file has been loaded, go to the Display tab of the dataset you wish to texture map. If this dataset contains point-centered texture coordinates, there will be a Texture option in the Color by menu. Select this option, and the Texture menu button below the Color by menu will become enabled. The Texture menu contains a list of the texture files currently loaded in ParaView. Selecting one of these causes the dataset to be be displayed with the selected texture.
If the dataset you wish to texture map does not contain point-centered texture coordinates, first apply one of the following filters (from the Filter menu): Texture Map to Cylinder, Texture Map to Plane, or Texture Map to Sphere. Then you can apply texture mapping from the Display tab for that filter (or other filters further down the pipeline).
The results of texture mapping a sphere with a brick texture are shown below.
The following ParaView files were changed to implement this feature.
- GUI/Client/vtkPVDisplayGUI.cxx, .h: Create the Texture menu in the Display tab for each source, and populate this menu with the list of available textures.
- GUI/Client/vtkPVSource.cxx: Save texture settings in ParaView state file.
- GUI/Client/vtkPVWindow.cxx: Add the Load Texture option to the File menu, and create source proxies for the reader and the texture (set up as a mini-pipeline).
- GUI/Client/Resources/Filters.xml: Add the user-interface XML code for the vtkTextureMapTo* filters.
- Servers/Filters/CMakeLists.txt: Add the class vtkNetworkImageSource.
- Servers/Filters/vtkNetworkImageSource.cxx, .h: Add a class to decode the texture on the render server. In order to only need the image file containing the texture on the client, we use a vtkStructuredPointsReader to encode the vtkImageData in a binary string. This class (vtkNetworkImageSource) is then created on the client and each process of the render server. The encoded vtkImageData is passed to this class which decodes it. This class is used as the input to an instance of vtkTexture created on the client and each render server node.
- Servers/ServerManager/vtkSMDataObjectDisplayProxy.cxx, .h: Handle setting the texture on the vtkActor.
- Servers/ServerManager/Resources/filters.xml: Add the server manager XML code for the vtkTextureMapTo* filters.
- Servers/ServerManager/Resources/rendering.xml: Add server manager XML code for vtkTexture, and make it possible to call SetTexture on vtkSMDataObjectDisplayProxy.
- Servers/ServerManager/Resources/sources.xml: Add server manager XML for vtkNetworkImageSource.
- VTK/Graphics/vtkTextureMapToCylinder.cxx, vtkTextureMapToPlane.cxx, vtkTextureMapToSphere.cxx: Name the texture coordinates array.