Extracting C4D R15 f-Curve Mathematical function
-
On 19/03/2015 at 06:32, xxxxxxxx wrote:
Hi,
I've been working with C4D R15 doing some Python programming to create small tools for our specific applications, and have hit a wall with regards to the f-curves.
In an ideal world, I want to know the exact mathematical function that defines any given f-curvewithin C4D in order to do further derivations with it ( i.e. to obtain exact instantaneous velocity/acceleration ).
My colleague who is very knowledgeable in mathematics/physics combined with Python and C has created a piece of code that successfully re-creates the Bezier f-Curves shown in the open-source program Blender. ** ** This model matches the values in Blender exactly, but is still off from the C4D f-curve values to varying degrees, depending on the severity of the curvature.
So the questions I have are these:
How exactly are the splines used for C4D f-curve calculated differently than a standard Bezier? Are they in fact Nurb splines?This is my first post on any forum, so thank you in advance for your patience and help!
--AE -
On 17/04/2015 at 17:59, xxxxxxxx wrote:
Hi,
I can't tell you the exact curve maths, but when recently doing conversion between 3ds max materials specular and c4d spec ( pre-r16 ), because the falloff/curves were implemented differently ( even though for example they might both be Blinn ), i used one of the Wolfram calculators which allowed me to input various sample values for specular width which gave a corresponding visual result to the specular in Max.. It then spits out a formula which represents the curve mathematically. Once the sample values are put in you can try out some of the 'related queries' which pop up below the results, which might give a more useful result or even happen to be the actual one you are looking for exactly..
Not sure if the above is readable but here's a link to the Wolfram calculator i used:
-
On 02/05/2016 at 09:50, xxxxxxxx wrote:
I know it's a year later ... but just in case others stumble across this, I thought I'd close the loop with my findings (or lack thereof), because I've still been chipping away at it from time to time.
Thanks for the suggestion Eclectrik , but unfortunately my application/need demands that I can get the curves on the fly--it sounds like in your application that the curve would remain static once you dialed in your material needs.
Not surprisingly, the inner workings of the C4D timeline animation curves is proprietary (I had hoped it was a standard curve type, like those used in Blender), so unless one is actually developing C4D, you won't get access to formulaic representation of the motion curves. So I went down the path of estimating instantaneous velocity/accel based on the object's position.
However, I also hit a snag with this approach due to the fact that a scene has to be animated (refreshed) in order for the correct position values to be read. With Sebastian's help, I learned that my approach/thought process resulted in an infinite recursion by using a python tag (I run the script, which refreshes scene, which runs the script, which refreshes the scene, which ..... )
I'm still investigating storing the position values across time, so I'll update that other thread if I have some success--but the ideal method of leveraging the internal curves is closed for me.
--Marcus