OpenCL Script

mathieulesourd's picture

Hello,

I am wondering is there a way to convert a mesh or a 3D object into an openCl script? I am trying to make some morphing using the supershape sample, and I am interested in exploring other shapes.

// Sphere float4 kleinbottle( float u , float v ) { float4 vertex; float pv = (vPI); float tpu = (2u*PI);

vertex.x = sin(tpu)*sin(pv);
vertex.y = cos(tpu)*sin(pv);
vertex.z = cos(pv) ;
vertex.w = 1.0 ;

return vertex;

}

Also any ressources about openCl will be welcome.

Tks.

Mathieu

cybero's picture
Re: OpenCL Script

See http://t-linked.com/node/43 which goes some long way to achieving something of what you are interested in doing and other stuff besides. Otherwise, the answer isn't no, it will take coding up though. Different approaches suggest themselves. GL Interop to OpenCL for instance, though porting that to QC might prove difficult. Worth having a stab at though, I would have thought. Something could more quickly be done at the command line; then again, what about simply reading the structure from file and recreating the 3D object as a straight read write sampled structural set. Would need to ensure that the scaling was right, to cube or whatever means applies.

Should mention in regards of the node posted to tl_'s work, you'll need to update one of the OpenCL kernels, the one called main to a more sensible name, like meshprocessor or something, otherwise it won't run on later versions of OS X.

mathieulesourd's picture
Re: OpenCL Script

I found this interesting link about 3d Mathematics formula. http://local.wasp.uwa.edu.au/~pbourke/geometry/ I Will need to learn how to adapt it to OpenCl. Any documentation someone could recommend ?

Tks.

cybero's picture
Re: OpenCL Script

Documentation - try Apple's own, the Khronos site, examining the source of the many OpenCL examples posted upon Kineme would be a good 'read'. The node link posted above has a very effective implementation of various supershapes in OpenCL. There are other examples of morphing a mesh that have also been posted upon this forum.

dust's picture
Re: OpenCL Script

you can get at the mesh data via the get mesh component patch. i suggest looking at my patch save xml in the kineme repository it shows how to save a mesh verts down to file and recreate it from file verts.

http://kineme.net/composition/dust/savexmlplugin

also try looking at the mesh template this also shows you how to get at the mesh data so you can change it.