while the shader effects look great, real time wave action is a must for anything more than water in a pond or swimming pool... is there any chance this feature will see the light of day... thx --Mike
That's quite possible right now; you can deform the ocean mesh in realtime. For example, if you take the sinus curve modifier example from the procedural mesh examples, and apply the script to a plane, and change the "vertex.y += ..." line to: Code (csharp): vertex.y += Mathf.Sin(Time.time * speed+ baseHeight[i].x + baseHeight[i].y) * (scale*.5) + Mathf.Sin(Time.time * speed+ baseHeight[i].z + baseHeight[i].y) * (scale*.5); then you get some nice rolling waves. If you're using reflective water, the reflection will be kinda wonky, but short of ray-tracing I'm not sure if there's much to be done about that. --Eric
I'm guessing that what you're looking for is more of a "realistic ocean water shader" similar to what Quest3D and DX Studio have. There have been several posts by people who may be working on this, not sure of their progress: http://forum.unity3d.com/viewtopic.php?t=9676&highlight=waves http://forum.unity3d.com/viewtopic.php?t=9425&postdays=0&postorder=asc&highlight=waves&start=0 An ocean wave shader is on my "want" list also. If someone develops such a thing for Unity and is interested in licensing it, I'm interested.
I don't get that impression. I think he means the kind of thing that Wave Race 64 introduced. I'll be interested in doing this when I have time, so thanks, Eric, for a method to get started.
That's quite possible right now; you can deform the ocean mesh in realtime. For example, if you take the sinus curve modifier example from the procedural mesh examples, and apply the script to a plane, and change the "vertex.y += ..." line to: Code: vertex.y += Mathf.Sin(Time.time * speed+ baseHeight.x + baseHeight.y) * (scale*.5) + Mathf.Sin(Time.time * speed+ baseHeight.z + baseHeight.y) * (scale*.5); then you get some nice rolling waves. If you're using reflective water, the reflection will be kinda wonky, but short of ray-tracing I'm not sure if there's much to be done about that. I'm completely lost as to what that means, could you walk me through your instructions?
Is there a way to alter the mesh resolution for a plane. I'm trying to create a object whereby I can adjust the wavelength so that I can show a boat traveling through the water and through a gui change the wave height and "speed" of the waves. I put speed in quotes because I'm planning on having the boat stationary and have the water oscillate faster to simulate the boat moving. The problem I'm having w/ this particular code is that I can't get a good wavelength.
You can do whatever you want. http://unity3d.com/support/documentation/ScriptReference/Mesh.html --Eric
I'm trying to have a single wave travel across the plane to start slow. In this script I've tried just to deform the mesh but it's not working. Can anyone tell me what I'm doing wrong? private var baseHeight : Vector3[]; function Update () { var mesh : Mesh = GetComponent(MeshFilter).mesh; if (baseHeight == null) baseHeight = mesh.vertices; var vertices = new Vector3[baseHeight.Length]; for (var i=0;i<vertices.Length;i++) { var vertex = baseHeight; vertex.y = vertex.y * 1.1*Time.time; vertices = vertex; } mesh.vertices = vertices; mesh.RecalculateNormals(); }
For anyone else needing to change the mesh density http://answers.unity3d.com/question...nge-the-mesh-size-of-a-plane-created-in-unity
I think the problem with providing a general solution here is that everyone will want different things. Is it cosmetic or is it supposed to drive physics? As Eric points point, the basic math for propagating waves through a mesh is trivial (and indeed running "swell" (tidal wave action) and "chop" (wind-driven waves) at different angles is just a matter of picking frequencies, amplitudes, and directions and adding offsets.) But if you want to be able to do bouyancy or displacement by ships or splashes... Foam? Even in the non-realtime world water is a huge issue and tends to be handled as a special case pretty much every time.