Python How To
Often you just need a "pointer" to an example that shows you how to do something.
Here are some snippets and examples that highlight interesting features that may help you:
Callback
Example Name | Comments | Image |
CallBack | Setting up a callback with client data. Two different methods are demonstrated. | |
| | |
Camera
Check the VTK Version
Example Name | Comments | Image |
CheckVTKVersion-Snippet | Check the VTK version returning True if the requested VTK version is >= the current version. | |
CheckVTKVersion-Example | Check the VTK version and provide alternatives for different VTK versions. | |
Coloring
Example Name | Comments | Image |
ShareCamera | Store background colors in a vector for later extraction of the red, green and blue components. | |
| | |
Glyphing
Image
Example Name | Comments | Image |
WriteImage | Write out an image of various types. | |
Multiple view ports and render windows
Physically Based Rendering
Physically based rendering sets metallicity, roughness, occlusion strength and normal scaling of the object. Textures are used to set base color, ORM, anisotropy and normals. Textures for the image based lighting and the skymap are supplied from a cubemap.
Image based lighting uses a cubemap texture to specify the environment. A Skybox is used to create the illusion of distant three-dimensional surroundings.
The results can be quite spectacular, it is hoped that these examples will help you to get started.
Example Name | Comments | Image |
PBR_Anisotropy | Render spheres with different anisotropy values. | |
| | |
PBR_Clear_Coat | Render a cube with custom texture mapping and a coat normal texture. | |
| | |
PBR_Edge_Tint | Render spheres with different edge colors using a skybox as image based lighting. | |
| | |
PBR_HDR_Environment | Renders spheres with different materials using a skybox as image based lighting. | |
| | |
PBR_Mapping | Render a cube with custom texture mapping. | |
| | |
PBR_Materials | Renders spheres with different materials using a skybox as image based lighting. | |
| | |
PBR_Materials_Coat | Render spheres with different coat materials using a skybox as image based lighting. | |
| | |
PBR_Skybox | Demonstrates physically based rendering, a skybox and image based lighting. | |
| | |
PBR_Skybox_Texturing | Demonstrates physically based rendering, a skybox, image based lighting and texturing. | |
| | |
PBR_Skybox_Anisotropy | Demonstrates physically based rendering, a skybox, image based lighting, and anisotropic texturing. | |
| | |
Polydata
Example Name | Comments | Image |
ReadPolyData | This snippet works for most PolyData. | |
Random
If you want to ensure that the same random points/colors are used in C++ and other languages then it is best to use vtkMinimalStandardRandomSequence.
Render Windows
Example Name | Comments | Image |
Model | Multiple render windows. | |
| | |
Searching for relevant examples?
Example Name | Comments | Image |
SelectExamples | Given a VTK Class and a language, select the matching examples. | |
StructuredDataset
How to visualise the information in a structured dataset. All these examples use the combustor dataset.
Example Name | Comments | Image |
CombustorIsosurface | Generate an isosurface of constant flow density. | |
| | |
CutStructuredGrid | Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used. | |
| | |
ProbeCombustor | Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter. | |
| | |
PseudoVolumeRendering | Here we use 100 cut planes, each with an opacity of 0.05. They are then rendered back-to-front to simulate volume rendering. | |
| | |
Rainbow | Using different vtkLookupTables. | |
| | |
StreamLines | Seed streamlines with vectors from a structured grid. | |
| | |
StreamlinesWithLineWidget | Interact with the streamlines in the combustor dataset. | |
| | |
VelocityProfile | Warping the geometry of three planes to show flow momentum. | |
| | |
WarpCombustor | Carpet plots of combustor flow energy in a structured grid. Colors and plane displacement represent energy values. | |
| | |
Example Name | Comments | Image |
Frog | This code uses a general way of specifying transformations that can permute image and other geometric data in order to maintain proper orientation regardless of the acquisition order. See the class SliceOrder . | |
| | |