Hi folks, I’ve been playing around with water4 on an iPad Air2 using Unity 5.1.2p1 and I’m really not having much luck.
Adding it to a blank iOS project I get the following result: Dropbox - Error - Simplify your life
Skip to the end of the video and you’ll see that the performance has slowly over time degraded to the point of being terrible.
I remember reading something once (long ago when it wasn’t relevant) about some kind of water variable that can’t trail off into infinity on the iPad and needs to be reset but I’ve been searching and can’t find where I read that. Also I’m a little worried if I go resetting something like that the water will jitter as its animation abruptly restarts from the beginning, which will look bad.
I have a terrible feeling its going to be difficult to find a solution to this which both functions and animates nicely so I figured I should skip straight to the forums with this one :).
I’ll post what I ended up doing here just incase somebody else later finds themselves stuck with this.
Disabling the gerstner displace component of the water solves the problem. DO NOT delete the component, just disable it.
Of course this is more of a compromise then a solution as it also disables gerstner displace, so if you want your water mesh to actually deform you’ll be out of luck.
I think a full solution to the problem could be resetting v.vertex.xyz in the FXWater4Simple.shader every three minutes or so. However I suck at shader programming so I have yet to find a way to do this. (Protip, don’t set it to 0, it really doesn’t like that .)
I’m quite content to simply not use gerstner displace over here, but if anyone does manage to cobble together a full solution I’d be quite interested to hear how you did it.
A quick update on this, whist the partial solution above did work in iOS8, iOS9 breaks water4 in the following new ways:
Water4 looks as if it’s out of clipping plane range when the camera is far away and the water has an object behind it. IE its invisible when it shouldn’t be.
Water4 has jagged borders where it meets the shore which become more jagged the further away you’re viewing the water from and generally look awful when a camera zooms in/out on them.
Switching from Metal back to OpenGL will fix these issues.
Sadly OpenGL isn’t an option for me, so if anyone does find another solution to this issue please let me know.
EDIT: To clarify, these problems only occur when water4 is over the top of an object, such as a seabed.
No response to my bug report yet, it wouldn’t surprise me if we saw “water5” before we see a fix to any of the growing number of water4 iOS bugs. Still now Unity is planning to move to using Metal on macs to correspond with El Capitan, likely propagating the issue above, maybe this will become a higher priority.
In the meantime I figured I’d help out anyone else in my position by sharing my workaround for using iOS9, water4 and Metal concurrently. Though given the amount of responses I’ve got in this thread and unity answers, I’m starting to think I may be the only person mad enough to be using it on iOS. Either that or everyone else is modifying it or creating their own solutions with shader code. (I’d be interested to hear from anyone doing this if only to get a better grasp of what’s going on in the water shaders.)
Anyway, here’s my workaround:
You’re going to be using your skybox as a seabed instead of any model, so make sure either your skybox bottom is a decent colour for this purpose or your water has no transparency.
Configure the culling mask of your original camera so it can only see your water layer, (which your water4 should be using.)
Duplicate your camera, change its tag then make it a child of your main camera. Configure this new camera’s culling mask so it can see everything EXCEPT your water layer. Set this camera’s depth to 0 and its clear flags to depth only.
Duplicate all your water tiles and attach them to a new parent for clarity. Remove the water tile script from them and apply your new depth mask material to them. You’ll want the mask to hide everything below the water but not the water itself.
You should have done this already for reasons explained in my second post, but in case you haven’t, disable your water’s gerstner displace component.
There are some obvious flaws with this workaround. You’ll get reflection but not refraction and won’t be able to see underwater objects through the water’s surface. Anyone scrutinising the edges of the water might also be able to see unrealistic reflections from the translucent inside of your models. The latter problem can be solved with some creative modelling but its not all that noticeable to the average user anyway I’ve found. In any case this workaround still looks vastly better then what you get from water4 on iOS9 as standard.