Making Ripples

Recommended Posts

I was speculating on how Equations could be used to create a ripple-like effect in a reflection. I used an image of a Mill on the River Avon at Tewkesbury. I flipped the image vertically and then applied Filter > Distort > Equations as follows.

The main effect is to vary the position of each pixel on the y-axis in a sinusoidal fashion, so I began with:

y=y+100*sin(2*360*y/h)

The 100 is just a scaling factor for now. This had the right effect but was the same right across the image, so I added a cosine function which would vary the magnitude across the x-axis:

y=y+100*cos(10*x/w)*sin(2*360*y/h)

Again the 10 here is a scaling factor. The result was:

I should be able to tweak this into a macro where the user could vary the amplitude of the ripple, and the amplitude of the horizontal variation.

A further tweak could be to add a perspective effect so that the ripples nearer the observer look larger than those further away.

What do possible users think. Would this be a useful macro or are there easier ways to get the same effect?

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

I would love to have that macro, please

Share on other sites

That what you do not yet know is more important than what you already know-Jordan Peterson

Share on other sites

Absolutely brilliant @John Rostron!

Edit: yes, a macro would be great

Share on other sites
On 2/21/2019 at 6:18 PM, John Rostron said:

I should be able to tweak this into a macro where the user could vary the amplitude of the ripple, and the amplitude of the horizontal variation.

I apply such things sometimes via programming code variations try outs, in order to see if certain filter functions do work the way they should or not. On a Mac such things can be done easily in Xcode playgrounds and a little bit of Swift hacking then, since the graphics APIs are already there for all kind of such things.

For example, here I've used the Apple core image API for applying waveline distortions to an image x-coordinate direction, the wavelength and amount values can be applied/adjusted individually. The same can be done for the y-coordinate direction, so you could apply custom adjusted wavelength distortions to both x,y if desired.

How the applied filter effects look can be immediately inspected then and seen if you expand the used test image inside ...

That Apple API offers all the those filters the APh FX effects etc. stuff does have. - Though for ripple effects there is also a seperate CIRippleTransition core image filter available which then is fun to be combined with some core animation API stuff. That way you can animate image related stuff too.

BTW, a macro would be of course much better for APh (re)usage here, since fiddeling around with those expression text fields is IMO always a pretty annoying matter. Personally I'm more in favor and a friend of dynamic behaving interpreter shells here for such tasks.

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

Thanks, @v_kyr Yours is an interesting approach. I do have some experience with scripting languages like Javascript, PHP and Python so I await, with bated breath,  the time when the Affinity apps offer a proper coding API.

I do have a filter more-or-less ready for release, but I am having trouble making the parameters visible to the user, as you have seen in my bug report.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

Well life can be too short to wait for an Affinity programming or scripting API, thus better start to program your own solution stuff now and yet instead and then be independent from maybe never seen or limited features here.

The parameter handling should usually work, I recall that I also tried it on Win versions some time before, even I use the Affinity stuff mostly on Macs due to the overall better performance and memory handling behavior.

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

I think that I now have a (more-or-less) working version. These is a single macro (Ripples.afmacro) within a library (Ripples.afmacros):

There are two parameters,

The first, a, controls the ripple frequency. reducing the value makes the ripples closer together (more ripples per inch).

The second, b, affects the variability of the ripple magnitude across the x-axis. By default (b=1), the ripple magnitude is the same across the width. Reducing b makes it more variable.

There are two additional additions to my earlier draft. The original ripples were a simple sine wave. They are now generated with the addition of a couple of smaller cosine waves with shorter wavelengths. This means that the ripples are not uniform.

The ripples are now visually further apart near the front of the image, and closer at the back, to simulate perspective. Neither of these two additions are controllable by the user.

Here is a sample image (Mill on the River Avon at Tewkesbury:

And here is the image with the macro applied:

Note the artefact at the top of the image. I am not too worried about that since, in practice, the user would not be utilising that part.

I would envisage this being used on a flipped duplicate layer and blended into the reflective surface part of an image.

I would be interested to see an application of this that anyone has.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

I think it's probably best used on certain selected image areas only, or then afterwards better finetuned via masking, in order to get a more realistic appearance. - However here is your macro when applied instead on the whole bottom rect area of an image.

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

I have just posted an example of this in the Share your work Forum.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

I would welcome feedback on this macro. I have applied it to some images with impressive results and to others where it was a disaster!

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

Thank you very much John for your efforts.

I've tried your macro on various JPGs, but like you say : the results vary.
In the mean time I've found a "ripple"-plugin on Flaming Pear called "Flood", I'm sure you're aware of it, too.
Thought I'd mention it, though, just in case.

C.L.

That what you do not yet know is more important than what you already know-Jordan Peterson

Share on other sites
6 minutes ago, catlover said:

Thank you very much John for your efforts.

I've tried your macro on various JPGs, but like you say : the results vary.
In the mean time I've found a "ripple"-plugin on Flaming Pear called "Flood", I'm sure you're aware of it, too.
Thought I'd mention it, though, just in case.

C.L.

I do recall seeing the Flood plugin in the past, but I had forgotten about it when I was creating my macro. I must download the trial.

Thanks anyway.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

Sorry, forgot : There's an Aff Macro called "Distortions", it has a "Lake Surface" macro within.

See attachment.

Distortions.afmacros

That what you do not yet know is more important than what you already know-Jordan Peterson

Share on other sites
51 minutes ago, catlover said:

Thank you very much John for your efforts.

I've tried your macro on various JPGs, but like you say : the results vary.
In the mean time I've found a "ripple"-plugin on Flaming Pear called "Flood", I'm sure you're aware of it, too.
Thought I'd mention it, though, just in case.

C.L.

I have just tried Flaming Pear Flood 2 and it does not work. The preview and the output are both corrupted. I will try the Distortions macro.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites
39 minutes ago, catlover said:

Sorry, forgot : There's an Aff Macro called "Distortions", it has a "Lake Surface" macro within.

See attachment.

I have just tried this and it seems to work. I shall explore it further. Thanks for the pointer.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

I have updated this macro and have posted an appropriate message under Resources since it seems more appropriate there. Thanks to the various forum members who have responded.

John

Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share on other sites

John, in case you are interested in seeing an other Ripples filter implementation (made in Java here) and how that shows up then ...

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

BTW, a more wavy look for such distortions can be done with a Swim distortion called filter, which IMO often gives better looking results than the above shown Ripple one ...

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

Hi, V_Kyr:

Please also see John's Post that this thread has been moved to "Resources".

Thanks, C.L.

That what you do not yet know is more important than what you already know-Jordan Peterson

Share on other sites

I'm sorry that's no APh macro at all, those filters shown are Java graphics programming based here and thus their code is (re)usable in Java apps but not APh. - For APh those would need to be glued into a working plugin instead, in order to make any use out of them.

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

OK, thank you.

I totally misunderstood

C.L.

That what you do not yet know is more important than what you already know-Jordan Peterson

Share on other sites

@catlover Well maybe I didn't named/explained that very well!

However, for those interested in this image filter materia, a bunch of Java graphics based implemented filters can for example be seen here ...

Other Java based image apps with certain implemented image filters ...

☛ Affinity Designer 1.7.1 ◆ Affinity Photo 1.7.1 ◆ OSX El Capitan

Share on other sites

@John Rostron That macro is nuts! Absolutely in love with it

Check out this small edit (still in progress):

Some ideas for further improvement of the macro:

• modulation / increment of the distance between each ripple in a selectable direction (in my edit it would give a better depth if the distance between each ripple increments towards the viewer of the photo)

FYI: Here are the adjustment layers I added to the water layer:

• motion blur
• gaussian blur
• ripples live filter for a more 3d-ish global movement of the water surface

Cheers, Marc

Create an account

Register a new account