4 displacement window

This is a demo of a way to use the displacementmap-filter to distort a movieclip in a controlled way. In most cases the displacementmap-filter is used together with some kind of random functions to create flag or liquid wave distortions. It also a experiment on how to use a physics engine as a tween engine.

You can drag the physics point but if you do to fast motions the physics grid can be messed up.
press “p” to show the physics points. Wait until new random points are set.
press “d” to show a preview of the displacementbitmap

Every 150th frame new destination points are calculated. The physics points are then moved to the new location and anchors are attached in the corners. Then the physics points are dragged to the old location and released. The result is a motion tween made of physics springs.

The circles are controlled by the physics engine and the distance to the original positions are calculated. The points are then the input for creation of a two quadratic bezier-surfaces, one for x-axis and on for the y-axis. I found the surface page on wikipedia after I made the application, which was good since its a little bit over my head, but the curvepage is good and have nice ani-gifs. A bitmapdata is created from the surfaces and used as the displacement filter. If simpler linear instead of quadratic bezier curves are used a perspective effect can be archived in a simple way.

The original clip is masked away, otherwise it shows up behind the filter during heavy displacement.

The performance is not that great. Its not that strange since its a lot of calculations. The displacement bitmapdata has the dimensions of the bounding box of the physics points. If the box is 200×200 px the displacement calculations and setpixel() in every frame is made 2×200x200 = 80000 times.

I made some small attempts to rescale the window before the calculation to be able to make a smaller displacement filter but I didnt succed.

An alternative way to archive the same effect could be to use the same triangle distortion trick as 3d engines uses. But if you want the same degree of smothness you will need a lot of triangles. Another advantage over the triangletrick is that the mouseevents on the clip still works like clicks and rollovers. That can be archived with the MovieClipMaterial in papervision3D but that’s a little bit trickier.

I’m a little bit confused why transparency and dropshadow filter on a filter works. Its a good thing here but a little bit unexpected.

The source needs some refactoring and documentation maybe. The drawings and calculations have to be separated from the physics part to make it useful. If you can use it and make something cool let me know.

4 Comments to “displacement window”
  1. film merveilleusement interdit de masturbation, on May 16th, 2014 at 00:55:31, said:

    Euhhh êtes vous sûr de ce que vous nous affirmez ?

  2. éjaculation interne, on June 22nd, 2014 at 19:40:41, said:

    Je suis arrivée sur votre site internet par chance et puis je ne
    le regrette point !!!

  3. promgazenergo, on April 6th, 2015 at 18:02:54, said:

    kotelnaya http://www.promgazenergo.su/

  4. Andreyhale, on June 26th, 2015 at 18:11:04, said:

    заработок в сети , не упускай шанса,
    в проекте при регистрации дарят 50$ США
    любому человеку, для ознакомления с системой.
    Заработок денег в интернете без обмана в наше время это реальность,
    этот заработок открыт для всех, переходи сюда: вебтрансфер финанс заработать

Comment on this post below

You can leave a response, or trackback from your own site.