Volumetric (Composition by cwright)

Author: cwright
License: (unknown)
Date: 2010.05.24
Compatibility: 10.5, 10.6
Categories:
Required plugins:
(none)

This is an example composition that performs a volumetric rendering. Unfortunately, since there's no 3D texture support in QC it just extrudes a 2D texture through space, which is kinda lame. Nevertheless, it's useful for visualizing how it might work, and can still work with texture atlases or procedural volumes.

This will absolutely murderalize your GPU if it's wimpy (since it does lots of texture reads in the fragment shader, a lot of fun driver bugs are exposed too -- my GMA950 simply gives up and dies, producing no output at all, for example). On non-pathetic systems though, it should perform decently (I get 30-60fps on my 8600, unless I pump the sample count up really high).

(PS there's a mini-cwright or mini-awright due out around late december, so expect me to refine this technique more over the next 7 months for some even more relevant volumetric visualizations ;) If anyone has experience parsing such file formats, I'd appreciate any pointers)

PreviewAttachmentSize
volumetric.qtz13.25 KB

cwright's picture
Re: Volumetric (Composition by cwright)

For GPUs that support it, you can set the Render In Image patches to use 32 bits per pixel for slightly better entry/exit vector positions.

toneburst's picture
Re: Volumetric (Composition by cwright)

Very cool. Did you ever see my version of this that used a 2D 'sprite sheet' to get around the lack of 3D texture support and render 3D volumetric datasets?

a|x

PreviewAttachmentSize
tb raycast liveinput 181109.qtz5.65 MB

bernardo's picture
Re: Volumetric (Composition by cwright)

did i get it right? if so congratulations, mine is 4 months

jersmi's picture
Re: Volumetric (Composition by cwright)

Such beautiful simple coding. Super cool.

Btw, what ever happened to the holy grail of extruded text?

gtoledo3's picture
Re: Volumetric (Composition by cwright)

This is a really interesting composition.

The only scenario this wouldn't really work for is in trying to decode to some kind of volumetric playback system, because you can't break up this image into slices in the Z axis, to then send to stacked screens/pixels/whatever.

This is really nice though... I get a bit of a twinkle at the edges of where the "cube(s)" lays after they combine in the GLSL. Is that from the aliasing of the cube images? (I'm in 10.5.8 right now...).

PreviewAttachmentSize
volumetric.jpg
volumetric.jpg41.27 KB

toneburst's picture
Re: Volumetric (Composition by cwright)

gtoledo3 wrote:
The only scenario this wouldn't really work for is in trying to decode to some kind of volumetric playback system, because you can't break up this image into slices in the Z axis, to then send to stacked screens/pixels/whatever.

See my method above for doing exactly that.

iSight input > 3D texture as 2D 'sprite-sheet' > raycast volume shader

a|x

cwright's picture
Re: Volumetric (Composition by cwright)

I think I saw it briefly -- we're using different names, but the same technique (I mentioned "texture atlases", you call them sprite sheets, but they're both just using 2D textures with several subimages to operate similar to a 3D texture, if I follow correctly).

The posted composition above has no provisions for it simply because I was tired and didn't want to try stitching together images for a better look :)

Thanks for your reference material!

cwright's picture
Re: Volumetric (Composition by cwright)

I poked briefly at extruding text for kineme3d, but it requires a ton of effort. I didn't have time to get anything working (ever in a rough, beta form) before relocating, and can't work on it anymore, so it's in smokris' hands now.

cwright's picture
Re: Volumetric (Composition by cwright)

I think a|x addressed the 3D stuff (and I mentioned it somewhat opaquely in the post itself).

Regarding the twinkle, I get that too, and I'm not entirely sure why (I made the entire composition in maybe 20 minutes late last night, and wanted to get to bed ;) -- it probably has something to do with using non-POT textures or texture filtering or something like that.

I'm experimenting a ton with shaders lately, so I try to post when something mildly interesting pops out to let everyone run with it :) rough edges included for free.

gtoledo3's picture
Re: Volumetric (Composition by cwright)

Yeah, I was referring to Chris's composition... but I guess this would apply to yours as well.

If you needed to grab from a screen, and send to many planes of video, or pixel lights, when you want to rotate, the rotation actually would have to be seen in the part of the setup that generates the "stack o slices", not the part that composites. So the part that creates the slices from an object, and then displays them in the column/row setup needs to be dynamic/interactive. For that kind of scenario, you don't even need to composite unless it's for previewing, because it's the playback engine (stacked screens, led strands or webs) that do the compositing (the part that the shaders are doing here).

gtoledo3's picture
Re: Volumetric (Composition by cwright)

The one thing about this setup, is that if it is because of the aliasing being different inside of both of those render in images, multisampling in SL won't help it. Maybe it would be interesting to try brute force AA to see if it cleans it up some.

I'm uploading a pic and qtz, of something weird I notice when I run the Kineme Textures to it (yeah, it's old, I know...). It gives a grayish background to the areas outside of the cube in some scenarios.

I thought this was an interesting article (kind of more in reference to the normal mapping stuff you've posted): http://graphics.cs.brown.edu/games/SteepParallax/index.html

toneburst's picture
Re: Volumetric (Composition by cwright)

I seem to remember I did the old supersampling trick to smooth the edges of the ray start/end textures (ie set the RII to render at twice the intended output dimensions, then scale them back down again). I was getting some sparkling around the edges too (you can see it at certain points in the clip below), so I eventually just put a stroke along each edge, which covered it up nicely.

a|x

toneburst's picture
Re: Volumetric (Composition by cwright)

cwright wrote:
I'm experimenting a ton with shaders lately, so I try to post when something mildly interesting pops out to let everyone run with it :) rough edges included for free.

Looking forward to seeing some of these :D

a|x

toneburst's picture
Re: Volumetric (Composition by cwright)

cwright wrote:
I think I saw it briefly -- we're using different names, but the same technique (I mentioned "texture atlases", you call them sprite sheets, but they're both just using 2D textures with several subimages to operate similar to a 3D texture, if I follow correctly).

Sorry, I missed that bit in your original post. I should start calling them 'texture atlases' too. I was thinking of the sprite sheets they used to use in 2D computer games (and still use in web and desktop UI design, I believe), which look similar, though their function is different.

Quote:
Thanks for your reference material!

No problem. No idea if it's the right way of doing things, I'd love to know what you think.

a|x

tobyspark's picture
Re: Volumetric (Composition by cwright)

Quote:
(PS there's a mini-cwright or mini-awright due out around late december, so expect me to refine this technique more over the next 7 months for some even more relevant volumetric visualizations ;) If anyone has experience parsing such file formats, I'd appreciate any pointers)

congratulations, and http://dm.ncl.ac.uk/joescully/index.php?/projects/ofxvoltron/

toneburst's picture
Re: Volumetric (Composition by cwright)

Hi toby- that looks cool. QC plugin, anyone?

a|x

dust's picture
Re: Volumetric (Composition by cwright)

yeah the ofx voltron looks interesting. hey toneburst any chance you have the medi scan file laying around that does this sort of thing from a contact or film strip ? i lost it this winter when my drive crashed. i really liked it.

toneburst's picture
Re: Volumetric (Composition by cwright)

Do you mean this stack-o-sprites one I did a while back?

a|x

dust's picture
Re: Volumetric (Composition by cwright)

yeah thats the one. i found it. got to love the meta links at the bottom. actually found one of mine as well. see pic...

PreviewAttachmentSize
Screen shot 2010-05-24 at 4.01.13 PM.png
Screen shot 2010-05-24 at 4.01.13 PM.png392.77 KB

vade's picture
Re: Volumetric (Composition by cwright)

Sure, but theres no source to download that I am aware of. ofxQCPlugin has had a lot of love, fixing lots of subtle OpenGL OF <-> QC gotchas, so 3D stuff now pretty much works out of the box, as long as you don't do anything too crazy.

cwright's picture
Re: Volumetric (Composition by cwright)

What fun is 3D in QC if you can't go crazy? ;)

vade's picture
Re: Volumetric (Composition by cwright)

Ha, I agree, but i meant go crazy in Open Frameworks. Their GL code is full of lots of holes, and lots of state "leaks" for lack of a better word :)

gtoledo3's picture
Re: Volumetric (Composition by cwright)

I'm posting this because texture atlases came up in this thread... I found this link for a plugin for GIMP that creates texture atlases. http://registry.gimp.org/node/20672

cybero's picture
Re: Volumetric (Composition by cwright)

I really like the way that one can get a sort of embedded in crystal set of reflections going with this composition by setting the Billboards to x,y 0 and lowering their colour opacity , set to Alpha and setting the samples used to a lower number and voila :-

When tracked / rotated, reminds me of those set in glass kind of toys.

PreviewAttachmentSize
grabvolumetric.png
grabvolumetric.png105.33 KB

toneburst's picture
Re: Volumetric (Composition by cwright)

Interesting...

I doubt QC can deal with this image format though.

a|x

cybero's picture
Re: Volumetric (Composition by cwright)

If you mean the GIMP plug in output [Interesting ...], the output is / can be .png & the texture atlas list can be re-used in other scripting / patch CI plugins.

toneburst's picture
Re: Volumetric (Composition by cwright)

Sorry, yeah, I meant the Gimp plugin. I forgot that if I answer a post before I've logged-in, my answer always ends up at the bottom of the thread.

a|x

gtoledo3's picture
Re: Volumetric (Composition by cwright)

Yeah, I know what you mean... the texture atlas part of the file likely isn't worth using too much in QC.