Water ripple filter - RealWorld forums

Log-in or register.

Water ripple filter

This filter would be very helpful
sixλxis
on May 25th 2010

I'm looking for an image filter that produces similar results to this one: http://www.jhlabs.com/ip/filters/WaterFilter.html that will work in Paint.COM. All i'm looking for is the source code.

Thanks.

REGARDS,
~sixλxis~

sixλxis
on May 25th 2010

Looks like i might be able to use the photoshop plugin...

Vlasta
on May 25th 2010

The mentioned site also has the source codes (in Java, but does not differ much from C++).

RW Photos has almost the similar thing in Effect->More effect->Displace...

The same operation can be added to Paint.COM via script. It is not there by default, because it needs a height map and there are no sample files distributed with Paint.COM.

sixλxis
on May 25th 2010

Can the script also be found in the SDK? i cant use rw photos here (no admin privileges)

Vlasta
on May 25th 2010

No, it is part of the configuration. Basically, the following can be used. The first 2 lines should be changed - the amount variable can be modified as needed; path to a heightmap file should be set on the second line. The double \\ are needed due to javascript character escaping in strings. The brighter the pixel in the heightmap, the more shifted will the resulting pixel on the final image.

var amount = 50;
var displacemap = Application.OpenDocument("C:\\folder\\heightmap.png");
var dispcanvas = displacemap.RasterImage;
var image = Document.RasterImage;
Blender.Compose(Document, 0, 0, image.SizeX, image.SizeY, dispcanvas, 0, 0, null, Blender.OpHeightDisplace, amount);
sixλxis
on May 25th 2010

so my code looks like this right now:

var amount = 50;
var displacemap = Application.OpenDocument("H:\\RWPaint.com\\ripple.png");
var dispcanvas = displacemap.RasterImage;
var image = Document.RasterImage;
Blender.Compose(Document, 0, 0, image.SizeX, image.SizeY, dispcanvas, 0,  0, null, Blender.OpHeightDisplace, amount);

Ok thats in configuration what do i put in execution?

I have two heightmaps prepared.

im using these:
http://read.pudn.com/downloads104/sourcecode/windows/opengl/425603/Application%20Nature/Data/Water/water.png http://daedalus.f2s.com/HW2B5TC/TestBox1_height.png <renamed to 'ripple.png'

both require a little editing but that can come later.

sixλxis
on May 25th 2010

Okay there are no errors with this code in Configuration and Execution but nothing happens.

var amount = 50;
var displacemap = Application.OpenDocument("C:\\Program Files\\RealWorld Paint.COM\\ripple.png");
var dispcanvas = displacemap.RasterImage;
var image = Document.RasterImage;
Blender.Compose(Document, 0, 0, image.SizeX, image.SizeY, dispcanvas, 0,  0, null, Blender.OpHeightDisplace, amount);

P.S. i now have admin privileges

Vlasta
on May 25th 2010

The code should be in Execution box. The second image looks good.

sixλxis
on May 25th 2010

Allright so i want the filter to be treated like a rectangle with perspective transformation. how would i get that effect?

Vlasta
on May 25th 2010

If you still do not see any ripple effect it might be because your image is too small and the heightmap is uniformly black black in the upper left corner. The first mentioned file was a normal-map and Blender.OpNormalDisplace should be used instead of Blender.OpHeightDisplace with that (bluish) file.

I do not understand what you mean be the last sentence with the perspective transformation.

sixλxis
on May 25th 2010

Oh god sorry i completely failed there. I didn't know i had to have my image already selected and then hit custom operation.

sixλxis
on May 25th 2010

And one more thing, how can i save the custom operation for use later?

Vlasta
on May 25th 2010

If you work with the custom operation, then just saving the code in a text file is OK. But you can also right-click on the toolbar and then duplicate the custom operation or another of them and re-configure it. It is also possible to export them from the configuration window.

sixλxis
on May 26th 2010

Alright i got it working go check out the flickr page for the result.

Vlasta
on May 26th 2010

The distorted reflection looks very good. Now I understand what you meant by the perspective. It would be hard to get a proper perspective correct water wave distortion effect - that would be a task more easily done with a 3D scene.

Gamerat
on May 27th 2010

Hi Vlasta

Look at this example of ripples, it's a link to download a private p2p programme, and once installed, click the info button & run the pointer accross the RetroShare logo.

http://retroshare.sourceforge.net/

p.s., apart from good ripples & tetris, RetroShare's a really good private sharing network ;-) You can also get sourcecode. Hope this is of some help :-)

sixλxis
on June 4th 2010

I have a neat little water filter custom operation button in my program now 8-)

Page views: 18002       Posts: 17      
You cannot reply to this topic.
Select background
What about ICL files?
Vista & Win 7 icons