More Scene Kit/Motion integration: Models, Cameras, Lights, Transforms



Starting to make nice progress on integrating Scene Kit and Motion. I’m now able to use Motion’s 3d transforms, light and camera data.

A couple of gotcha’s, the matrix transform from the FxPlug Fx3DAPI needs to be remapped to work with a CATransform3D with something resembling the following.


void GLtoCATransform3D(double layerMatrix [4][4], CATransform3D *t)
{
t->m11 = layerMatrix [0][0];
t->m12 = layerMatrix [0][1];
t->m13 = layerMatrix [0][2];
t->m14 = 0.0;
t->m21 = layerMatrix [1][0];
t->m22 = layerMatrix [1][1];
t->m23 = layerMatrix [1][2];
t->m24 = 0.0;;
t->m31 = layerMatrix [2][0];
t->m32 = layerMatrix [2][1];
t->m33 = layerMatrix [2][2];
t->m34 = 0.0;
t->m41 = layerMatrix [0][3];
t->m42 = layerMatrix [1][3];
t->m43 = layerMatrix [2][3];
t->m44 = layerMatrix [3][3];
}

and when using Core Animation in an FXPlug the BOOL property .usesSceneTimeBase needs to be YES on the CAAnimation to work correctly in plugin time. That also means the duration property is in frames, not seconds

2 Comments »

  1. semafore said

    Nice work! Is the Generator you’ve created using the scene camera as the rendering projection, yet still exists in the scene as a “plane in space”? It looks as if the plane that you intersect with the bunny has alpha occlusion of the solid part of the bunny, while the intersection line shows it as a planar intersection.
    It looks great, and having the actual 3d object rendering inside the motion scene is really useful. Are you considering releasing this plugin through noise industries?

    • admin said

      Hey Semafore,

      Thanks for the comment. Good catch on on the projection, and I’ve not quite figured it out. Moving the scene camera seems to create a “space” in front of the plane and then as you cross the position of the plane things disappear etc. and I haven’t quite figured out a mental model of what’s going on.

      I haven’t really decided whether to treat my explorations as just a toy to play with, something to open source or something I can put some concentrated effort and make a useful tool and maybe try to charge a few bucks. I’m definitely open to ideas and input of what would make it cross the line between toy and useful production tool.

      Best,

      Dale

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>