Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. We are looking for your feedback about Templates! Tell us about your experiences by taking our survey.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Wanted: Ocean shader

Discussion in 'Works In Progress' started by bigkahuna, Jan 8, 2009.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Hmm... It appears as though your "boyancy.js" script is using a flat plane instead of the animated ocean mesh. The buoyant object bobs but doesn't go up and down with a passing wave. The object "Ocean" is an empty game object, but it appears that "boyancy.js" should be using one of the ocean meshes that the script generates. There was another buoyancy script earlier in this thread, I'll have to take a look and see if it can be adapted to your ocean sim.
     
  2. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    It is not ²my² script, it was included in the 1st distribution I downloadaded from this thread.
    Having it fixed as well as having a good underwater would be great...if someone does it, please post the result or send it to me so I²ll package a new version and add your name to the BSD license copyright...
     
  3. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    273
    Hi Nikko and others

    Thanks for this great tool.
    Here a shot with a lighthouse i have build.
    Fun to play with.

    Norby
     

    Attached Files:

  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @Norby - Nice! Now go add some particle "spray" to that scene. :)
     
  5. TwinFox

    TwinFox

    Joined:
    Jan 9, 2009
    Posts:
    66
    Bigkahuna, it is the same buoyancy script as earlier. Looking at nikko's modified ocean script I see there is some additional scaling of the ocean mesh. The buoyancy script fetches the unscaled data from the ocean, hence the discrepancy between object and ocean behavior.

    Also, the buoyant objects need to have a rigidbody and a mesh collider attached (a cube collider won't work!), as well as be linked to the ocean, but I guess you knew that already.

    I'm gonna take a look at the scaling to see if I can get it fixed cleanly.

    Nikko, good work on the ocean! Your shader really brings the effect to life!
     
  6. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @TwinFox - That explains it and thanks for looking into the fix. Yes, I caught the bit about using a mesh collider, but is there a reason why you're using a mesh collider? Does it actually calculate an object's center of buoyancy (center of a volume)? In my crude example (first page of this thread) I used 3 spheres connected by joints to create the illusion of a volume, but is yours actually using a volume calculation?

    @ Nikko - I'm not sure if this is desired behavior and / or if it only happens on Macs, but it appears that the pattern of the wave is determined by the direction that the main camera is pointing when the script is started. I've been able to reproduce this several times and it is most noticeable when the waves are set to a higher setting. I'll need to play with this more, but this is really looking good and it seems to run pretty fast. I'm getting 40+ fps in the editor in full screen, which isn't bad.
     
  7. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    273
    @Norby - Nice! Now go add some particle "spray" to that scene.


    thanks bigkahuna

    Yes would be a good idea


    :D

    Norby
     
  8. TwinFox

    TwinFox

    Joined:
    Jan 9, 2009
    Posts:
    66
    Not really. The script was originally attached to a ship model, not a cube. It was meant to be a quick test on how objects could interact with the water. Physical buoyancy calculation would be a really nice addition.

    Norby, love the scene! I can already hear the seagulls...
     
  9. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    Extremely impressive! I'm gonna download it right away :)

    Edit: So I played around with the idea I described earlier (the heightmapping-based underwater stuff), since I figured it'd be more robust than the "pull-down-water-vertices-the-farther-away-from-camera"-approach. It's starting to work, but as predicted, there are some significant issues when the camera gets too close to the reflection plane. This can probably be hacked/fixed in several ways (as you mentioned earlier, toning down the reflection based on this might be a good idea), but I thought I'd share the current state of my project before I go any further. Also, if someone has a better approach on how to do the camera/water-intersection, I'm all ears!

    Please look at this as a testbed rather than an actual useful release, and I'd like to point out that I added a KnownIssues.txt in the project you might want to read to get an understanding of what to expect of bugs/issues. Also, lots of stuff can be done with the underwater renderpass itself - the shader used to render the water from below is not very good looking, and blur/distortion would probably be cool (nikko, I'm looking at you :) ).

    There's a webplayer here: http://www.terravision.no/~trondabu/unity/waterexp.html Don't expect it to run on low-end hardware, though. I'm getting decent framerate on my 8600 mobile, and it should run on both Mac and Windows (after hours of hunting subtle shader differences, ugh).

    The project used to build the webplayer above can be downloaded here:
    http://www.terravision.no/~trondabu/unity/Ocean_ReflRefrUnderwater.zip

    Any feedback is highly appreciated!
     
  10. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Toretank:

    About you approach of underwater, I think you get it... It looks weird but I think that with a little bit of tweaking it will work... Technically you solved the problem!
    I'll have a look at it this week...

    Just let you know that the Ocean script is not compiling on iPhone, but I'm working on trying to make it work on iPhone too. Of course the shader will be simplier and will need a lot of tweaking to look good, iPhone is just a little bit better than directx 7 :)

    Twinfox: who did the buoyancy script at first? It is a very good idea that need some work, but worth adding more feature so any object could move realistically...
     
  11. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    ah ! Norby : I love your scene, specially the Sun that mixes perfectly with the sky! Good job... There are some birds in the Island demo, maybe having them turning around the building?
     
  12. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @ToreTank - Yup, that looks like the ticket. The colors for the water surface (from underwater) are all wrong, but the effect looks very good. As Nikko says, a bit of tweaking and I think it will work just fine. Performance on my iMac Intel Core Duo was fine, BTW.
     
  13. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    431
    ToreTank, this is already amazing ! Lokks like you guys will never stop :D :D :D
     
  14. Red Ocktober

    Red Ocktober

    Joined:
    Oct 28, 2005
    Posts:
    84
    really great stuff nik and the rest of the devs over here who collaborated on this...

    i must get a license for Unity right away so i'll be able to code my sub sim for the mac as well...

    currently i'm commited to 3DRAD for development of the first version, and i've been doing the same thing in RAD as you guys have been doing in Unity (trying to get a decent looking ocean water with real time waves)...



    (shameless plug from my 3DRAD sub thingee)

    but 3DRAD is DX Windows only... and cross platform has always been a wish of mine... and your ocean development has made up my mind as far as a mac version is concerned...

    just one question...

    this seems to run fine (minus some reflections) and look good on a mac mini with a 9200 graphics card... am i going to require the pro version of Unity in order to code for your ocean resource on my current setup or can i get away with the indie license on this machine and still use your ocean ?

    again... really great stuff...

    --Mike
     
  15. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I'm pretty sure you'll need Pro, at least the last version I tested used it.
     
  16. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    You need PRO to do water and full screen glow for example; But the PRO version is worth the money invested.
     
  17. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    You're gonna need pro if you're interested in the reflection stuff. Awesome shot with the sub, btw!

    The underwater shader isn't very good, I totally agree :) I tried to do something using refraction from under the surface, but it's gonna take quite some tweaking to get something usable out of it (and currently it's another renderpass, as if it isn't enough with the current number of passes :p )
     
  18. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @ToreTank - I know nothing about shaders so ignore this if it's not possible, but for an underwater shader I would think the main thing is refraction as there won't be any reflections at all. The standard Pro water shader has the option of turning off reflection, don't know if that's worth looking at. Or would it be possible to just distort the view of the skybox?

    @ToreTank Nikko - This is progressing beyond my greatest hopes, awesome work!!
     
  19. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    Yes, the main thing would be refraction, as whatever reflection you will get from below will most likely be fog-ish anyway. Just using the skybox is a good suggestion - the main problem right now is that the geometry in the refraction suffers from the same problems as with the reflection from above the water. Need to play around with the clipping plane and see if something good comes out of it.

    Good to hear that, thanks for the kind words!
     
  20. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    Okay, so I put together a new build. It still has its issues, but it shows the idea. It's located here:

    http://www.terravision.no/~trondabu/unity/waterexp2.html

    What can I say - I like green water for some reason :)

    (Source)
    http://www.terravision.no/~trondabu/unity/Ocean_ReflRefrUnderwaterRefr.zip

    If this doesn't bring your framerate to its knees, I don't know what will. Anyway, I'm still not doing any sanity checks on when it would be a good idea to turn off some of the passes, so that would be a _huge_ optimization.
     
  21. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    It is very quick on my old office computer ToreTank,this is an amazing job. I can t wait the end of the day to check the code.
     
  22. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    273
    Hi Toretank

    this is Beautiful, its getting better and better.


    Norby




    :D
     
  23. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Yes, this is amazing. Can't wait to start playing with it! :)
     
  24. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Just gave the new version a spin. The underwater effect is awesome, but I found what looks like a big, gaping "seam" between two planes?
     

    Attached Files:

  25. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    it is there forever, it is just hidden in the version I²ve made; For some reason on your picture, the camera must be just between 2 different LOD tiles...
     
  26. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    Good to hear that it works! Must be something with my setup, then - I'm experiencing significant slowdowns compared to the previous version.

    bigkahuna: Yeah, it is pointed out in the KnownIssues.txt-file. It is a seam between two levels of LOD-meshes. Not really noticeably from the start point. This is why the tiles should be shifted as the camera moves (this way you will always have the high-poly version close to the camera), but this has not been implemented in the version I've been playing around with. Probably worth having a a look at. For high-end computers, I'm sure you can get away with using the most detailed LOD-mesh for all of the tiles, and that _should_ hide those seams (except for some culling issues, which are also described briefly in the .txt-file).
     
  27. Red Ocktober

    Red Ocktober

    Joined:
    Oct 28, 2005
    Posts:
    84
    thx for the info guys...

    TT... your underwater scenes are right on the money... moving around under the waves really felt like i was moving underwater...

    nice job...


    --Mike
     
  28. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    ToreTank, you should try to compile the Ocean.js Script with #pragma strict
    There are a lot of casting issue that are hard to fix (array and meshes) without understanding exactly what you are doing.
    Maybe you can help?
    iPhone App must have #pragma strict on...for example this tile.GetComponent(MeshFilter) returns a Component Object that cannot be affected to an array...
     
  29. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    Nikko - the script should now compile with pragma strict (don't expect it to run on the iphone though, there are probably other issues). I put an edited version here: http://www.terravision.no/~trondabu/unity/Ocean.js I also added water tile offset based on camera position, but it only works for the main camera currently, and the popping is too noticeable right now in my opinion. Need some lower LOD levels to go from the outer tiles to the far clip plane, or somewhere close at least. The offsetting can be turned off by setting the "followMainCamera" to false in the the inspector.

    If you can get it to run on the iphone, that'd be awesome :) I do suspect it might completely kill the framerate, though. Earlier in this thread, someone was working on an iphone water solution, you might want to have a chat with him (go hunt down "dmorton").
     
  30. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @ToreTank - The new Ocean.js works fine here (iMac Core Duo), the popping is as noticeable unless the height of eye is pretty high (ala flight simulator).

    I'm looking at how to change the water color, looks like it's been coded into Ocean.js? Any reason why that variable wasn't exposed in the inspector?
     
  31. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    Sorry about that, it is a direct consequence of my lazyness. Updated the script I linked above, should work to update the water color from the inspector now.
     
  32. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Nice, thanks! :)
     
  33. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Thanks, I'll have a look tonight (it is 8am here in Florida).
    I'm sure it can work on iPhone. I've made sopme tests with simple Meshes with around 50k poly and it works very smoothly. iPhone is quite powerful. The challenge will be to get a descent result from very limited shader's capabilities!
     
  34. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Damned!

    Code (csharp):
    1. // Determine which LOD the tile belongs
    2. (tiles_LOD[chDist] as Array).Add ((tile.GetComponent(MeshFilter) as MeshFilter).mesh);
    3.  
    That's why don't like #C compared with Javascript, aren't compuyter supposed to simplify our already complicated life ? :D :twisted:
     
  35. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    It's supposed to simplify the lives of the users, I don't think it cares too much about the programmers :)

    You are running scenes on the iphone with 50k polys? On the actual device? With interactive framerates? Huh. Never seen that before. Let me know how it turns out :)
     
  36. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    Yes the graphics is quite powerful, what kills everything is the CPU, very slow, so maybe the waves will be too much for the little device. But if you load a mesh that is made of little parts, and use culling, then you get a very good framerate. I've been surprised by the device performance.

    I was thinking of having a version with Pre-Calculated LOD, or something like this.

    I'm merging your Ocean with the one I'm working on... I like your approach of the Underwater, it opens a lot of new possibilities of tweaking, great job!
     
  37. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    439
    Hey Nikko,
    awesome Job !!!! really nice work.
    Also ToreTank for sharing the Scene !
    Well a working Scene on the iPhone would also be great... :oops:
    Nikko if you are done with the iPhone stuff can you post here your Scene that work ?
    many thanxxx

    kerstin :oops:
     
  38. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    431
    Here's an old underwater scene I had made for a project, with a transparent "oscillating flag" placed in front of the camera - actually, a plane with the refracting glass shader applied on it. The bump texture's scale is affected by a sinusoid, which produces this underwater dynamic refraction effect. It was based on an idea given by Eric Haines (him, again !) : www.tiviboo.com/unity/oasis1

    Maybe such an effect, in a more advanced version, could be added to the ocean shader ?
     
  39. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @Yann - Nice sky! How did you get the stars to be so sharp? Nice effect around the moon, too. Isn't the underwater effect in your sample the same as used in the Island demo?
     
  40. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    431
    In the island demo, there's a blur effect and no refraction for underwater. It was Eric who suggested this other solution on the forums, a few months ago, and I found the idea quite smart, as usual ! :)

    About the stars : they're from a Vue Infinite sky. Also, added an image effect to the whole scene, to make it more blue...

    This scene is already old : the sand dunes are very basic, etc... but it will come in a more mature version inside one of my current projects (underwater 3D videochat...) hopefully including the great ocean shader ! :D
     
  41. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    That's looking pretty good Yann! Will have to take a look at that effect :)
     
  42. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    I got the thing working on iPhone... hum. VERY SLOW. The waves calculation are taking too much time. It runs at 4 FPS or something :(
    I was maybe too optimistic.
     
  43. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    431
    @ToreTank : here is the (maybe pathetic :) ) code I applied to the transparent plane for underwater effect :

    Code (csharp):
    1. var speed = .1;
    2. var amplitude = .05;
    3. var texturescale = .1;
    4.  
    5. private var currentsize = 1.0;
    6.  
    7. function Update () {
    8.     currentsize = Mathf.Sin(Time.time*speed) * amplitude + texturescale;
    9.     renderer.material.SetTextureScale ("_BumpMap", Vector2(currentsize, currentsize));
    10. }
    Ideally, it should look less angular when panning the camera. In the oasis scene, I just used the default "Water bump" texture - but maybe there would be a more appropriate one.

    @nikko : can it still be used in the iPhone with a single - or very few - tiles, or does the problem remain ?
     
  44. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    I'll try to pre-calculate the waves and remove all the maths when I update the mesh. The number of tiles does not change too much, there are just too much maths involved in the FFT calculation. Pre-calculation should be fast enough... Still there is the shader problem, it looks like s.hit! I'll try do have the textures all together in a single one and fake the reflections someway. I will require a lot of tweaking to get something descent... I think that Ponds for example must use data in a table instead of doing the maths in realtime...
     
  45. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    500
    Has anyone got the buoyantObject to work? to me it seems to be out of phase with the waves or something... sometimes my boat is underwater, other times it's floating on air...

    I tried tweaking the script but I'm way over my head here... my assumption was that the script was getting reference points that are somewhere else other than under the object, and was calculating forces that don't match the sea right beneath... but I might be wrong...

    anyways, this Ocean is simply awesome!! I really want to use it for my college project... I just hope I can get my head around it in time :roll:

    congratulations and thanks for the creators and contributors!! :D

    Cheers
     
  46. Yann

    Yann

    Joined:
    Oct 20, 2007
    Posts:
    431
    @HarvesteR : for the scene I put here : http://www.tiviboo.com/oceanretro I just parent the submarine mesh to a buoyant object with a box collider, which you can see in green on the picture. Changing the submarine's local vertical position inside the gameobject did the trick. All other colliders are kept intact in the mesh, which allows other objects to collide with the submarine. Only the box collider attached to the parent buoyant object is taken into account by the ocean system.

    There must be smarter and more accurate solutions (tweaking the center of mass?), though : sometimes the submarine looks like a bridge, suspended between two equally high waves. But perhaps this is normal behaviour in the real world... I'll study it in my bath tonight :)
     

    Attached Files:

  47. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    500
    Thanks for the quick reply :D

    I was messing with all possible settings yesterday until very very late... and I also settled for a mesh linked to a box collider of sorts

    I tried loads of combinations... and it seems that the larger the floating object is (and it's child mesh too), the better it looks... tiny objects tend to fly around and even tip over...

    Also, big waves decrease the accuracy of the buoyancy... so I guess for it's a little difficult to get a 'The Perfect Storm'-ish sea

    Well, I'll keep on trying, if I find anything you guys will be the first to know :wink:

    Cheers
     
  48. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    500
    Well, I already rewrote half of the buoyancy script trying to find what was wrong with it... so far no luck, but I've made it a little easier to understand now... at least for me :mrgreen:

    I've traced the problem to the GetWaterHeightAtLocation function in the ocean script... it's not returning correct values...
    I saw that there's a TO DO comment on that function... so I'm guessing it's not completed

    I'm going to try using raycasts to determine the exact location of the mesh below... let's see what happens :wink:

    I'll post a solution if I find one

    Cheers

    EDIT: I think the GetWaterHeightAtLocation function is apparently failing at returning negative values... I set up some gizmos to track the height of the water (their y value is equal to the return value from the water height function), and while they no longer go underwater now, when the waves drop they are left lingering in mid-air in a most unrealistic fashion...

    the AddForceAtLocation calculations in the buoyancy script are apparently correct, although I had already rewritten that thinking it might be the problem... it's just that it's basing it's calculations on incorrect numbers from the water height function

    I tried rewriting that function, but I realized it's returning values based on the very complex math being done in the other scripts... and I have no mind to go poking in there :roll:

    I've been reading up on the raycast procedures, but I couldn't get my head around it so far... I'll keep trying... I've got all night :wink:

    Cheer again
     
  49. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    500
    I managed to get a raycast going here... but it's not hitting the water mesh... nor anything for that matter

    I added a meshCollider component to the water meshes, but I'm not getting any hits... I don't know what to do anymore... maybe I'm too new at this

    anyways, here's some of my code so far... maybe you guys can tell me what I'm doing wrong

    this is the FixedUpdate function of the buoyancy script:
    Code (csharp):
    1. var hit: RaycastHit;
    2.  
    3. function FixedUpdate () {
    4.     for (i=0; i<blobs.length;i++) {
    5.         var blob = blobs[i];
    6.         if (blob != null) {
    7.             wpos = transform.TransformPoint (blob);
    8.             damp = rigidbody.GetPointVelocity(wpos).y;
    9.             if (ocean){
    10.            
    11.                 Physics.Raycast (Vector3(wpos.x, -100, wpos.z), -Vector3.up, hit, 1000.0);
    12.                
    13.                 rigidbody.AddForceAtPosition (-Vector3.up * (mag * (wpos.y - hit.point.y) + dampCoeff*damp) , wpos);
    14.                
    15.  
    16.             }else
    17.                 rigidbody.AddForceAtPosition (-Vector3.up * (mag * (wpos.y ) + dampCoeff*damp) , wpos);
    18.         }          
    19.     }
    20. }
    21.  
    and this is a piece of the Start function from the ocean script:

    Code (csharp):
    1.  
    2.             tile = new GameObject ("WaterTile"+chDist);
    3.             tile.transform.position.x = cx * size.x;
    4.             tile.transform.position.y = -2.0 * chDist;
    5.             tile.transform.position.z = cy * size.z;
    6.             tile.AddComponent(MeshFilter);
    7.             tile.AddComponent("MeshRenderer");
    8.             tile.AddComponent(MeshCollider);
    9.             tile.renderer.material = material;
    10.            
    11.  
    12.  
    As you can see I've added a mesh collider to all water meshes... this piece of the Start function is within a loop, and iterates over all tiles

    anyways, the raycasting isn't working... my gizmos (which are tied to the blobs, just for visual representation) are just sitting there without moving...

    Oh, and I thought the raycasting might be hitting the boat or the terrain I added, so I moved these to the IgnoreRaycast layer

    any thoughts?

    Cheers
     
  50. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    500
    Ok, here's where I'm at... the raycasting didn't work... nor will the water mesh function as a collider, so I'm back to tweaking the getWaterHeight function

    I discovered one thing: it's returning a distance value in relation to it's local Y axis zero line... meaning that regardless of where, in relation to the Y=0 line the waves vertexes pass (either above or below it), the function will return a positive value, making the boat rise where it should descend, but also rise again when in should rise... it will never go below the water plane centerline

    the problem is that since it's calculating the distance from it's own centerline, moving the water plane above 0 doesn't help

    Now i'm trying frantically to tweak the return statement from that function to see if I get a proper result

    already I found that by negating the return value, I can make the gizmos trace the lower parts of the waves, instead of tracing the upper parts... now I gotta see if I can make that statement aware of the change in direction of that distance

    I saw that the getModulus method called in the return statement is naught more than a pythagorean theorem... well, that will only return positive distance values... so therein lies the problem

    But I'm not gonna mess around with that function... too many other methods are using it, so I have to stick to the return statement and tweak that

    more on this as it develops

    (sorry for the load of posts, but writing it all down helps me get the facts straight in my head)

    Cheers
     
unityunity