Volume Rendering application using CUDA toolkit 7.5 with OpenGL in Visual Studio 2013
- Need GLFW, stb_image, GLM, and GLAD.
- Add include folder with all .h files, lib folder with al .lib files and the .dll files in the root folder.
- Only volume raw file format supported by now.
The program can run without any parameters and will load a volume of size 256x256x256 located in "./RAW/volume.raw". Some parameters can be passed to the program in the following way:
$ program <volume_path> <width> <height> <depth> <bits> <scalex> <scaley> <scalez> <block_width> <block_height> [<transfer_func_path>]
where <volume_path>
is the path of the file containing the volume; <width>
, <height>
, and <depth>
the dimensions of the volume; <bits>
the number of bits per scalar (only 8 and 16 bits supported); <scalex>
, <scaley>
, and <scalez>
the scale of the volume in every direction; <block_width>
, and <block_height>
the number of threads per block and <transfer_function_path>
is the path of the file containing the initial set up of the transfer function. The last parameter is optional, in which case, the identity function is loaded.
The file has the following configuration:
<num_points>
<scalar_value0> <r> <g> <b> <a>
<scalar_value1> <r> <g> <b> <a>
...
<scalar_valueN> <r> <g> <b> <a>
where <num_points>
is the number of points indicated. Then, for each point there are four float values, indicating the scalar value ([0, 255]) and the corresponding RGBA normalized color ([0.0f,1.0f] ) for that scalar value in ascending order. Color for scalar values no indicated in the file are interpolated. At least the first (scalar = 0) and the last (scalar = 255) values must be indicated.
The following externa libraries/ projects were used in the develop of this program:
- GLFW 3.2, for OpenGL context and window management.
- glad, for OpenGL 4.5 extension loader.
- OpenGL Mathematics (GLM), as a mathematic library.
- STB Image 2.12, for image loading.
- CUDA Toolkit 7.5, to enable the use of CUDA.
To compile in Visual Studio, the header files must be put in a "include" folder as follows:
- VRCUDA/include/glad/ (glad files)
- VRCUDA/include/GLFW/ (GLFW files)
- VRCUDA/include/glm/ (GLM files)
- VRCUDA/include/KHR/ (file included with glad)
- VRCUDA/include/ (stb_image file)
The GLFW libs libraries must be set on a folder "lib" that must be organized as follows:
- VRCUDA/lib/x86/ (x86 libs)
- VRCUDA/lib/x64/ (x64 libs)
The project also uses a transfer function class that be obtained here.
The following is a screenshot of the program running: