The previous experiments with path animation in Papervision 3D were interesting, but of little practical use as very few applications generate path information programmatically at runtime. A more common workflow is to generate paths in a 3d application. The latest addition to the Singularity parametric curve library is a 3D Bezier spline that is suitable for working with cubic spline paths generated from other applications.
The 2D bezier spline took knots (or CV’s) as inputs and automatically generated tangents. The 3D version simply accepts CV, in-, and out-tangent information generated from a 3D package. To test this spline with 3ds max, I wrote a simple MAXScript to export spline data to XML. A Flex program reads the XML data (E4X is very cool) and transfers the data to the 3D Bezier spline. An example is shown below,
whose exported XML is
<spline name=’Line01′ knots=’7′ closed=’true’>
<knot x=’-123.018′ y=’53.5028′ z=’0.0′>
<invec x=’-154.627′ y=’16.1465′ z=’0.0′ />
<outvec x=’-91.4084′ y=’90.8591′ z=’0.0′ />
</knot>
<knot x=’-7.033′ y=’88.4169′ z=’-91.3649′>
<invec x=’-77.1479′ y=’83.8192′ z=’-91.3649′ />
<outvec x=’63.0819′ y=’93.0146′ z=’-91.3649′ />
</knot>
<knot x=’110.694′ y=’89.7132′ z=’0.0′>
<invec x=’80.1177′ y=’107.975′ z=’0.0′ />
<outvec x=’141.27′ y=’71.4514′ z=’0.0′ />
</knot>
<knot x=’161.098′ y=’-13.6597′ z=’0.0′>
<invec x=’166.459′ y=’30.5072′ z=’0.0′ />
<outvec x=’155.736′ y=’-57.8267′ z=’0.0′ />
</knot>
<knot x=’61.2687′ y=’-93.0454′ z=’-91.3649′>
<invec x=’100.924′ y=’-86.7235′ z=’-91.3649′ />
<outvec x=’21.6135′ y=’-99.3672′ z=’-91.3649′ />
</knot>
<knot x=’-49.5287′ y=’-89.2301′ z=’-91.3649′>
<invec x=’-2.977′ y=’-116.816′ z=’-91.3649′ />
<outvec x=’-96.0804′ y=’-61.6439′ z=’-91.3649′ />
</knot>
<knot x=’-154.02′ y=’-41.2029′ z=’0.0′>
<invec x=’-145.71′ y=’-73.8184′ z=’0.0′ />
<outvec x=’-162.33′ y=’-8.58747′ z=’0.0′ />
</knot>
</spline>
The online Papervision 3D demo contains two cameras. The first camera (static view) allows a marker to be visualized moving along the path. Since the Cubic Bezier spline supports arc-length parameterization, the marker moves along the path at constant velocity. The second camera is animated and looks at the origin from the point of view of the marker.
View the online demo here, which includes a link to download the Singularity package.
Will this be included in Papervision?
The 3D Bezier spline is still preliminary and the pipeline has only been tested with 3ds max. The code, however, is available for anyone to use, including the PV3D team 🙂
regards,
– jim
Hey Jim, thanks a lot for this example, it’s helped me tremendously with my camera animations. Unfortunately me and my colleagues aren’t working with 3dsmax, so the maxscript was no use. I was wondering however, why you chose to write a maxscript? After looking at your code I came up with this method to construct the spline data from a collada file itself:
And the (stripped down) example of the collada file:
I haven’t tested it with that many splines, but it worked for the bezier ones I’m using in the project.
Thanks, Eric-Paul.
I have an older version of MAX and can not work with Collada-MAX. It was a fun experiment.
regards,
– jim
very intrsting
I’m looking for a MaxScript like this … but I didn’t find it in the Singularity package? Is your script available?
https://algorithmist.wordpress.com/2007/09/18/spline-to-xml-maxscript/
regards,
– jim
Thanks for that link algorithmist 🙂