Using pyCuda, I am manipulating an N-dimensional scalar field. I would like to visualise this scalar field in real-time (i.e. rapidly and efficiently). I am thinking about using a marching cubes algorithm to draw 3D projections of isosurfaces, but I have been unable to find any good implementations / libraries that I can use from my pyCuda program. Any recommendations? Ideally, I would like the solution to be compatible with the other OpenGL plotting I am doing in the program.
Asked
Active
Viewed 571 times
1 Answers
2
A 3D scalar field can be interpreted as a volume image. There are several methods for direct volume rendering using OpenGL fragment shaders. Using the terms "OpenGL GLSL volume raycasting direct rendering" yields a lot of results. Essentially what you have to do is determine the entry and exit points of a ray corresponding to each screen pixel through the volume and iterate over all the samples in your scalar field, integrating them up.
A few links:
http://http.developer.nvidia.com/GPUGems/gpugems_ch39.html
http://sirkan.iit.bme.hu/~cseb/Education/ComputerGraphics/direct_volume_rendering_6.pdf
http://graphicsrunner.blogspot.de/2009/01/volume-rendering-101.html

datenwolf
- 159,371
- 13
- 185
- 298
-
This is very helpful. Thank you. I will focus now, not on isosurface generation, but direct volume rendering. I am still hoping though to not have to implement it myself. To have a rotatable volume render, it seems fairly involved to write the sampling algorithm (section 39.4.2 of [http://http.developer.nvidia.com/GPUGems/gpugems_ch39.html]), etc. If anyone knows of a existing shader code, please let me know! Many thanks! – weemattisnot Sep 21 '13 at 14:16
-
@weemattisnot: Actually the shader code is rather simple if you exploit certain capabilities of GPUs. I can't go into details here, as the whole realtime volume rendering subject touches what I do in my day job and there are certain confidentiality agreements I must not violate; I'm still trying to get a permission to release parts of the volume renderer I developed. But be assured that you can implement a high quality direct volume renderer in less than 70 lines of shader code plus less than 50 lines of OpenGL setup code. – datenwolf Sep 21 '13 at 16:59
-
I can post this picture as it was the result of just messing around: This is an example of a rendering produces by my renderer, where the data is just uninitialized GPU memory: http://dl.datenwolf.net/uninitialized_volume.jpg – it works in real time and can actually render volumetric movies. – datenwolf Sep 21 '13 at 17:01