# How do I create this underwater effect with Cocos2D?

http://vimeo.com/2461697

Hi everyone, I'm trying to create an effect like this, the underwater effect (water distortion). I've looked around and I've seen references to "water caustics" but I'm not sure how to create this in Cocos2d or if it's done with obj-c only.

Thanks.

While I don't think they'll give you what you're asking for out of the box, you should definitely check out these two classes because they might be able to get you something very close.

Play around with those effects and see if you can get close. If you can't, you can always dive deeper into the engine to see how those effects are made and create your own effect.

Here's an old Youtube video showcasing these effects and others (you may want to mute the sound, though).

I hope this helps.

Even though CCShaky or CCRipple or CCLiquid are good effects for this kind of stuff, they consume quite a lot of processing. I do recommend you to use Cocos2d 2.x and give shaders a go. I have been doing it for a while and it seems to work better.

If you use Cocos2d 1.x version, take a look at Joe D answer. For fixed graphics pipeline this effect is only possible via grid distortion.

Maybe you use Cocos2d 2.x, with shaders? Then things are much better :) It's easy to do this effect in fragment shader (offset texture coordinates by some function of x, y and time). And you would have much more flexibility with shader (for example - add shading somewhere).