Search Unity

  1. 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

Ceto (Scrawks Ocean)

Discussion in 'Assets and Asset Store' started by scrawk, May 4, 2015.

  1. xdkSPG

    xdkSPG

    Joined:
    Mar 13, 2017
    Posts:
    25
    @vedddycent
    We're still using Ceto in a released title and have just updated to 2018.2.0f2 and Ceto is still working.
    However we're not using the Ceto buoyancy as it wasn't what we wanted for our title, instead we use a point based sampling like a lot of older water systems use to get the height for a grid of points within a volume.

    Now the reason that I came here today.

    I've been trying to get a roving/floating origin system working which has been covered in previous posts such as https://forum.unity.com/threads/ceto-scrawks-ocean.323545/page-28#post-2534877

    And for the most part this works, however we get a one frame graphical glitch but we're updating the AddFoamTrail objects and offseting the Ceto ocean grid which all looks correct. It almost looks like the shoreline foam is the culprit but I haven't definitively tracked it down yet.

    Does any else have any experience with roving-origins and Ceto that can shed some light on what this might be?

    Thanks

    Andy
     
    Last edited: Aug 2, 2018
  2. xdkSPG

    xdkSPG

    Joined:
    Mar 13, 2017
    Posts:
    25
    Just to followup on this, it looks like we can fix/avoid the problem by updating the overlay (UpdateOverlay()) after the call to WaveOverlay.Translate.

    This has probably been covered earlier in the thread but I either missed it or misunderstood it :)

    Hope that it helps others out.

    Andy
     
    jangomoose and twobob like this.
  3. bluroy

    bluroy

    Joined:
    Jan 6, 2019
    Posts:
    2
    Do you have video texture? Please, i need something like sea of thieves...
    Thanks!
     
  4. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    825
    For buoyance, you should look at this asset:
    https://assetstore.unity.com/packages/tools/physics/dynamic-water-physics-89928

    It's the best buoyance system I've seen in the store, others will just blow my objects into sky if the ocean got violent waves.
     
  5. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    87
    Thanks for the reply Harekelas,

    I used another one from the asset store, I can't remember which one but it is slightly cheaper.
    Anyway, it's nice to know of another buoyancy system :)
     
  6. Tony-Lovell

    Tony-Lovell

    Joined:
    Jul 14, 2014
    Posts:
    112
    I and several other Ceto users (former and current -- I still use it) have set up a Slack for Naval Simulation on Unity.

    Anyone who would like to chat with others facing the common challenges can join using this invitation link.

    Tony
     
    ftejada and jangomoose like this.
  7. Unity-IBR

    Unity-IBR

    Joined:
    Feb 28, 2015
    Posts:
    23
    Hi everyone
    I have a 3d model ship and, inside, the model of the command bridge with glass.
    If my camera is outside the model, the sea has no problem. If I bring the camera inside the command bridge (therefore it penetrates objects) the sea disappears or works incorrectly.
    Is it the fault of the Ceto asset? Has anyone already happened to this?
    Thank you @scrawk
     
  8. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    150
    Has anyone any ideas for best way of reducing tiling? It is quite visible when the waves are set low (low wind speed).
     
  9. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    87
    Which shader are you using transparent or opaque?
    If I remember correctly one works with transparent materials and the other doesn't
     
  10. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    87
    I think the only way is to increase the quality of Ceto using the UI.
    The settings are all there, you just need play around with them.
     
  11. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    konsic, xdkSPG, ron-bohn and 6 others like this.
  12. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
    That's awesome! I'm surprised Scrawk didn't post the announcement here.
    This should breath some life into Ceto! :D
     
    muzboz and jangomoose like this.
  13. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    432
    Does anybody know what needs to be done to get Ceto working with SteamVR?
    I'm using the version from Github and added CETO_USE_STEAM_VR.

    It works but tilting the head causes some offset in the far away see.
     
  14. MarcopoloR

    MarcopoloR

    Joined:
    Feb 4, 2015
    Posts:
    102
    Apparently with 2019.1 the underwater component no longer works with Ceto. When I attach the underwater post effect to the camera and push play there is a black screen now in the game view.
    Edit, just found out is has something to do with the post processing layer, not sure what yet. And it is only the above water that is rendered black. ...and it is with the directly to camera target checked.
     
  15. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    206
    Couple of questions:
    1. I can see what looks like unfinished/untested reflection probe usage for Ceto - did anyone ever get that working?
    2. Is there a way to make wave overlays affected (masked out) by shore masks? I have long wave overlays moving toward a coast line that I'd like to be masked out/reduced/removed by the shore mask.
     
  16. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    79
    Yeah, that's what shore mask is for. The "Height Mask" will reduce the wave heights, and "Clip Mask" will remove the ocean completely. In my projects, I just use the same shore mask image for both, plus "Foam Mask" for foamy edges.
     
    xdkSPG likes this.
  17. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    206
    Doesn't happen for me. In my project the shore height mask does reduce standard waves but wave overlays/height always appears whether the shore height mask is used or not.
     
  18. am_salperton

    am_salperton

    Joined:
    Mar 6, 2017
    Posts:
    9
    I've been trying to figure that out, but most oceans for Unity seem to have horrible problems with VR.
     
  19. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    206
    Anyone ever run into an issue where Ceto water disappears if you reload a scene or additive load from another scene?
     
  20. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    206
    We have further narrowed the above issue down, we're losing mesh filter references. Here's the error:

    <color=red>Ceto (1.1.4) Error:</color> System.NullReferenceException
    at (wrapper managed-to-native) UnityEngine.MeshFilter.get_mesh(UnityEngine.MeshFilter)
    at Ceto.ProjectedGrid.ResetBounds (Ceto.ProjectedGrid+Grid grid) [0x00055] in <39d88355d6b5447c841fec0ce25954cc>:0
    at Ceto.ProjectedGrid.UpdateGrid (Ceto.ProjectedGrid+Grid grid) [0x00000] in <39d88355d6b5447c841fec0ce25954cc>:0
    at Ceto.ProjectedGrid.Update () [0x0009a] in <39d88355d6b5447c841fec0ce25954cc>:0

    Were using 2018.3 and the latest github Ceto.

    It's a build-only problem. If we load the scene with the ocean first, it renders fine. If we reload the scene again though, or additively load from another scene, the ocean doesn't render and we get the above error.

    It seems we're missing a MeshFilter reference in ResetBounds, and there's two bits of code like this which is (to my novice coder eyes) the culprit:

    for (int i = 0; i < count; i++)
    {
    grid.topFilters.mesh.bounds = bounds;
    }

    Here's a debug log showing the list of mesh filters working correctly/finding references:

    == UNDER FILTERS: Ceto UnderSide Grid LOD: HIGH Ceto UnderSide Grid LOD: HIGH Ceto UnderSide Grid LOD: HIGH Ceto UnderSide Grid LOD: HIGH Ceto UnderSide Grid LOD: etc

    But when we see the error, right as we activate the scene, during CreateGrid() my debug shows all the mesh filters being null.

    == UNDER FILTERS: null null null null null null null null null null null null

    Totally stuck at this point so would love a hand if anyone has any ideas!
     
    RKeown3D likes this.
  21. WimB

    WimB

    Joined:
    Sep 23, 2014
    Posts:
    27
    @scrawk Is there a solution for water on ipad? We just did a build and the water is not working, works in the editor in play mode just not on the build. Just wondered if its supported?
    Thanks
     
  22. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    65
    I had VR planar reflections working with Ceto once upon a time. It was absolutely gorgeous...not had much luck in recent versions of unity though unfortunately. It really is a shame that water reflections in VR aren't more of a standard priority.
     
    jangomoose likes this.
  23. muzboz

    muzboz

    Joined:
    Aug 8, 2012
    Posts:
    76
    Not sure if anyone ever replied to this, but there is info in the Ceto manual about what you need to do to get CETO working nicely with Steam VR.

    Check out the manual here. It's for CETO 1.1.3, but should still be correct for more recent versions of CETO.

    Of note, this might be what you're looking for...

    "From Unity version 5.4 you must use the USE_OCEAN_DEPTH_PASS as the depth mode on the underwater component with SteamVR. The new changes mean that the USE_DEPTH_BUFFER option is not correct for each eye."
     
  24. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    I wish the author hadn't deprecated this, I thought it was the best looking water I've seen in Unity.
     
  25. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    It's open source now: https://github.com/Scrawk/Ceto
     
  26. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
    although it doesn't work properly with aura 2... :(
     
  27. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    Yeah, guess if I can figure it out.
     
  28. RKeown3D

    RKeown3D

    Joined:
    Oct 14, 2014
    Posts:
    174
    Were you able to find a resolution to this? I'm only getting this on built projects and not in Editor mode. If you haven't, and I come up with something, I'll let you know.
     
  29. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    206
    Not 100% sure but I think it might have had something to do with scene loading order/which scene was SetActive and when with multiple scenes. Pretty sure what happened was Ceto, in Awake(), before our level scene was SetActive, was getting created/placed in our manager scene when it should have gone in the level scene itself. Then it wasn't removed properly, got reloaded/recreated > problems!
     
    Last edited: Dec 18, 2019
  30. RKeown3D

    RKeown3D

    Joined:
    Oct 14, 2014
    Posts:
    174
    Okay, so it looks like there are a few issues going on:

    1) The Ceto GameObject needs to be disabled until the scene containing it is fully loaded, 100%.
    2) There appears to be a concurrency issue as well on the m_grids Dictionary object, and this may be why the meshes would build appropriately, but throw a null exception within the ResetBounds(Grid) function. I changed this to a ConcurrentDictionary object, and changed all calls to the m_grids database to use TryAdd, TryGetValue, and TryUpdate.
    3) I also modified the ProjectedGrid.Grid class to have a HasValidData() method, which checks all Renderer, MeshFilter and GameObject Lists to see if they are all have a Count > 0 and a (System.Linq) Count(obj => obj == null) == 0.

    This gets called in the ProjectedGrid.CreateGrid(MESH_RESOLUTION) method, when he's checking to see if the grid was already created.


    if (grid.screenWidth == screenWidth && grid.screenHeight == screenHeight && grid.groups == groups && grid.HasValidData()) {
    //Have already created a grid for this
    //resolution at the current screen size
    return;
    } else {
    //Grid has either not been created or the screen has been resized.
    //Clear grid and create.
    ClearGrid(grid);

    grid.screenWidth = screenWidth;
    grid.screenHeight = screenHeight;
    grid.resolution = resolution;
    grid.groups = groups;
    }
     
    Exbleative likes this.
  31. satanlaurent

    satanlaurent

    Joined:
    Nov 16, 2019
    Posts:
    1
    I'm using DeepHaze scripts for my player camera which apply fog, my CETO do not show any blue or any color shader underwater as well when I turn off DeepHaze fog from players camera, I cant download the attached earlier pdf. Does anyone know what might be the problem? Ideally, id love to preserve DeepHaze fog on players camera and combine with working underwater shader
     
  32. RKeown3D

    RKeown3D

    Joined:
    Oct 14, 2014
    Posts:
    174
    Is this happening in the Editor or just in the build?
     
  33. RKeown3D

    RKeown3D

    Joined:
    Oct 14, 2014
    Posts:
    174
    How so? I'm running Aura 2, and haven't seen anything odd, except for the issues I'm running into using Multiple Scenes, which is unrelated to Aura 2. I'm working on a fix for this now, for Exbleative and myself.
     
  34. RKeown3D

    RKeown3D

    Joined:
    Oct 14, 2014
    Posts:
    174
    Ok, the last piece of the puzzle, for Multiple Scenes that is, has to do with the Underwater only rendering 50% of the Screen. There was an issue in one of the earlier versions of Ceto, v1.1.1, I believe, that had to do with removing a line of code from the CreateBottomMesh function in Underwater.cs. The line of code was as follows:

    Code (CSharp):
    1. mesh.UploadMeshData(true);
    Unfortunately, Scrawks had already addressed this issue, and this is no longer the cause.

    What appears to be causing it now, to occur, is the the UnderWater.m_bottomMask GameObject is getting set back to null at some point, but only occurs in builds and not editor.

    To fix this, I moved all of the code inside of the Try/Catch of UnderWater.Start function, into it's own, called BuildBottomMask(). I then added a check on UnderWater.Update() to check to see if m_bottomMask == null, and if it is, call BuildBottomMask(), and that has fixed all issues I've found regrading Ceto not working in builds, in which Multiple Scenes are in use.

    On a side note, I'm also using Sector 2019 for managing multiple scenes, which is awesome, by the way!!

    If I come across anything else, I'll post it up here.

    Happy Holidays everyone!!!
     
    John-G and recon0303 like this.
  35. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    Thanks for this info. !
     
  36. cypronia

    cypronia

    Joined:
    Nov 9, 2015
    Posts:
    1
    Hi,

    I'm currently porting my project (which is using Ceto) to Xbox One platform but I encountered a quite an annoying problem. Xbox uses AOT compiler only and because of it, the WaveSpectrum component doesn't work at all and results in the water surface being completely flat.
    Spcifically, it returns an error:
    Code (CSharp):
    1. Mono: AOT FOUND AOT compiled code for System.ExecutionEngineException:.ctor () 00000106C3E6B770 - 00000106C3E6B7A0 00000106C432E008
    2. [576:] EXCEPTION handling: ExecutionEngineException
    3.     Attempting to JIT compile method 'System.Collections.Generic.LinkedList`1<System.Collections.Generic.KeyValuePair`2<Ceto.WaveSpectrumConditionKey, Ceto.WaveSpectrumCondition>>:.ctor ()' while running with --aot-only.
    Has anyone else encountered a similar problem and if yes, how did you resolve it? I did look into it and found some sort of workaround in Unity documentation but it doesn't work at all.
     
  37. AlteredPlanet

    AlteredPlanet

    Joined:
    Aug 12, 2013
    Posts:
    455
    multithreading only works in compiled build?
     
  38. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    150
    There was a new forum set up for Ceto users - any idea if it is still around?
     
  39. Tony-Lovell

    Tony-Lovell

    Joined:
    Jul 14, 2014
    Posts:
    112
    What version of Unity is most compatible with the latest version of Ceto on Github?

    edit/update:
    Ceto 1.1.4 (from github) works nicely with Unity 2020.1.f1

    It was not working initially, but the Demo Scene was. I fixed my game by carefully scrutinizing differences between camera and ocean between the Demo Scene and my own.

    I am not using VR, and rely on the default rendering stack.
     
    Last edited: Aug 14, 2020
  40. MixedupJim

    MixedupJim

    Joined:
    Mar 12, 2018
    Posts:
    6
    For anyone who is still using CETO (v1.1.3 from github)and wants to get planar reflections working as well as underwater camera with SteamVR then this is what I did....

    Replace OceanVR.cs with the following code. This will fix the reflections and update the CETO to use the latest version of Steam VR. It's actually an easy fix....mainly just a change from "using UnityEngine.VR" to "using Valve.VR"

    I'm now happily using CETO in VR on Unity 2019.2.3f1

    Don't forget to apply the other SteamVR requirements as documnented in the manual i.e. adding CETO_USE_STEAM_VR and setting the ocean to USE_OCEAN_DEPTH_PASS.

    Code (CSharp):
    1. #if !( UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 )
    2. #define UNITY_540_OR_HIGHER
    3. #endif
    4.  
    5. using UnityEngine;
    6. using Valve.VR;
    7. using System.Collections;
    8.  
    9. namespace Ceto
    10. {
    11.  
    12.     public static class OceanVR
    13.     {
    14.  
    15.         public static bool OpenVRInUse { get; private set; }
    16.  
    17.  
    18.         public static void Initialize()
    19.         {
    20.  
    21. #if UNITY_540_OR_HIGHER && CETO_USE_STEAM_VR
    22.             OpenVRInUse = UnityEngine.XR.XRSettings.loadedDeviceName == "OpenVR";
    23. #endif
    24.  
    25.         }
    26.  
    27. #if UNITY_540_OR_HIGHER && CETO_USE_STEAM_VR
    28.         public static void GetSteamVRLeftEye(Camera cam, out Vector3 position, out Quaternion rotation, out Matrix4x4 projection)
    29.         {
    30.  
    31.             position = cam.transform.TransformPoint(SteamVR.instance.eyes[0].pos);
    32.             rotation = cam.transform.rotation * SteamVR.instance.eyes[0].rot;
    33.             projection = GetSteamVRProjectionMatrix(cam, Valve.VR.EVREye.Eye_Left);
    34.  
    35.         }
    36.  
    37.         public static void GetSteamVRRightEye(Camera cam, out Vector3 position, out Quaternion rotation, out Matrix4x4 projection)
    38.         {
    39.  
    40.             position = cam.transform.TransformPoint(SteamVR.instance.eyes[1].pos);
    41.             rotation = cam.transform.rotation * SteamVR.instance.eyes[1].rot;
    42.             projection = GetSteamVRProjectionMatrix(cam, Valve.VR.EVREye.Eye_Right);
    43.  
    44.         }
    45.  
    46.         public static Matrix4x4 GetSteamVRProjectionMatrixLeftEye(Camera cam)
    47.         {
    48.             return GetSteamVRProjectionMatrix(cam, Valve.VR.EVREye.Eye_Left);
    49.         }
    50.  
    51.         public static Matrix4x4 GetSteamVRProjectionMatrixRightEye(Camera cam)
    52.         {
    53.             return GetSteamVRProjectionMatrix(cam, Valve.VR.EVREye.Eye_Right);
    54.         }
    55.  
    56.         static Matrix4x4 GetSteamVRProjectionMatrix(Camera cam, Valve.VR.EVREye eye)
    57.         {
    58.             Valve.VR.HmdMatrix44_t proj = SteamVR.instance.hmd.GetProjectionMatrix(eye, cam.nearClipPlane, cam.farClipPlane);
    59.             Matrix4x4 m = new Matrix4x4();
    60.             m.m00 = proj.m0;
    61.             m.m01 = proj.m1;
    62.             m.m02 = proj.m2;
    63.             m.m03 = proj.m3;
    64.             m.m10 = proj.m4;
    65.             m.m11 = proj.m5;
    66.             m.m12 = proj.m6;
    67.             m.m13 = proj.m7;
    68.             m.m20 = proj.m8;
    69.             m.m21 = proj.m9;
    70.             m.m22 = proj.m10;
    71.             m.m23 = proj.m11;
    72.             m.m30 = proj.m12;
    73.             m.m31 = proj.m13;
    74.             m.m32 = proj.m14;
    75.             m.m33 = proj.m15;
    76.             return m;
    77.         }
    78. #endif
    79.  
    80.     }
    81.  
    82. }
     
    ProtoPottyGames and jangomoose like this.
  41. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    65
    Also maybe good to mention if anyone uses above/below surface that you can easily save a mess of frames by dynamically flipping between underwater modes in relation to the ocean level based on camera height instead of just having them both on all the time.


    Code (CSharp):
    1.  
    2.  
    3.     public Ocean cetoOcean;
    4.     private UnderWater cetoOceanUnderwaterSettings;
    5.     public Transform mainCamTransform;
    6.     private float waterSurfaceHeight;
    7.  
    8.     void Start()
    9.     {
    10.         cetoOcean = FindObjectOfType<Ocean>();
    11.         waterSurfaceHeight = cetoOcean.level;
    12.         cetoOceanUnderwaterSettings = cetoOcean.gameObject.GetComponent<UnderWater>();
    13.     }
    14.  
    15.     void Update()
    16.     {
    17.         if (mainCamTransform.position.y >= waterSurfaceHeight)
    18.         {
    19.             cetoOceanUnderwaterSettings.underwaterMode = UNDERWATER_MODE.ABOVE_ONLY;
    20.         }
    21.         else
    22.         {
    23.             cetoOceanUnderwaterSettings.underwaterMode = UNDERWATER_MODE.BELOW_ONLY;
    24.         }
    25.     }
    Woops! Probably dont need the
    waterSurfaceHeight = cetoOcean.level;
    bit in Update() unless theres some weirdo reason you need to move it around during runtime.....Edited.
     
    Last edited: Aug 30, 2020
    jangomoose likes this.
unityunity