More
See all Show me
24. Perlin Noise Raycasting on the GPU
7 months ago
23. GLSL Webcam Ripples
9 months ago
12. Processing - Grow Study
2 years ago
9. the nerd side of life
2 years ago
my dear flickr, vimeo and skype buddy Marcus Wendt made me curious about Raycasting so this is a very first try of Raycasting in GLSL. For the Data volume I simply used some 3D perlin noise. I think this method is really promising, since it is a lot easier to implement than marching cubes in my opinion and should have better realtime possibilities on up to date GPUs (which I don't really have right now).
I will propably work on this idea a little more serious when Macs snowleopard and OpenCL will be released.

this tutorial and a few papers I found online was really helpful:
daimi.au.dk/~trier/?page_id=98

Credits

16 Likes

Tags

  • FIELD plus 7 months ago
    alright now i see it. thx!
  •  
  • Lars Berg plus 7 months ago
    this looks great!
  •  
  • toneburst plus 6 months ago
    This is really nice. I'm trying to do something a bit similar myself, but rendering a different isosurface. For some reason, it's not working as it should though. Just wondering if you had to modify the code from Peter Triers' page a lot to get it to work.

    a|x
  • moka 6 months ago
    no, I didn't have to modify anything about the shader as far as I can remember. I think the bottleneck is to setup the 3D Texture correctly and to bind everything the shader needs the right way!
  •  
  • toneburst plus 6 months ago
    Ah, OK. I assumed you were rendering the noise texture in realtime, rather than dumping it into a static volume texture, then rendering that. I'm trying a slightly different tack- attempting a volume-rendering of an equation using the coordinates of the ray as it advances through the volume as input.

    The results I've been getting are definitely intriguing, but also definitely not quite right.
    Here's a couple of examples:
    machinesdontcare.files.wordpress.com/2009/06/tb_trier_borg_notright_01.png
    machinesdontcare.files.wordpress.com/2009/06/tb_trier_borg_notright_02.png
    machinesdontcare.files.wordpress.com/2009/06/tb_trier_borg_notright_03.png

    As you can see, the view through each face of the front-face cube looks OK, but doesn't match with the view through the other faces.

    Just out of interest, are you using a cube as the geometry to render the volume, or a plane? It seems unclear in Peter's writeup.

    Sorry for all the questions...

    a|x
  •  
  • moka 6 months ago
    Hey, I am using a cube, the trick was to draw it twice, once with backface culling and once with front face culling. I rendered one of those to a texture and the other one in the shader pass! If you would want to update the 3D texture and still want it to run realtime you should check out openGLs functionality to render to a 3D texture from a shader. Then you could make two shader passes, one to generate the 3D volume and one to render it!

    Your welcome!
  •  
  • toneburst plus 6 months ago
    Hi again moka.

    I got my shader working in the end. It's sort-of realtime (well on my ageing MacBook Pro, I get around 12fps at 640x360).

    Here's a couple of examples of it in action:
    vimeo.com/5181309
    vimeo.com/5181078

    You're right though, I imagine separating the texture-creation and rendering steps would probably speed things up. Unfortunately, I'd need to create a custom OpenGL plugin for Quartz Composer to be able to deal with 3D textures. It's something I'm planning, but I'm not there yet.

    I'll have to look into using a cube to render the volume again. It wasn't working for me last time I tried, so ended-up rendering to a quad, and taking the frontface and backface-culled textures as inputs to the shader.

    There's potential for more fun with this one, I think :D

    a|x
  •  
  • toneburst plus 2 months ago
    Did you every try this in OpenCL? I updated to Snow Leopard recently, and have been tinkering with the OpenCL patch in Quartz Composer 4. Maybe this could be done there...

    a\x
  • moka 2 months ago
    hey, unfortunatelly I still only have my first generation mac book pro with only leopard, so openCL is out of reach right now. I will propably buy a new one as soon as there will be new ones in a few month :)

    But generally you are right, openCL should be great to give it another try. even though I dont think it will be a big difference since its on the GPU allready anyways. The biggest benefit is propably that you can program more in a c style way, since you have easy access to all the pixels and rays while in the shader you can only acess the current pixel/fragment at a time without knowing whats going on around it (unless you have some kind of texture to sample from).
    I am currently working on someother realtime rendering stuff and actually I am looking alot more forward to an openGL 3.0 implementation on mac than using openCL :)
  •  
  • toneburst plus 2 months ago
    I must admit, lack of OpenCL support was one of the reasons I decided to upgrade my 1st-gen MacBook Pro this Summer. I'm glad I did, despite niggles like the lack of an Expresscard slot (no biggie, really, as I never used the one on the old machine), and, more annoyingly, the lack of composite/S-Video out (I used to use the old machine as a video-player, connected to my TV).

    My experience so far of using OpenCL in Quartz Composer has been mixed, I must admit. I'm intrigued by the possibilities, but it's flakey in Snow Leopard at the moment. I've been getting lots of crashes, quite a few of which have been of the nasty kind, requiring a hard-shutdown.

    I'm going to try and emulate some of the things I used to do with GLSL shaders, so I can make some kind of meaningful A/B comparison in terms of speed.

    What's the deal in terms of OGL 3 on the Mac? I was hoping for some kind of Geometry Shader patch in QC 4, but no such luck, sadly....


    a|x
  • moka 2 months ago
    well geometry shaders are also not in the core of openGL 3.0 but I did some experiments (yes, they even work on my old machine, slow though) and I have to say that they are pretty disappointing because it is neither useful to output alot of triangles, nor faster in doing anything you could do in the vertex shader. I am looking forward to alot of other things though which include:

    1. better Multisampling on an FBO (GL EXT framebuffer multisample) for anti aliasing in an deferred renderer for instance.
    2. GLSL #130
    3. alot of useful extensions in the core
  •  
  • toneburst plus 2 months ago
    I've not really looked at GLSL #130 yet. I wonder if it's much different from the current version.

    a|x
  •  
  • toneburst plus 19 days ago
    You might be interested in the camera input-as-volume raycast setup I've been tinkering with. I managed to work around Quartz Composer's lack of 3D texture support.

    a|x
  •  
This conversation is missing your voice. Take five seconds to join Vimeo or log in.

Advertisement

Statistics

  •  
    plays
    likes
    comments
  • Total
    plays 852
    likes 16
    comments 13
  • Dec 7th
    plays 3
    likes 0
    comments 0
  • Dec 6th
    plays 9
    likes 0
    comments 0
  • Dec 5th
    plays 2
    likes 0
    comments 0
  • Dec 4th
    plays 2
    likes 0
    comments 0
  • Dec 3rd
    plays 4
    likes 0
    comments 0
  • Dec 2nd
    plays 7
    likes 0
    comments 0
  • Dec 1st
    plays 7
    likes 0
    comments 0
  • Nov 30th
    plays 4
    likes 0
    comments 0
Previous Week

Downloads

Please join Vimeo or log in to download the original file. It only takes a few seconds.