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
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 , CATransform3D *t)
t->m11 = layerMatrix ;
t->m12 = layerMatrix ;
t->m13 = layerMatrix ;
t->m14 = 0.0;
t->m21 = layerMatrix ;
t->m22 = layerMatrix ;
t->m23 = layerMatrix ;
t->m24 = 0.0;;
t->m31 = layerMatrix ;
t->m32 = layerMatrix ;
t->m33 = layerMatrix ;
t->m34 = 0.0;
t->m41 = layerMatrix ;
t->m42 = layerMatrix ;
t->m43 = layerMatrix ;
t->m44 = layerMatrix ;
and when using Core Animation in an FXPlug the
.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
[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
NSTimeInterval 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.