Archive for August, 2013

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

Comments (2)