Warning, /geant4/examples/extended/visualization/vtk/README.md is written in an unsupported language. File is not indexed.
0001 \page Examplevtk Example vtk
0002
0003 This example demonstrates VTK visualisation driver. The code is based on
0004 the basic/B1 example, although the geometry has been modified. The physical
0005 example is a concerete dump, so a cuboid with a cylindrical hole removed.
0006
0007 VTK is a graphical pipeline (https://book.vtk.org/en/latest/VTKBook/04Chapter4.html#pipeline-design-and-implementation)
0008 based renderer.
0009
0010 VTK has some visualisation commands which are not applicable to all viewers,
0011 which currently include cutters, clippers and geometry overlays. The VTK commands
0012 are in vtk.mac and you can explore apply different VTK only commands.
0013
0014 A- VISUALISATION
0015 ================
0016
0017 This example is really for demonstration of VTK and so the easiest way to start with
0018
0019 ```
0020 % G4VIS_DEFAULT_DRIVER=VtkQt ./exampleVtk
0021 ```
0022
0023 or
0024
0025 ```
0026 % G4UI_USE_TCSH=1 G4VIS_DEFAULT_DRIVER=VtkNative ./exampleVtk
0027 ```
0028
0029 The event loop for the UI can be blocked by the VtkNative window. So if input events
0030 are captured by VTK, then the easiest way to exit from the viewer is to hit the 'q' button,
0031 then you are returned to the shell UI. To restart interaction then issue the command
0032
0033 ```
0034 Idle> /vis/vtk/startInteractor
0035 ```
0036
0037 B- USER INTERFACES
0038 ==================
0039
0040 VTK can be used in conjunction with all UI systems. If a shell UI is used event loop for the UI can be blocked
0041 by the VtkNative window. So if input events are captured by VTK, then the easiest way to
0042 exit from the viewer is to hit the 'q' button, then you are returned to the shell UI.
0043 To restart interaction then issue the command
0044
0045 ```
0046 Idle> /vis/vtk/startInteractor
0047 ```
0048
0049 C- HOW TO RUN
0050 =============
0051
0052 Starting with VTK
0053
0054 ```
0055 % G4VIS_DEFAULT_DRIVER=VtkQt ./exampleVtk
0056 ```
0057
0058 Executing VTK specific commands
0059
0060 ```
0061 Idle> /control/execute vtk.mac
0062 ```
0063
0064 There are various pipelines and the state of the pipelines can be
0065 displayed by issuing this command
0066
0067 ```
0068 /vis/vtk/printDebug
0069 ```
0070
0071 Pipelines can be switched during operation. This is performed by calling
0072
0073 ```
0074 /vis/vtk/set/polyhedronPipeline (append/tensor/bake/separate)
0075 ```
0076
0077 and then a subsequent
0078
0079 ```
0080 /vis/viewer/flush
0081 ```
0082
0083 There is significantly different performance between these pipelines. Append, tensor
0084 and bake are all designed for large models and high performance. Separate creates
0085 a pipeline for each polyhedron, each pipeline will ultimately end with a draw call.
0086 In general with modern pipelined shaders draw calls should be kept to a minimum.
0087
0088 For debugging the VTK viewer it is possible to place a head up display (HUD) which
0089 gives key information on the viewer performance. The HUD is enabled by issuing
0090
0091 ```
0092 /vis/vtk/set/hud 1
0093 ```
0094
0095
0096 Stewart Boogert
0097 7th November 2023