Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Ceto (Scrawks Ocean)

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

  1. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    As John said use the opaque queue ocean prefab. The issue is being looked at by Rodrick at the moment.
     
    sashahush likes this.
  2. sashahush

    sashahush

    Joined:
    Sep 5, 2012
    Posts:
    75
    Thank you John and Scrawk!
    Will try this out today!
     
  3. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    There is a auto shore line script coming for the next version.

    And it to a terrain and it will create a shore line automatically at run time.

    Its easy to use but the effect is pretty basic and will be to slow for very large terrain.

    I think a lot of people will still find it useful however.

    With it you can mask the waves heights, white cap foam and normals near the shore, you can clip away the areas under the terrain and it will add a ring of edge foam around the terrain.

    Im going to attach the scripts now so people can try it now if they want. Just add the 2 scripts to the Ceto folder.

    CetoShoremask.jpg
     

    Attached Files:

  4. sashahush

    sashahush

    Joined:
    Sep 5, 2012
    Posts:
    75
    Woohoo! Great work, can't wait to add this.
     
  5. JJJohan1

    JJJohan1

    Joined:
    Oct 13, 2013
    Posts:
    11
    Hi Scrawk, I've recently spent some time integrating Ceto Ocean into a large non-game related commercial project, modifying it a fair bit (which will no doubt make upgrades a bit trickier) to accept things such as land masks and integrating it with a custom depth and silt system. Without going into proprietary details our project works on a huge scale with double precision where the camera is always at (0,0,0) to retain floating point accuracy. In addition we also use real-world units of length.

    I'm currently exploring the workings of the Unity asset to try and implement a system where the wind speed and wave height are directly correlated, and follow the Beaufort Scale. I noticed that based on some comments around constants the "max wave heights" are based from observation rather than a formula (which is of course unnecessary for most applications). Is there any chance you'd be able to point me in the right direction? So far I'm circling around WaveSpectrum.cs which has a HeightMap/Buffer and OceanDisplacement.cginc which has all the displacement CG functions. Otherwise will keep digging away at it, excellent job nonetheless :).
     
  6. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804

    Hi,

    That sounds like a rather complicated project. :)

    If you do need to modify Ceto feel free to let me know if there is anything I can change in the design to make customisation easier. Otherwise upgrading does become a pain as you know.

    There is a max wave height const. It's in the Ocean.cs script. It's just used to clamp the wave height to a max value. If there's no limit on the wave height it can cause issues in certain cases. It's set quite hight by default but is being lowered a bit in next update.

    If you want to implement a Beaufort scale style spectrum you will need to modify the way the spectrum is created. Go to the CreateSpectrumTask script. This is what creates the spectrum and it uses the unified spectrum which is based on the wind speed and wave age.

    In this script there is a Spectrum function. Thats what will need to change. I think it's possible to change the math so its based on a Beaufort scale instead but Im not sure how at the moment. Just be aware that these calculations don't run on the main thread and the spectrum code will change a lot in the next update. Its been optimized a lot and supports more features like variable number of grids and spectrum types.

    The other option is to just add a Beaufort setting in the WaveSpectrum script and then 'calibrate' what wind speed should be used for what scale and then just change the wind speed to that amount. Not sure if that's what you had in mind though.

    If you go into the WaveSpectrum script you will see there is CreateConditions function down near the bottom.
    This is where the code actually creates the spectrum using the CreateSpectrumTask script. There are a number of settings the spectrum is created from (wind speed, wave age, fourier size and wind dir). If any of these change during run time the code creates a task to recreate the spectrum and runs it on a separate thread. When the task is done the new spectrum data gets swapped out with the old one.
     
  7. Saevax

    Saevax

    Joined:
    Nov 3, 2012
    Posts:
    58
    I've had trouble getting a WebGL build going and I think ceto is causes one of my problems. I suspect it has to do with System.Threading not being supported in WebGL at all.

    I created a new scene (with just a camera and a light) and added Ocean_TransparentQueue and I can't run a WebGL build:

    Wall of text:


    Code (CSharp):
    1. Initialize engine version: 5.3.2f1 (e87ab445ead0) UnityLoader.js:1:31246
    2. Creating WebGL 1.0 context. UnityLoader.js:1:31246
    3. Renderer: Mozilla UnityLoader.js:1:31246
    4. Vendor:   Mozilla UnityLoader.js:1:31246
    5. Version:  WebGL 1.0 UnityLoader.js:1:31246
    6. GLES:     0 UnityLoader.js:1:31246
    7. ANGLE_instanced_arrays GL_ANGLE_instanced_arrays EXT_blend_minmax GL_EXT_blend_minmax EXT_color_buffer_half_float GL_EXT_color_buffer_half_float EXT_frag_depth GL_EXT_frag_depth EXT_shader_texture_lod GL_EXT_shader_texture_lod EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic OES_element_index_uint GL_OES_element_index_uint OES_standard_derivatives GL_OES_standard_derivatives OES_texture_float GL_OES_texture_float OES_texture_float_linear GL_OES_texture_float_linear OES_texture_half_float GL_OES_texture_half_float OES_texture_half_float_linear GL_OES_texture_half_float_linear OES_vertex_array_object GL_OES_vertex_array_object WEBGL_color_buffer_float GL_WEBGL_color_buffer_float WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_depth_texture GL_WEBGL_depth_texture WEBGL_draw_buffers GL_WEBGL_draw_buffers WEBGL_lose_context GL_WEBGL_lose_context MOZ_WEBGL_lose_context GL_MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc GL_MOZ_WEBGL_compressed_texture_s3tc MOZ_WEBGL_dep UnityLoader.js:1:31246
    8. th_texture GL_MOZ_WEBGL_depth_texture UnityLoader.js:1:31246
    9. OPENGL LOG: Creating OpenGL ES 2.0 graphics device UnityLoader.js:1:31246
    10. UnloadTime: 0.800000 ms UnityLoader.js:1:31246
    11. missing function: pthread_create UnityLoader.js:1:31293
    12.  
    13. -1 UnityLoader.js:1:31246
    14. -1 UnityLoader.js:1:31293
     
  8. Killersan

    Killersan

    Joined:
    May 27, 2014
    Posts:
    76
    Unistorm Basic Example C# scene with only Ceto added to it and I have such problem.
    I saw it in one of the previous thread but I can't fix it in my project.
    upload_2016-2-2_15-25-25.png
     
  9. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Yes sorry, Ceto is not working with webGL. I only found out about it recently and have not had time to look into it. If webGL does not support system threading then that would explain it.

    I will try and look into it and if it's a simple fix it may make it into next update.

    I presume you mean the sun in the sky not matching the ocean.

    I think that maybe a Unistorm issue. I will ask the Unistorm author and get back to you.
     
  10. imtehQ

    imtehQ

    Joined:
    Feb 18, 2013
    Posts:
    232
    Nice work on the shore generator, this is how i got it to look :)

     
    scrawk likes this.
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Nice, is there a falloff adjustment so it's more gradual?
     
  12. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    This is entirely a UniStorm issue. Has nothing to do with Ceto. The last UniStorm update was supposed to fix it but did not.
     
    hopeful likes this.
  13. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I have 5.3.1p4 and 5.3.2p1 and am running into a really odd issue with Ceto and particles. If I turn on the projected grid in the scene my particles go crazy. They are transparent in nature and it appears that the grid is making them go all buggered. Any thoughts on this? I have tried changing queue order and using different shaders but it seems that any transparent ones will render behind the grid.

     
  14. imtehQ

    imtehQ

    Joined:
    Feb 18, 2013
    Posts:
    232
  15. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    There is a falloff slider to control that. There is also a alpha slider that adjusts the overall strength.

    That is strange. This only started in Unity 5.3.1?

    I will try and sort it out. I don't know what could make them flicker like that.

    That smoke one look like it is being drawn over the ocean, bit hard to tell though.

    The splash looks like it is alpha tested? If so the opaque ocean prefab renders right at the end of the alpha tested queue so that maybe the reason. Can you tell me what the water splash ones render queue number is.


    I have not checked the build with the new shore line scripts. Was not expecting a issue. Im setting the alphaIsTransparency to true but look like Unity does not like this in the build which is strange. Should be able to have that fixed no prob.
     
    hippocoder likes this.
  16. revox2006

    revox2006

    Joined:
    Jun 19, 2015
    Posts:
    22
  17. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Gotta say, the latest Tenkoku and Ceto look great together.
     
    Evil_Moo, John-G, chingwa and 3 others like this.
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I was wondering (hoping) for ceto docs to have a guide for performance optimisations in games which have a lot of land going on - bit lost where I should be looking into it, I don't need to optimise for a few months though, so I thought it might be a nice addition to any roadmaps you might have @scrawk
     
  19. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Hi,

    Have you added Cetos UnderWaterPostEffect script to the camera?

    There are some optimizations you can do in this case and I am planning on finishing of the manual with this information after the next update.

    Basically if your far from the ocean but can still see it on the horizon in places I would disable the WaveSpectrum and UnderWater scripts and put the PlanarReflection to reflect sky box only and the projected grid resolution to low. The ocean should be very cheap to render in this case.

    If you also clip away the ocean where it is under the terrain with a clip mask you can set the Underwater post effect script on the camera to disable on clip and it wont render the mask when your on the land which helps with performance as well. There's a few other tips like this.

    The manual has been neglected so far as all my spare time has been taken up by support, bug fixes and new features.

    A nice pretty manually with lots of images and content is planned.
     
    revox2006 and John-G like this.
  20. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    I just got Ceto, it's pretty much solved my years of dissatisfaction with Unity water. So thanks for that :) The recent deal was too good so I snapped up Ceto and Tenkoku at once.

    Just one thing I'm having an issue with. And seeing that sunset image CaptainMurphy just posted leads me to believe I must have missed something. I'm using Tenkoku as well but when I change to night the Ceto ocean stays bright like it's still day. Is there some ambient light setting I need to mess with? I'm not sure what's going on.
     
  21. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,623
    I had a very similar issue with particles, but a different image effect though.

    It turned out to be a bug in Unity. Once the material was using a shader that has a custom RenderQueue Tag, no matter what shader you assign to the Material later, it was always using the render order of its first assigned shader.
    To see if this is the same issue you experience, you can try this:
    • Select particles material that causes problems
    • Switch Inspector to Debug mode
    • Set "Custom Render Queue" to -1 in Inspector
    -1 indicates to use/fetch the render queue from the shader (rather than using the cached one in the material). Doing these steps fixed any odd particle order/post-processing issues here.

    Hope it helps!
    Peter
     
    scrawk likes this.
  22. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    If you click on the ocean prefab and look on the ocean component there is a sun slot.

    Try adding the directional light your using as the sun to this.

    Ceto uses a directional for certain things. Not much at the moment, mostly for the subsurface scatter.

    If you leave it null Ceto will default to using a up vector as the direction for the sss and it will still be bright at night which I think is whats happening here.
     
  23. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Thanks for the info! For now we rolled back to 5.2.3 in the meantime until Unity sorts that one out.
     
    scrawk likes this.
  24. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    I just bought Ceto and it's looking good on PC, however when I build to PS4, the ocean doesn't show up.
     
  25. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Hi,

    I think there is a shader error on PS4.

    Can you check the log file to see if there are any errors?
     
  26. revox2006

    revox2006

    Joined:
    Jun 19, 2015
    Posts:
    22
    Anything I can do to optimize this low to ultra get around 27fps (extreme 17fps) which isn't much to play with when building my environment remove ceto and I'm on 80.
     
  27. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    That's sounds a bit low. Can you run the Ceto demo scene and see what the fps is. It would also help to know what GPU you have so I can tell you want fps you should expect. It may also help to look in the profiler to see what is taking the most time.

    If you have a large scene with lots of objects in it the default reflection mask is set to reflect everything which will be slow. Can you set the mask to nothing and see if that helps the fps. If so then you need to go through and decide what exactly you want to reflect. Most games cant afford to reflect everything.

    If your using the opaque ocean prefab there is also a under water mask which you also need to check.
     
  28. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    That all sounded right. I didn't have the Tenkoku light as the Ceto Sun. But after fixing that it's still wrong. It seems setting the sun in there only fixes the sss. The sun affecting the ocean seems to be automatic.

    I tried in a fresh project and got better results. Not sure what's up with that. Will do some more tests later on.

    If I turn the Above Inscatter Modifier right down it seems to fix it. But the setting I've got there looks good during the day. I also tried putting a really large black plane under my terrain so the sky wasn't visible under the water level. It had some effect but not much. Still seems to be the amount of "fog" under water which isn't getting darker during night.
     

    Attached Files:

  29. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    It seems to be a Linear vs Gamma thing. Are we supposed to only use Ceto in Gamma? Cause I thought that was the less good option.
     

    Attached Files:

  30. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Was looking at some of the code involving how time was used to create wave data and had a couple of questions.

    So I'm assuming the time value is used in the wave generation. I tracked it down to where it was setting the time value on a material but couldn't tell if that was for the gpu or cpu version.

    The following code kind of implies that wave generation should be happening every frame. The default time used by Ceto(Time.time) is updated every time Update runs, so it's only the occasional buffer not being finished that results in it not running every frame. Which means that just having time synchronized isn't good enough, it has to be synchronized at a specific precision, ie the Update cycle.



    Code (CSharp):
    1. //If the buffers has been run and this is the same time value as
    2.                 //last used then there is no need to run again.
    3.                 if(!m_displacementBuffer.HasRun || m_displacementBuffer.TimeValue != time)
    4.                 {
    5.                     m_displacementBuffer.Run(m_conditions[0], time);
    6.                 }
     
  31. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    Yes, there are a bunch of errors listed. I've pasted them into the attached .txt
     

    Attached Files:

  32. XaneFeather

    XaneFeather

    Joined:
    Sep 4, 2013
    Posts:
    98
    Having the same issues in darker scenes using linear lighting. I'm assuming it was written with gamma in mind primarily, any ETA on full linear support?
     
  33. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    (also at @XaneFeather )

    Linear is fully supported in Ceto and I have run it in projects that use linear/HDR and it worked fine.
    The first image you posted looks way to bright so some things not right there.

    I don't know if its a Ceto bug or just something about the settings. I will have to look into it and get back to you.

    It might be worth disabling the reflection or underwater script to see which one is adding the most brightness. If they are disabled the ocean will use the default colors on the ocean component.

    EDIT - The Ceto demo scenes found on the asset store page use linear/HDR and when I lower the sun it doesn't look to bright to me. Maybe the SSS intensity and ambient light is a little high but they could just be lower.

    Ok, thanks. I think I know what is causing that. There is a tex2d function that I did not know is not supported on PS4.

    I will have it fixed for the next update. I will try and send you a fixed copy in the next few days.

    The waves are generated based of a time value and yes it uses what ever the current time value is in the update function.

    Yes the wave data should be generated every frame. In the case of the CPU displacement data if the current task has also ended which may take more than one frame.

    If the time value is the same as the time value in the previous frame (this will happen if the wave speed is set to 0 or Unitys time speed is slowed to 0) then the wave data generated will be exactly the same as what was generated before so there no point in running again.

    Other than that I don't really understand what point your trying to make or what your question was sorry.

    Unity updates this value at the beginning of the frame so all update function will see the same time value.
     
    Last edited: Feb 4, 2016
  34. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    I just imported Ceto Ocean System 1.0.9 into a new empty project, switched to Linear rotated the light and pressed play and it looks like this. Does this not happen for others? Happens in both DX9 and DX11, with or without the direct light in the sun slot.

    I can manually bring the brightness down and get it looking right by dropping these values;

    Foam Intensity to 0.2
    Sub Surface Scatter Modifier to 0.2
    Above Scatter Modifier to 0.1

    But obviously this screws up the day settings. Or you can make the associated colours that go with each of those much darker, almost black, and it comes right too. So in my limited understanding of how Ceto works, it's almost like those colours aren't being gamma corrected (or uncorrected?)
     

    Attached Files:

  35. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    Thanks Scrawk, that would be fantastic!
     
  36. Uli_Okm

    Uli_Okm

    Joined:
    Jul 10, 2012
    Posts:
    95
    Tried the same things as you (using both Tenkoku and the blank project - Linear Deferred), and i can say that this happens to me as well in both cases, dont matter if setting the sun slot or not. Even in the Ceto demo scene.

    BUT when i was testing with Tenkoku, one time i didn't set the Sun slot and everything was perfect (i got the dark ocean at night), but as soon as I set the Sun slot the Ocean never got dark again, don't matter if setting the sun slot or not (this happened only one time, so maybe it's not relevant)
     
    scrawk likes this.
  37. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    It's quite possibly a bug some where to do with color space but I'm not sure at the moment. I will look into it.
     
  38. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi, I'm wondering whats the performance like compared to Suimono Water, sui is so fps heavy and is completely broke for the latest version of Unity. Thanx Jimbob
     
  39. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Hi. I'm not familiar enough with Suimono to make a comparison but I can tell you what performance to expect with Ceto.

    Ceto will use about 1-2ms a frame depending on the settings. That's on a 3 year old i7 CPU. The next version has halved that.

    ( the following fps is based on a 1920 by 1040 screen )

    The shader will run at around 500fps at full screen with just the ocean in a GTX 770. I'm not sure exactly but a 660 will be around 100.

    On older basic cards like a GTX 610 you should only expect around 30 fps but you can get up to 60 if the screen resolution smaller.
     
    llJIMBOBll likes this.
  40. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I am using a 660GTX and with one of our newer ships (higher detail), Tenkoku, and Ceto we are sitting pretty at 160-180fps in editor.
     
    llJIMBOBll and scrawk like this.
  41. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Well ya but if you are syncing with a server it's a bit different. My point was that it's not obvious on the surface that you actually need to step your time with Update using Time.Deltatime.

    For others that need to do this here is some code that works. SetTime is being called every Update from a component. time is the latest epoch time from the server, which doesn't get updated as often as Update runs.

    Code (CSharp):
    1. public OceanTime() {
    2.             Now = Time.time;
    3.         }
    4.  
    5.         public float SetTime(float time) {
    6.          
    7.             Now += Time.deltaTime;
    8.  
    9.             float timeDiff = Mathf.Abs(Now - time);
    10.  
    11.             if (timeDiff > 1f) {
    12.                 Debug.Log("Time out of sync " + timeDiff);
    13.                 Now = time;
    14.             }
    15.             return Now;
    16.         }
     
  42. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    My bad the time from server is not exactly epoch time. I set a start time when the server starts to epoch time, then on every outgoing update to the client I send (epochTime - startTime).
     
  43. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Hi,

    I'm using the Ocean system in one of my projects. I'm wondering if it would be possible to "limit" the size of the projected ocean and to have multiple instances.

    I'd like to use the system to create lakes and larger in-land water surfaces. The documentation does not show any information on this.
     
  44. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    I kinda thought the question was in relation to a server type set up but I was not sure.

    Yes, your will need to implement your own IOceanTime and add it to the ocean in this case so you can sync the time with your server.

    Sorry but this is not possible.

    There can only be one projected grid and it will always be projected to where the camera is looking.
     
  45. Killersan

    Killersan

    Joined:
    May 27, 2014
    Posts:
    76
    scrawk likes this.
  46. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    Just updated to Unity 5.3.2 and am now getting this error message in the console.

    I don't get this in the Ceto demo scene, only in my own scenes. Is there something in my player camera setup that could be causing it?
     
  47. Killersan

    Killersan

    Joined:
    May 27, 2014
    Posts:
    76
    Yes I had similar problem when I had particles in same camera as Ceto one. Try to disable particles.
     
  48. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,623
  49. Saevax

    Saevax

    Joined:
    Nov 3, 2012
    Posts:
    58


    Have you thought about developing some sort of global fog, skydome, horizon blending, or something similar to Horizon[ON] for Ceto and selling it separately? For smaller far clip planes that weaker systems require the lower half of the skybox becomes visible at higher altitudes, the same goes for below the ocean but your underwater fog script handles that to a degree.
     
  50. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    As far as I know this a bug in Unity 5.3. Unity has re-written there particle engine in this version and there are a few bugs.

    There maybe something I can do in Ceto's code to stop it happening but I have not found a solution yet.

    The only way I know is deselect what ever layers the particles are on in the reflection mask.

    If I was to do this then people would want all the features that come with a sky asset and its not something I am keen to do. There are a lot of sky assets on the store already. Surely one has a solution to this?
     
    hippocoder likes this.