mobile reflecting water

hi! i’m doing an Agumented reality application on iPad and i need some good looking water… is it possible to have a reflective\refractive shader on an iPad?
thanks!

yeah it’s possible, use render texture.

On mobile I would recommend using cubemaps since RenderTexture can get extremely slow.
Actually I’m working on an awesome mobile water shader, take a look at the asset store in a couple of weeks.

thanks! but i need to reflect realtime what’s happening, it’s only a small surface with a little number of objects reflecting…
now the problem seems to be the fact that it adds the cube map every frame, generating strange reflections…

As far as I know, the reflective shaders use RenderTexture. And what RenderTexture does is it renders the WHOLE scene one extra time. So a rough example - let’s say that your game was running at 60 FPS, with the addition of one RenderTexture, the performance may drop to 30 FPS. That’s a rough approximation, but you should get the idea. RenderTexture is a big no-no on current mobile hardware, unless your scene is extremely small and fast. I’d say if your game is able to run at 60+ FPS on mobile, go for it, try the Unity Pro water shader (and also you’ll have to take into account that it uses 2 RenderTextures - so your whole scene will have to be rendered 3 times).

actually i’m using the unity pro shader and i’m not experiencing drops… it still run at 29fps… my problem is that the rendermap isn’t rendered in an appropriate way, seems it adds every frame and never flush the old data!

Do you have clearFlags set properly on your RenderTexture camera? http://docs.unity3d.com/Documentation/ScriptReference/Camera-clearFlags.html

i’m a noob… I just draganddropped the shader… I read docs about render cameras but i didn’t understand at all… where can i find the flags? or where do I have to put it?

You have to set it in your .cs or .js script that is responsible for rendering to texture. Take a look at PlanarReflection.cs from unity’s water: http://code.google.com/p/dorumon/source/browse/trunk/CSTRIKE/Assets/Standard+Assets/Water+%28Pro+Only%29/Water4/Sources/Scripts/PlanarReflection.cs?r=337 (at line 127)
You should have something like this:

reflectCamera.clearFlags = CameraClearFlags.Skybox;

Why not to use Unity’s pro water then? It would give you a much better overall look of the scene.

Rendertexture is not slow. You’re making grand assumptions based on nothing. What you choose (via culling layers) to render will dictate if it is slow or not slow, including the resolution of what you choose to render. For example:

  1. render scene
  2. on post render method, blit to storage texture
  3. render water
  • it is entirely up to you the size of the second render, and the elements it renders, it isn’t automatically very slow. Of course cubemaps are faster but just claiming its all slow is giving out the wrong information here.