owlGlyphs: Sample Code for the "Ray Tracing Glyphs with RTX" Project
Context/Reference
This sample code is in regards to a project that used OWL to evaluate the feasibility and performance of RTX-Accelerated ray tracing for Glyph-based data visualization.
Citation for the corresponding paper:
Requirements/Dependencies
This project uses OWL, and should be checked out with owl as a
submodule. To do so, use the --recursive
flag when cloning this
repository; alternatively, if you forgot this you can also pull the
submodules via
git submodule init
git submodule update
which should also end up fetching the correct version of OWL.
To build, you also need the typical OWL dependencies, ie, a C++ 11 compatible compiler, CUDA, and OptiX (version 7 or newer). Both windows and linux should be supported.
Building
Using cmake, this project should build on both linux and windows. If you're not familiar with cmake, it is suggested to follow OWL's instructions to first build the samples that come with OWL, then repeat the same steps here.
Guide to the Source Code
The following files/classes implement the glyph types we presented in
the paper. FileName.h
and FileName.cpp
contain the OWL host code
and device/FileName.cu
contain the respective OptiX 7 device programs.
Arrow glyphs
This is an example of a non-affine glyph; i.e. the glyph cannot just be transformed with the instance transform, so the geometry is stored in extra buffers.
ArrowGlyphs.h ArrowGlyphs.cpp device/ArrowGlyphs.cu
Simple sphere glyphs
Sphere glyphs are "affine glyphs", i.e. under transformation they can become general ellipsoids and that behavior is desired
SphereGlyphs.h SphereGlyphs.cpp device/SphereGlyphs.cu
Motion blur glyphs
This is a sphere glyph, but the geometry of the glyph is non-affine, and instead it is spread out and blurred over the extent defined by its instance bounds according to the link velocity and link acceleration
MotionSpheres.h MotionSpheres.cpp device/MotionSpheres.cu
Super quadric glyphs
This is a more involved glyph that uses a Newton/Rhaphson solver to compute ray/superquadric intersections. The glyph types implements a trick, as it doesn't use the bounding box or bounding sphere as an initial root estimate, but rather a coarse tessellation. The intersection with that tessellation is computed using hardware-accelerated ray/triangle intersections.
SuperGlyphs.h SuperGlyphs.cpp device/SuperGlyphs.cu
Viewer Controls
After building is complete, you should end up with an executable
./owlGlyphs
or owlGlyphs.exe
.
Using the test data set from the root dir of this repo just start with
./owlGlyphs testdata.glyphs
.
Arrow glyphs: cmdline: --arrows | -arr |
Sphere glyphs: cmdline: --spheres | -sph |
Motion blur glyphs: cmdline: --motionblur | -mb |
Super quadric glyphs: cmdline: --super | -spr |
Keystrokes:
- ! : dump screenshot
- H : enable/disable heatmap
- </> : change heatmap scale up/down
- C : dump current camera
- +/- : change mouse motion speed
- I: enter 'inspect' mode
- F: enter 'fly' mode
Mouse:
- left button: rotate
- middle button: strafe
- right button: forward/backward
Third-Party Code
The owlGlyphs
program can optionally load triangle models in wavefront obj
format (cmdline: -obj <file.obj>
). For that we use
tinyobjloader which is
included as source code. Tinyobjloader's licence is
MIT
We use code for ray/quadric intersection testing by Inigo Quilez. Those tests can be found on shadertoy: ray/cylinder test, ray/rounded cone test. License is MIT