Scientific Visualization, Time, and Fixed Frames

Regardless of a few complaints here and there about fixed frames, in my opionion Blender has performed very well for scientific kinematic modeling and visualization of meshed data. Most complaints about fixed frames are made without an understaning of numerical discretization, which is part of most high-end scientific calculations.

There are a few non-deal-breaker issues that I think should be addressed.

(1) Although Blender animation is based on fixed frames, ipo curves are a function of continuous Blender time which makes scientifc kinematic modeling and visualization possible (by insertion of ipo points with Python). However, the fixed-frame nature of Blender does involve one unfourtunate property:

One cannot access transformation matrices between frames even though ipo curves and points may be present at intermediate positions. The user must shift all ipo curves so that the intermediate point now lies on a frame. Then and only then is extracting intermediate rotation info possible (I think).

Is there a way to access intermediate rotation info that I am missing? I am looking for something like:

Blender.Set(‘curtime’, time)
rot_mat = obj.mat

How difficult would it be to add this in the source code? I have a feeling that it would not be too difficult since ipo curves are defined at all times.

(2) During shape key deformation, relative motion between points falls along a line that connects intial and final points. If the time step is too large, this linear interpolation may not be adequate for motion along a non-linear surface (e.g. a sphere). One workaround is to use smaller time steps between shape keys. However, it would be nice if motion could be non-linear. I would like to, for example, deform a spherical cap while having vertices stay at a constant distance from the center of the sphere. Any ideas?

(3) Blender needs Delaunay triangulation !!! Yes, I can use code from the web or write my own. Option 1 is associated with copyright issues beyond Blender. With respect to option 2, efficient and robust Delaunay is non-trivial and should be contained in the fast C-source. If delaunay triangulation was added to Blender, I think many more scientific modelers would be hooked!!! This would also be useful for artistic stuff as well.

Is that something like, finding what degree of turning something is doing. Say, I have a cube that turns right or left on the z axis, would what your talking about let me see what angle the y axis is at, at any given point along the rotation??

If so, hell yeah we do, I would love to have an Ipo that I can get rotational info from and apply another ipo based on the angle.

Thanks
Terry

(2) During shape key deformation, relative motion between points falls along a line that connects intial and final points. If the time step is too large, this linear interpolation may not be adequate for motion along a non-linear surface (e.g. a sphere). One workaround is to use smaller time steps between shape keys. However, it would be nice if motion could be non-linear. I would like to, for example, deform a spherical cap while having vertices stay at a constant distance from the center of the sphere. Any ideas?

You can blend shape keys using ipos, so any non-linear shape you can make with those is possible. I have a feeling I’ve misunderstood though, do you mean instead that when points move from A to B, they could, say move in a curve to do so?

afaik, the frame number is not integer, it can be anything. see example where the key for ‘frame’ 2.5 is retrieved. There is also a Time value that is now supplied with 2.45. http://www.blender.org/documentation/245PythonDoc/Ipo-module.html

(2) if the shape key is driven by an Ipo curve, then see above and problem solved.

PapaSmurf,
Thanks for the comments. I don’t think this will work for all cases (correct me if I am wrong). Let me begin by stating that quaternion rotations around poles (i.e. bones) represent Euler poles, which are commonly used to move objects on a sphere. Moving objects is done by parenting objects to bones. One commonly needs to get the ‘worldspace’ rotation matrix of the object, which includes QUAT_Y rotation around a bone.
How can one get the ‘worldspace’ rotation matrix at fractional times for an object that is parented to a bone that rotates via quaternion ipo curve parameters (not ROT_X, ROT_Y, ROT_Z ipo curves)? This is not as simple as
val = icu[2.5]
As I stated previously, since Blender ipo curves are based on time, I can create scientific models. This involves the following syntax:
icu[2.5] = some value
Also, as you mentioned I can get ipo info at any time. But what I need is a rotation matrix, a matrix that may or may not be easily extracted from ipo curve parameters. If I parent an object to a bone and rotate the bone via ‘local’ quaternion ipo parameters (Pose mode) how can get the ‘worldspace’ rotation matrix for the object? I do not have ROT_X, ROT_Y, ROT_Z ipo curves which I could use to calculate the rotation matrix at any time. I presently, do the following:
(1) Setup QUAT_W, QUAT_X, QUAT_Y, QUAT_Z, ipo curves for bone at any time
(2) Setup parent-child relationships with bone and objects
(3) Move to a certain point in animation via Set(‘curframe’, frame)
(4) Get object via obj = Object.Get(obj_name)
(5) Get rotation matrix via obj.mat
This only works at frames. I have to shift ipo curves to a frame to get fractional values.
Please send me any ideas or help me better understand how this can be done.
Thanks!

IanC,
Yes, I want some type of constraint so that vertices will always be a constant distance from the center a sphere.
Let’s say that I deform an object’s mesh via the rotate manipulator to get two key shapes with all vertices staying along the surface of a sphere: (1) base (2) new shape.
Now I make an animation via shape key ipo curves that will morph the base into the new shape over 100 frames (i.e. 0% to 100% of the new key shape over 100 frames).
You will see vertices fall below the surface of a sphere as deformation progresses. I need to perform this deofrmation an keep the vertices at the surface.
How can I do this? Can I use constraints?

as you know, indexes into lists cannot be floats, they are integers. I think what you want has been implemented here, where a Beztriple includes the spatial point, the triple that says how this point influences the curve, and the time value. see http://www.blender.org/documentation/245PythonDoc/BezTriple-module.html

That sounds like you are mixing two problems. Use rotation keyframes to control the rotation, and then shape keys for the deformation. Splitting the two is the only way I can see of doing this.

IanC,
I need to be a bit more clear. I am simply deforming a spherical cap with the rotate manipulator so that vertices always remain at the surface of a reference sphere. So there is only one problem of creating a basis shape key and shape key one. When blender does the interpolation (regardless of how you modify the shape key ipo curve). points do not stay at the surface of my reference sphere. Here is the problem step by step:
Shape key basis : undeformed spherical cap
Shape key 1: a deformed version of the spherical cap
Say your animation goes from frame 1 to 100, and shape key 1 ipo goes from 0% to 100% over this interval.
Points do not stay a constant distance from the center of a reference sphere for intermediate frames. How can I make these points stay a constaint distance from the refernece sphere during deformation?
Thanks for your help:)

What

When I make animations I actually use this Bezier triple functionality. I define all ipo curves this way so that I have total control. What I need is access to the rotation matrix for any object at any time between frames: Note that
val = icur[time]
gives ipo info, not a 4x4 matrix. Sometimes you can calculate the rotation matrix via ipo info (e.g. if you have Euler rotation parameters in an ipo curve). Complicated parent-child relationships and using quaternions makes this a bit more complicated. Keep in mind that you alwyas can extract the rotation matrix at frames for any object regardless of the complexity of the model.
Thanks:)

Yes, which is two separate problems. You need to rotate the object and deform the mesh. Deformations should be used for different mesh shapes, if you can simply move, scale or rotate the object then that should be done instead.

My solution:
Parent the cap to an empty which lies at the centre of the sphere (parent the empty to the sphere if you need to move the sphere). Parent the cap to the empty.

Then you can do the shape keys in place, and do the rotations with the empty.

If you only need to rotate, don’t use shape keys :slight_smile:

Hope this helps, if it’s not clear I can upload pics/blend files

IanC,
Ok I think I did not explain this very well. All rigid rotation is done in the way you describe. Rigid rotation is not the problem. For my problem I am deforming the cap. I need to deform parts of the spherical cap with shape keys. When I am in edit mode I create shape keys by selecting certain nodes and moving them on the surface of my reference sphere via rotate manipulators. Once I have my shape keys, I then make an animation of deformation using the shape key ipos. I need the ability to perform complex relative node deformation on a sphere.

I think I should make some pics as well.

Thank you for your help :slight_smile:

Thank you for your help

No worries, thanks for taking the time to explain an interesting problem.

AHHHH sorry, I think I see now. I thought you were rotating the entire cap and deforming parts of it. Now I think you are rotating PARTS of the cap, thus requiring you to use shape keys.

Ok, (this is the first time I’ve used this feature, it’s quite cool actually :slight_smile: )

Set up your shape keys as normal, then go to modifiers (in edit buttons [F9]). Set on cast, and sphere. You’ll want to manually set the “size”, and take off “from radius”. If you only want to affect a small amount of the verts, use a vert group.

This should do what you want (if my slow brain has finally understand what it is you want!!)

IanC,

This works at least in terms of appearence. This does not modify the actual coordinates of the mesh vertices which would be ideal. When I click apply I get a message stating that you can not apply modifiers to shape keys. However, this will certainly work. Thanks!!!

Never say never in Blender!

PS: Please keep an eye out for future posts :slight_smile:

No worries.

This works at least in terms of appearence. This does not modify the actual coordinates of the mesh vertices which would be ideal. When I click apply I get a message stating that you can not apply modifiers to shape keys. However, this will certainly work. Thanks!!!

Do you mean for editing purposes or for extracting the positions of verts through python?

If for editing, click the third button to the right of the name of the modifier, then the button that appears to the right of that.

Extracting via python. Is this possible?

Thanks again!

You can access all base vert positions easily, and I’m pretty sure you can access the fully modified + shape blended position too. I’ve never done this but I think it’s the case.

I typically process all verts via Python. I do this via
obj = Object.Get(obj_name)
me = obj.getData(mesh=1)
for v in mesh.verts:
x = v.co[0]
y = v.co[1]
z = v.co[2]

The coordinates at intermediate frames are not at a fixed distance from the center of the sphere even though they appear to be when using cast.

Let me know if you figure this out.

They’ll be the positions as stored in the mesh data. You have to make a new mesh and add them into that (at least in memory).

Based on a quicky search of the api… this seems to work:


from Blender import *
obj_name="Cube"
obj = Object.Get(obj_name)
me = Mesh.New()
me.getFromObject(obj.name)
for v in me.verts:
    x,y,z=v.co
    print x,y,z

That is the local co-ords, however. Any rotation and scaling isn’t taken into account, but shape keys are.

If you can grab the transformation matrix, though, you can just multiply to get the global coords (there may be a better way, in fact there probably is :slight_smile: )

IanC,

Cast and getFromObject() did the job. Issue (2) in the first post is solved. Thank you for your help:)