Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How do frame interpolations work?

  1. #1
    Join Date
    Aug 2007
    Location
    Indianapolis, IN
    Posts
    196

    Default How do frame interpolations work?

    Hi,

    I've been looking at DAC SDKs and I understand how you create a static frame of X*Y points, send this to the DAC and get an output.

    How do laser shows transition smoothly from one frame to another? Do you have to interpolate all the points in SW and keep feeding frames to the DAC?

    Or is there another way?

    Steve

  2. #2
    Join Date
    Dec 2006
    Location
    Pflugerville, TX, USA
    Posts
    1,977

    Default

    What do you mean? Animations are just like cartoons. Each frame is a little different from the previous one.

    Interpolation is figuring a new point based on existing points and there are various formulas to do that.

  3. #3
    Join Date
    Aug 2007
    Location
    Indianapolis, IN
    Posts
    196

    Default

    In Mamba Black I can create a frame, put it on the timeline, then apply effects to it (X,Y,Z rotation). Is the software creating many frames and streaming them to the DAC?

    Or just sending information to render the single initial frame, then the rotations.

    If so, then what is the "framerate" of a USB DAC - 30fps?

  4. #4
    Join Date
    Dec 2006
    Location
    Pflugerville, TX, USA
    Posts
    1,977

    Default

    Yes, new frames are created. Probably using matrix transforms. That is how I do it in my software, at least.

    Framerate depends on how fast the frames are drawn and whether there is any repeating of the frames. It doesn't really have as much to do with the DAC as the software sending to the DAC.

  5. #5
    Join Date
    Jan 2006
    Location
    Charleston, SC
    Posts
    2,147,489,446

    Cool

    Mamba Black defaults to 25 frames per second, although you can set that to a different value when you start a new show. (Or, at least you used to be able to. I haven't downloaded any of the updates since about February '07 or so, so I'm not sure what has changed.)

    But yeah, the software is performing the interpolation for you when you apply a rotational effect (or any other effect, for that matter). If you want to see each one of those tweened frames, you can save the output of the show to one big ilda frame file. The resulting file will be huge (25 individual ilda files for every second of show time), but it will contain each and every frame that was sent to the galvos, including the ones that the software had to interpolate for you.

    Adam

  6. #6
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    When I tried to write some simple scan stuff in Lua (write to WAV file, play through sound card), I made a small frame buffer, just an array. It could be of arbitrary size, and I found that rotations would best work if each point were incremented for both axes to get the rotation adjustment. The result was VERY smooth. Could be fun trying to work out just how much increment was needed in points forming anything other than regular polygons, but I didn't get that far before I turned to other stuff. I did actually go one step further, an animated clock hand, but complex images would have to have each point adjusted according to it's timing, not some regular step as I was using. Probably dead simple though, if you have a fixed frame rate. If you don't, things really get awkward, probably. And I didn't want one. I wanted my idea to be able to make shows the way some music is written without bar lines.

  7. #7
    Join Date
    Dec 2006
    Location
    Pflugerville, TX, USA
    Posts
    1,977

    Default

    What do you mean by incrementing points? You kind of lost me.

    My software allows for rotating any frame on the X, Y, and/or Z axis. I just compute a rotation matrix for each of them and then transform the original points by the matrix or matrices and I get what I need. The hard part was creating a clipper that would fix the frame if there were points outside of the -32768 to 32767 boundary. Basically I had to compute the vector line equation and then truncate the vector at the edge boundary and then add points and blanking as needed. Took me a few tries to get it right but the result was worth it. I can spin and zoom in and everything looks correct. I never thought I would use this math when I learned it in college.

  8. #8
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    I guess if the rotation matrix gives references for adjusting each point's real position at the moment it must be drawn, it works as I imagine it should.

    By 'incrementing' I meant on a point by point basis, not the whole frame. With regular polygons drawn at high speed and also rotated fast, you get a visible error if you draw one polygon, then draw again with the next rotational adjustment. To do it fluently, the rotation adjustment is shared across all points, minimising changes so they are not individually visible. For simple regular forms this adjustment can be spatial, a simple division of shape rotation by number of vertices in the shape, but for image frames it should be temporal, and make what adjustment is needed at the required moment by looking up a free-running rotational system for references. I guess that's what your rotational matrix is?
    Last edited by The_Doctor; 09-12-2007 at 07:27.

  9. #9
    Join Date
    Dec 2006
    Location
    Pflugerville, TX, USA
    Posts
    1,977

    Default

    Woah, you lost me. But a rotation matrix is just a 4x4 matrix that you can mulitply by a 3d point to compute the position of a new point based on the desired x, y, and z rotation. So, if I wanted to rotate clockwise 1 degree (Z axis) and 2 degrees on the X axis I could compute the rotation matrix and then multiple each point in the frame by it. I would then have a new frame that was rotated correctly. I use the DirectX library to do this because it has a bunch of these functions already available. So, with just a couple lines of code I can rotate or move an entire ILDA frame and it comes out looking correct.

    I'll be honest and say that I am not an expert on any of this but if you do a google search for "rotation matrix" you'll find more than you want to know.

    I also use matrices for adding perspective (makes a 2d ilda frame look 3d when rotated) and for moving objects.

  10. #10
    Join Date
    Mar 2006
    Posts
    2,478

    Default

    Sounds like the same thing I think. Looking up for each point is the crucial thing, if you do it at the instant it's needed, the rotation will be smoother than if you plot each frame as a static entity. If the rotation was a new fixed angular perspective you could update the whole frame equally, but if it's moving all the time, that's when the point by point lookup makes it render better. More intensive on CPU though.

    I never got far with mine. I never figured out what to use to program it. Ideally I just want to write the code and see things happen and bodge my way to some degree of refinement, but on Windows it seems I'd have to thrash around with so many dipspare support modules cobbled together (if I'm lucky enough to be able to compile them), that I gave up whenever something more interesting and less frustrating happened. Never learnt C either which probably doesn't help. I like Lua but I'm told that no amount of wxLua (wxWidgets variant) can make it fast enough to do realtime work of this kind. And I hate Vbasic so I won't go there...

    What I did work out was a form that could allow constant update of an array to form a series of changing frames, or a frameless change of waveforms, and rotate the whole thing while it's moving. I never completed an example but I worked out exactly how I'd do it if I did. Was only 2D, but I know that 3D is also possible. Wanted to make that possible for the array content first though, and hadn't tried that far. You're right though, it is worth doing even if the array content is 2D, just changing the 2D plane to be a rotating panel is a cool effect in its own right.
    Last edited by The_Doctor; 09-12-2007 at 10:56.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •