<p>You can achieve an effect like this with a couple of distortion filters from most video editing or motion graphics packages. For example in FCPX/Motion, you could apply a couple of Bulge distortion filters to the upper right and lower left and adjust the scale and radius as appropriate.</p>

<p>In terms of implementing it yourself, I agree that it's a question for StackOverflow (once you've attempted to write it yourself). The algorithm is fairly straightforward. For all the pixels within the radius, apply a mapping function along the vector from the center to the current point. For example (in pseudo code):</p>

<pre><code>distort (vec2 center, float radius, float amount)
{
    for (each pixel in the image)
    {
        vec2 dir = pixel.coord - center;
        float dist = dir.length()
        if (dist &gt;= radius)
        {
            outPixel = pixel;
        }
        else
        {
            float percent = dist / radius;
            float newPos = pow(percent, amount);
            dir = dir / dist;
            vec2 newCoord = dir * newPos * radius;
            outPixel = getPixel(newCoord);
        }
    }
}
</code></pre>

CC BY-SA 3.0
2014-07-18T14:05:54.977Z
2014-07-18T14:11:55.367Z
2014-07-18T14:11:55.367Z
user1118321
<p>How can I achieve a trippy visual drifting effect like the image is breathing? </p>

<p>See <a href="http://www.disregardeverythingisay.com/post/9331287956/the-visual-components-of-a-psychedelic-experience" rel="nofollow">The Visual Components of a Psychedelic Experience</a> - <strong>Visual drifting</strong> section or more precisely <a href="http://www.youtube.com/v/NaA7yzHh2as&amp;start=91&amp;end=114&amp;version=3" rel="nofollow">this fragment of this video</a>.</p>

<p>Any software solution is fine, but I would be most thrilled with an implementation in Processing or Javascript</p>

CC BY-SA 3.0
2014-03-10T14:56:02.207Z
What do you mean by an implementation in "Processing"?  If you are trying to do this programatically, it may be a better fit for Stack Overflow.  Can you also describe the effect more directly in your question?  The youtube link you provide is already dead on copyright grounds and the other link could go dead in the future.  While external clarifications are helpful, it is best if your question is still able to stand alone without them.
AJ Henderson
CC BY-SA 3.0
2014-03-10T18:19:57.673Z
Processing is a programming lanuage geared towards video manipulation and visual effects. http://processing.org
Jason Conrad
CC BY-SA 3.0
2014-03-10T18:48:03.033Z
BTW, you could probably hold a photo in front of the camera and move it around to get any effect you want. It won't look perfect, of course, but it's an option.
BrettFromLA
<effects><post-production>
How to achieve trippy breathing effect (visual drifting) on static photo
MrX
# How to achieve trippy breathing effect (visual drifting) on static photo

(Asked by: username_0 on 2014-03-10)

How can I achieve a trippy visual drifting effect like the image is breathing?

See [The Visual Components of a Psychedelic Experience](http://www.disregardeverythingisay.com/post/9331287956/the-visual-components-of-a-psychedelic-experience) - **Visual drifting** section or more precisely [this fragment of this video](http://www.youtube.com/v/NaA7yzHh2as&start=91&end=114&version=3).

Any software solution is fine, but I would be most thrilled with an implementation in Processing or Javascript

**Tags:** effects, post-production

> **Comments:**
> **username_1**: What do you mean by an implementation in "Processing"?  If you are trying to do this programatically, it may be a better fit for Stack Overflow.  Can you also describe the effect more directly in your question?  The youtube link you provide is already dead on copyright grounds and the other link could go dead in the future.  While external clarifications are helpful, it is best if your question is still able to stand alone without them.  
> **username_2**: Processing is a programming lanuage geared towards video manipulation and visual effects. http://processing.org  
> **username_3**: BTW, you could probably hold a photo in front of the camera and move it around to get any effect you want. It won't look perfect, of course, but it's an option.  

---

## 1 answers

### Answer by username_4 on 2014-07-18. Score: 2

You can achieve an effect like this with a couple of distortion filters from most video editing or motion graphics packages. For example in FCPX/Motion, you could apply a couple of Bulge distortion filters to the upper right and lower left and adjust the scale and radius as appropriate.
In terms of implementing it yourself, I agree that it's a question for StackOverflow (once you've attempted to write it yourself). The algorithm is fairly straightforward. For all the pixels within the radius, apply a mapping function along the vector from the center to the current point. For example (in pseudo code):
distort (vec2 center, float radius, float amount)
{
    for (each pixel in the image)
    {
        vec2 dir = pixel.coord - center;
        float dist = dir.length()
        if (dist >= radius)
        {
            outPixel = pixel;
        }
        else
        {
            float percent = dist / radius;
            float newPos = pow(percent, amount);
            dir = dir / dist;
            vec2 newCoord = dir * newPos * radius;
            outPixel = getPixel(newCoord);
        }
    }
}


---

