NVIDIA IndeX ParaView Plugin User Guide 5.8
NVIDIA IndeX ParaView Plugin User Guide 5.8
User’s Guide
7 February 2020
Version 2.4
NVIDIA IndeX for ParaView Plugin – User’s Guide
Cover page rendering: BigBrain Project, dataset courtesy by Prof. Dr. med. Katrin Amunts and
the Structural and Functional Organization of the Brain Lab at the Institute of Neuroscience
and Medicine, Research Centre Juelich.
Copyright Information
ii NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Building the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Location of the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Loading the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 Client-only mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Client-server mode on a single GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2.1 Client-server mode on multiple GPUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2 Networking parameters for NVIDIA IndeX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.2.1 Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.2.2 Networking options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.1 Structured and unstructred grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Transfer function and colormap changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 Region of interest changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5 High-quality rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6 Slice rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.7 NVIDIA IndeX visual elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.7.1 Isosurface preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.7.2 Depth enhancement preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.7.3 Edge enhancement preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.7.4 Gradient preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.7.5 Custom preset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.8 Time series animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.9 Catalyst and in-situ visualization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.10 Mixing ParaView primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5 Frequently asked questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6 Useful links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Appendix A Volume rendering tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
A.1 XAC purpose and program structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
A.2 XAC volume sample programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
A.2.1 Example program outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
A.3 Sampling a volume and map to a color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
A.4 Using XAC library functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
A.5 Add basic volume shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
A.6 Using CUDA parameter buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
A.6.1 Modifying the scene file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
A.6.2 Modifying the CUDA kernel file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide iii
iv NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
1 Introduction
The NVIDIA® IndeX™ for ParaView® Plugin enables large-scale and high-quality volume data
visualization capabilities of the NVIDIA IndeX library inside Kitware’s ParaView.
This document is intended for a Paraview user who is new to the IndeX plugin and wants
to explore the features of the IndeX library supported by the plugin. The following sections
will explain the installation procedure and various features the plugin supports, followed by
a section of frequently asked questions and useful links for further reference.
If you haven’t downloaded the plugin yet, you can do so from this URL:
http://www.nvidia.com/object/index-paraview-plugin.html
1.1 Licensing
The NVIDIA IndeX for ParaView plugin comes with a free license that enables exploiting the
capabilities of a single GPU. If you aim to use plugin on a cluster of multiple hosts and/or
with multiple NVIDIA GPUs, then please contact us for appropriate licensing via email to
[email protected]. Users will be notified via email whenever a new ver-
sion of the plugin is released.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 1
2 Installation
NVIDIA IndeX for ParaView plugin is delivered with ParaView v5.8.0 and supports both
Linux and Windows x86-64 platforms. Follow the installation instructions specific to your plat-
form and install ParaView.
If you have installed ParaView v5.8.0 or later from binaries, the plugin is already included and
you can continue to section 3.2, “Loading the plugin” (page 3).
mkdir paraview_build
mkdir paraview_install
cd paraview_build
ccmake ../paraview-source-root
PARAVIEW_PLUGIN_ENABLE_pvNVIDIAIndeX=ON
3. Run make or make install from your ParaView source tree. The plugin will be compiled
together with ParaView.
make paraview-binary-root
4. The plugin requires the NVIDIA IndeX libraries package. The package is not distributed
with ParaView sources but can be downloaded from the ParaView dependency reposi-
tory: https://www.paraview.org/files/dependencies/
Linux
Download nvidia-index-libs-2.4.<YYYYMMDD>-linux.tar.bz2 and
uncompress it to a folder of your choice. Update your LD_LIBRARY_PATH
environment with the library path of your newly created folder: new-folder/lib
Windows
Download nvidia-index-libs-2.4.<YYYYMMDD>-windows-x64.tar.bz2 and
uncompress it to a folder of your choice. Update your PATH environment with the
library path of your newly created folder: new-folder\lib
1. https://www.paraview.org/download/
2 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
2.2 Location of the plugin 2 Installation
2. https://www.paraview.org/Wiki/ParaView:Build_And_Install
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 3
2 Installation 2.3 Loading the plugin
Fig. 2.2 – Click Load New option and locate the plugin
4 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
2.3 Loading the plugin 2 Installation
Once the plugin is loaded, the name of the plugin shows up in the [ Tools ◮ Manage Plugins ]
dialog box with status changed as loaded. Make sure there no errors in the terminal or on Par-
aView’s console. Also, when using the plugin in client-server mode, be sure to load the plugin
in both client and server side of the [ Tools ◮ Manage Plugins ] window.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 5
3 Getting started
This section will describe instructions on how to use the NVIDIA IndeX for ParaView plugin
in both client-only and client-server mode.
Once pvserver process is launched, run the ParaView client and connect to the server where
pvservers are running by using [ File ◮ Connect ◮ Add Servers ] option in ParaView’s menubar.
Typically the server address is printed out in the console where mpirun was executed, once
the client-server is connected, console will update the status with “Client connected” message.
Make sure to load the plugin on both client and server side as described in section 2.
To verify that the plugin is installed correctly and loaded successfully in ParaView, please
create a Wavelet source by clicking the menu option [ Sources ◮ Wavelet ] in ParaView client.
6 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
3.2 Client-server mode on a single GPU 3 Getting started
Once you click apply an Outline representation will be shown in the viewport. Select RTData
as the scalar array from the dropdown box instead of Solid Color and NVIDIA IndeX instead of
Outline as the representation as shown below.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 7
3 Getting started 3.2 Client-server mode on a single GPU
When using multiple GPUs on multiple machines in a cluster environment MPI’s host-file
functionality can be used. For example, to utilize two machines with two GPUs each:
Where myhosts is a text file with list of host names where MPI will spawn pvserver instances.
Before connecting pvservers with ParaView client, please disable IceT compositing. This can
be done from ParaView client’s settings menu [ Edit ◮ Settings ◮ Render view ] and restart Par-
aView client.
8 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
3.2 Client-server mode on a single GPU 3 Getting started
Refer to this page 3 for more details about pvserver and running ParaView in client-server
mode.
cp plugin-directory/nvindex_config.xml ~/.config/ParaView/
If the directory ˜/.config/ParaView/ is not accessible, you can set the following environment
variable pointing to the nvindex_config.xml file:
export NVINDEX_PVPLUGIN_HOME=path-to-directory-with-config-file
3. http://www.paraview.org/Wiki/Setting_up_a_ParaView_Server
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 9
3 Getting started 3.2 Client-server mode on a single GPU
Each networking option is enclosed within a pair of XML tags and the file is enclosed within
<index_config> ... </index_config> tags.
3.2.2.1 Licensing
When you obtain a license for the cluster version of the plugin, you will receive a file named
license.lic. It contains the keys NVINDEX_VENDOR_KEY and NVINDEX_SECRET_KEY that can be
set as environment variables on all the hosts where NVIDIA IndeX is run.
export NVINDEX_VENDOR_KEY=vendor-key-here
export NVINDEX_SECRET_KEY=secret-key-here
Alternatively, copy paste those keys in the <license> section of the config file as show below.
<license>
<vendor_key>vendor-key-here</vendor_key>
<secret_key>secret-key-here</secret_key>
</license>
<cluster_mode>
your-networking-mode
</cluster_mode>
Tag <cluster_interface_address> defines the Network Interface Card(NIC) that is used for
communication between the nodes. On Linux, the ifconfig command gives the NIC address
as inet addr. If not set, any address is valid. The string may end with a colon character ( :
) and a port number to select which port to listen to for UDP and TCP. If no port is set and
unicast only mode is set, port 10000 will be used.
<cluster_interface_address>
172.161.123.0/24:10001
</cluster_interface_address>
Tag multicast_address defines the multicast address for the nodes to communicate. This is
valid only when cluster_mode is set to UDP.
<multicast_address>
224.1.3.2
</multicast_address>
Tag discovery_address defines the discovery address used for TCP cluster_mode.
10 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
3.2 Client-server mode on a single GPU 3 Getting started
<discovery_address>
224.1.3.3:5555
</discovery_address>
Tag <use_rdma> can be used to switch yes or no to use RDMA mode for networking.
<use_rdma>
no
</use_rdma>
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 11
4 Features
This section will provide a walk-through on individual plugin features.
12 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.2 Datatypes 4 Features
4.2 Datatypes
NVIDIA IndeX supports different datatype formats such as unsigned char, unsigned short and
floating point. Make sure appropriate byte endianness is chosen when loading unsigned short
and floating point datatypes otherwise your visualization might look like artifacts or even look
completely random.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 13
4 Features 4.3 Transfer function and colormap changes
Using the colormap editor user interface you can visualize parts of the dataset that is interest-
ing for you. This can be achieved by changing the colortable, by adjusting the transparency, or
by setting custom domain range values to isolate parts of the dataset that is uninteresting.
14 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.3 Transfer function and colormap changes 4 Features
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 15
4 Features 4.3 Transfer function and colormap changes
16 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.4 Region of interest changes 4 Features
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 17
4 Features 4.4 Region of interest changes
18 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.5 High-quality rendering 4 Features
There is no one filtering option optimal for all the datasets, each filtering option achieves dif-
ferent levels of quality with different datasets and transfer function combinations with nearest
neighbor interpolation being the most basic one. Some example images comparing different
filtering options are shown below.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 19
4 Features 4.5 High-quality rendering
20 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.5 High-quality rendering 4 Features
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 21
4 Features 4.6 Slice rendering
Fig. 4.18 – Slice rendering options through properties panel. Dataset is made available by Dr. Jackqueline Chen
at Sandia Laboratories through US Department of Energy’s SciDAC Institute for Ultrascale Visuaization.
22 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.7 NVIDIA IndeX visual elements 4 Features
Fig. 4.20 – Supernova SASI visualized as a volume. Dataset courtesy by Dr. John Blondin at the North
Carolina State University through US Department of Energy’s SciDAC Institute for Ultrascale
Visuaization.
24 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.7 NVIDIA IndeX visual elements 4 Features
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 25
4 Features 4.7 NVIDIA IndeX visual elements
Fig. 4.25 – CHOLLA galactic outflow simulation visualized as a volume. Dataset courtesy by Evan E. Schneider
(Princeton University) and Brant Robertson (University of California, Santa Cruz).
Fig. 4.26 – CHOLLA galactic outflow simulation visualized using gradient preset.
26 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.7 NVIDIA IndeX visual elements 4 Features
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 27
4 Features 4.7 NVIDIA IndeX visual elements
Fig. 4.27 – Custom preset: Floating point and integer parameters binding with XAC kernel program.
28 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.8 Time series animation 4 Features
Fig. 4.28 – BigBrain Project brain visualized with a custom preset. Dataset courtesy by Prof. Dr. med. Katrin
Amunts and the Structural and Functional Organization of the Brain lab at the Institute of Neuroscience and
Medicine, Research Centre Juelich.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 29
4 Features 4.9 Catalyst and in-situ visualization
Fig. 4.29 – Enable Cache Geometry for Animation and set a high value for cache limit
4. https://www.paraview.org/in-situ/
30 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
4.9 Catalyst and in-situ visualization 4 Features
As an example, a simple wavelet source can be used to illustrate the Catalyst integration with
NVIDIA IndeX rendering. Make sure you have compiled ParaView with Catalyst support be-
fore trying to do the live visualization.
You can start 50 iterations of a wavelet data source on a single process by running the following
command. Both CatalystWaveletDriver.py CatalystWaveletCoprocessing.py scripts are under
the directory ../Applications/ParaView/Testing/XML/ in ParaView source.
Next, start ParaView client and connect to the port where Catalyst is running from the menu
[ Catalyst ◮ Connect ].
./paraview
Once ParaView connects to Catalyst, enable "input" and click "Extract input" from the pipeline
browser. Once the input is extracted you can switch to NVIDIA IndeX representation from the
menu.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 31
4 Features 4.10 Mixing ParaView primitives
Fig. 4.32 – Wavelet data rendered as a Surface by ParaView and as a volume by NVIDIA IndeX
32 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
5 Frequently asked questions
Q: Do I need to install CUDA or any other libraries for using the plugin?
A: There is no need to install CUDA separately as the plugin package is bundled with all the
required libraries. However, you need to have an appropriate NVIDIA display driver for your
graphics card.
Q: When I load the plugin from ParaView’s [ Tools ◮ Manage Plugins ] window, libpvNVIDI-
AIndeX or pvNVIDIAIndeX does not show up as loaded.
A: Make sure you have no errors in ParaView’s console or on your terminal where you started
ParaView from. These error messages will give you additional information about what the is-
sue might be.
Q: Plugin is loaded successfully without any errors but NVIDIA IndeX as a representation
does not show up in ParaView’s representation dropdown box.
A: Make sure you have loaded a structured or unstructured volume grid dataset and it is
selected in ParaView’s pipeline browser, ParaView shows automatically representations based
on the input data format.
Q: There is an error saying “Failed loading NVIDIA IndeX library” and viewport is empty.
A: This error message is usually printed when NVIDIA IndeX library (in libnvindex.) is not
found. Make sure you have libnvindex. and libdice. in your LD_LIBRARY_PATH (or PATH on
Windows). You can also copy all the libraries from the plugin directly into ParaView’s library
directories. Refer section-2 for more information.
Q: Viewport is blank when I choose NVIDIA IndeX as a representation with a Scalar Array and
not with Solid Color
A: This is most likely because of an old NVIDIA display driver, update your display drivers
to the recommended versions.
Q: Can I render multiple volumes at once in the same scene graph in ParaView?
A: While the NVIDIA IndeX library itself supports multi-volume rendering, the ParaView
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 33
5 Frequently asked questions
plugin does not yet have this feature integrated so you can only render one volume at a given
time.
Q: What if I want to have a feature that is part of NVIDIA IndeX but not integrated in the
ParaView plugin?
A: Full set of NVIDIA IndeX features are described on this webpage.5 If there is a feature that
is important for you please contact us, we are happy to take workflow and feature requests.
5. https://developer.nvidia.com/index
34 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
6 Useful links
• NVIDIA IndeX for ParaView plugin website 6
• NVIDIA IndeX for ParaView plugin forum 7
• NVIDIA IndeX website 8
• ParaView binaries and source code download 9
• ParaView documentation 10
• ParaView user guide 11
• Contact email: [email protected]
6. http://www.nvidia.com/object/index-paraview-plugin.html
7. https://forum.nvidia-arc.com/forumdisplay.php?210-NVIDIA-IndeX-for-ParaView-Plug-in
8. https://developer.nvidia.com/index
9. http://www.paraview.org/download/
10. http://www.paraview.org/documentation/
11. http://www.paraview.org/paraview-guide/
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 35
Appendix A Volume rendering tutorial
This tutorial covers aspects of volume rendering using the NVIDIA IndeX Accelerated Compute
(XAC) technology. It dives into the structure of a basic CUDA-based XAC volume sample
program, how to access volumes, and how to use colormaps (or transfer functions). In addition
it shows how to customize programs and make use of CUDA buffer parameters to interactively
change properties of those programs.
36 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
Volume rendering tutorial Appendix A
Listing 7.1
using namespace nv::index; Include the default namespace (contains object and
using namespace nv::index::xac; helper classes)
public:
NV_IDX_DEVICE_INLINE_MEMBER
Initialization function
void initialize()
{
// initial setup...
}
NV_IDX_DEVICE_INLINE_MEMBER
Main rendering function (required)
int execute(
const Sample_info_self& input, Sample_output& out)
{
float4 color = make_float4(1.0f); Do some color computations here...
Add this code to the [ CUDA Code Editor ] panel and press the Compile button to update the
volume sampling program in the scene. Note that the XAC program has to be before the target
volume scene element to be executed.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 37
Appendix A Volume rendering tutorial
scene_position (float3)
Stores a reference to the scene position
ray_origin (float3) ray_direction (float3) ray_t (float)
Stores a reference the current view ray properties
The full XAC API is documented in the NVIDIA IndeX Programmer’s Manual.
To sample a given volume and map a color using the transfer function (or colormap), the
following lines have to be added to the execute() function:
Listing 7.2
NV_IDX_DEVICE_INLINE_MEMBER
int execute(const Sample_info_self& input, Sample_output& output)
{
const float3& sample_position =
Get current sample position
input.sample_position_object_space;
return NV_IDX_PROG_OK;
}
12. https://docs.nvidia.com/cuda/cuda-math-api/index.html
38 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
Volume rendering tutorial Appendix A
For example, to use a simple color gamma operations you can add the following lines to your
program:
Listing 7.3
float4 sample_color = Initialize the sample color using the volume mapping
colormap.lookup(sample_value); from before
Listing 7.4
float4 sample_color = Initialize a RGBA color (as four floats) reusing the color
colormap.lookup(sample_value); mapping
const float3 normal = -normalize(gradient); Get the iso-surface normal (in outward
const float3 view_dir = input.ray_direction; direction) and view direction
sample_color =
xaclib::headlight_shading( Apply built-in headlight shading and set the
state.scene, normal, view_dir, sample color
sample_color, specular_color);
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 39
Appendix A Volume rendering tutorial
Listing 7.5
Listing 7.6
NV_IDX_DEVICE_INLINE_MEMBER
void initialize()
{
const float* buffer = Bind input parameter buffer from
state.bind_parameter_buffer<float>(1); parameter slot 1 to the variable
input_value = buffer[0];
}
NV_IDX_DEVICE_INLINE_MEMBER
int execute(
const Sample_info_self& sample_info,
Sample_output& sample_output)
{
40 NVIDIA IndeX for ParaView Plugin – User’s Guide © 2020 NVIDIA Corporation
Volume rendering tutorial Appendix A
float4 modified_color =
make_float4(red, green, blue, alpha); Initialize a color and set color
modified_color = channels
xaclib::clamp(modified_color, 0.0f, 1.0f);
sample_output.set_color(modified_color);
Compute the output color
return NV_IDX_PROG_OK;
}
Note that the buffer type and structure has to be aligned in the scene file and the CUDA kernel
file. In the HTML5 viewer you can use the [ CUDA Parameter Panel ] to setup the values of the
parameters interactively.
© 2020 NVIDIA Corporation NVIDIA IndeX for ParaView Plugin – User’s Guide 41