Programming a 3d distance field plugin.

markus.helminen's picture

I would really like to get some fast marching cube and volume 3d action into quartz. The method would be this http://www.sintef.no/Projectweb/Heterogeneous-Computing/Research-Topics/... The source was released for osx this month. I compiled it and it runs like lighting compared to other similar methods. Without the support for GLSL stuff like geometry shader, texture3d and transform feedback the examples in the HPMC library seem a bit diffucult to implement in QC. Actually I was thinking trying just the metaballs example(using distance fields): http://www.youtube.com/v/HJSkNlxiYH0 I´ve seen some other really nice stuff made with distance fields from I.Quilez and others. Another example with raymarching distance fields I spotted the other day was http://www.youtube.com/user/2mindo#p/u/0/mG1Z38-GmZc that seemed to run smoothly. So I guess rendering with distance fields is good for realtime. With a custom plugin all this might be doable. Unfortunately it would be my virgin plugin and some help would be needed here. I was thinking if it is possible with the new quartz 4. I´m running on custom hackintosh system and havent had the time to install SL(it is a bit painful to get the all the custom kexts working..) so I dont know the new mesh system but my idea is to do a plugin that would feed the dynamic mesh data into a mesh renderer. Is this even possible? One other solution would be the meshdata through osc from another software into QC? And there is some documentation for cuda so opencl might work too.. Any help would be appreciated. :)

fsk's picture
Re: Programming a 3d distance field plugin.

this seems as a bit too much for a virgin plugin. i mean, the official plugin api doesnt let you make the new mesh ports. which means you would have to use the unofficial one (which is undocumented and only ever used by the smart people who made it;)) and figure out how to make the mesh port. i have no idea how you would achieve something like that, i just wanted to point out what kind of hurdles youd have to jump to get there.

toneburst's picture
Re: Programming a 3d distance field plugin.

I'm currenty looking into doing marching cubes in OpenCL. It seemed the next logical step from my volume raycasting experiments.

Not really sure how to go about it currently, but I've made a start on doing a version of Paul Bourke's C-code http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/

Will keep you posted on any progress.

a|x

toneburst's picture
Re: Programming a 3d distance field plugin.

Have you made any progress on this?

I've been 'marching through' my QC OpenCL version of Paul Bourke's C-code. It's been going pretty slowly though: with several hundred lines of code, the OpenCL patch editor slows to a crawl (to the extent it takes several seconds to type a single character), so it's slow and frustrating work. I've been pasting code back-and-forth between TextMate/TextWrangler and QC so I don't spend hours just formatting the code.

OpenCL Kernel language is VERY similar to C, syntactically, by the looks of it. The little differences do catch you out though, I've been finding (particularly as I haven't done any C for a lonnng time, and then only a very basic intro). Also, there seem to be all kinds of memory-related stuff that I probably should be aware of, but reading up a little on it, it's waaaaaaay over my head.

a|x