Just posted the source on github to a small demo app demonstrating using an SCNProgram for alternate lighting models in SceneKit. GLSL shaders for Phong Point Light, Blinn, Edge Fuzz, EnvMap, Glossy Wet Highlight, Gooch, Hemishpere, Lamb Skin, Thin Film and Velvet lighting models included. Based on a Quartz Composer conversion of NVIDIA Samples from toneburst(machinesdontcare.wordpress.com).
Archive for Scene Kit
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
Scene Kit in Motion With Core Animation
[vimeo clip_id=’71203195′ width=’500′]
I’m having a lot of fun hacking on Scene Kit, a relatively new 3D framewok for OSX. Scene Kit is a nice high-level object graph, but it lets you drop down into shaders and OpenGL as needed. Because it plays nicely with Cocoa conventions you get a SCNRenderer
that speaks NSTimeInterva
l and fits in quite nicely in an FXPlug host. I still wish FCPX/Motion 5 hadn’t taken such a step back on user scripting and workflow tools, but you can see the bricks being built back up with a good solid foundation.
Permalink Comments off