Search Unity

Ceto (Scrawks Ocean)

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

  1. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804

    Ceto has now been depreciated and is no longer available.

    Ceto: Ocean System.


    Ceto brings advanced ocean effects to your game. From first person games where the ocean is just a back drop to fully interactive shipping simulations where the ocean is the focus of the application. Ceto has the ability to be customized to your needs.

    There is also a manual that can be downloaded here.

    Ceto requires a minimum of shader model 3 and is not recommended for mobile devices. Ceto does not work on some Android and iOS phones.

    Features

    - Open source. All scripts and shaders included. No DLL's or precompiled shaders used.

    - Ceto uses 5 shader key words. All can be removed if needed.

    - Edge fade around the shore line to provide soft edges where the ocean meets the terrain.

    - Caustics applied to all objects under the water automatically. No modification of the objects shader needed. All done cheaply via the ocean shader.

    - Uses a projected grid as the mesh to provide you with a infinite ocean plane while still retaining enough detail in the mesh for small scale waves.

    - Fast querying wave information (like wave height) at any location.

    - Wave generation is decoupled from the rendering. So If you need a server to just generate the wave data for buoyancy calculations and not render anything you can.

    - Wave generation using FFT. Option to run the FFT on the CPU using multi-threading or on the GPU. Allows the best performance options for your game needs.

    - Option for a range of spectrum types. Phillips, Unified or a mixture of the two. The choice of using between 1 to 4 grids for the wave textures. More grids means more detail but higher performance cost. Support for adding your own custom spectrums if required.

    - Ability to easily modify wave conditions in local areas using the overlay system. Mask out the waves near your shore lines, add foam trails to ships or clip away the ocean mesh for inland caves.

    - Ability to change waves conditions quickly. Go from calm to rough seas in a instant.

    - Uses Multi-threading for all performance intense operations. No blocking of the main thread.

    - Provides seamless transition from above to below the water with a underwater fog effect.

    - Uses a Custom BRDF lighting model so the ocean surface will look as realistic as possible.

    CetoSunset.jpg

    Note - The mesh resolution has been set to extreme on the image below which may not be practical for most systems.

    Ocean44.jpg

    The projected grid as seen from the scene camera. Notice the mesh is only rendered where the cameras frustum is.

    Ocean3.jpg

    Screenshot_04.jpg
     
    Last edited: Sep 9, 2017
  2. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Nice! Looks Amazing.
     
    Last edited: May 6, 2015
  3. Whiteleaf

    Whiteleaf

    Joined:
    Jul 1, 2014
    Posts:
    728
    This looks awesome. One of the best water shaders I've seen yet with Unity 5!
     
  4. Uli_Okm

    Uli_Okm

    Joined:
    Jul 10, 2012
    Posts:
    95
    I'm eagerly waiting for your progress in this project. Not just the graphics part (that already looks awesome) but also the simulation aspects (buoyancy, etc)
    :D
     
  5. gbarnes

    gbarnes

    Joined:
    Mar 25, 2014
    Posts:
    5
    Hey there Luckymouse brought me here and told me that you're developing a new ocean asset. What are your plans? Which features can we expect once you're finished ? :)

    I would be interested in techniques similar to the ones they used for AC 3. http://www.fxguide.com/featured/assassins-creed-iii-the-tech-behind-or-beneath-the-action/

    I already use a version of the ocean you ported to Unity3D in conjunction with uSky but never had the time to add all those features such as foam, subsurface scattering and so on.
     
  6. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Very good move... :cool:
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Looks cool, please count me in for any beta testing. Our project tends to break everyone's stuff.
     
    truefx001 and Carpe-Denius like this.
  8. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Wow, beautiful. Makes me happy I have not yet purchased an ocean asset. :)
     
  9. Arainami

    Arainami

    Joined:
    Dec 2, 2014
    Posts:
    11
    scrawk, hello! I admire your work! But I ran into a problem. In your examples, calculations of height, when a large wave height - there is out of sync position of the object and the waves. But I managed to find a solution - it was necessary to modify your method SampleHeight in WaveSpectriumCPU:

    Code (CSharp):
    1.         public float SampleHeight(Vector3 worldPos)
    2.         {
    3.             var ht = 0.0f;
    4.             var error = m_gridSizes.x / m_resolution;
    5.             var pos = new Vector2(worldPos.x - error, worldPos.z - error) / m_gridSizes.x;
    6.             ht += m_map0.GetPixelBilinear(pos.x, pos.y).r * 2.0f - 1.0f;
    7.  
    8.             error = m_gridSizes.y / m_resolution;
    9.             pos = new Vector2(worldPos.x - error, worldPos.z - error) / m_gridSizes.y;
    10.             ht += m_map0.GetPixelBilinear(pos.x, pos.y).g * 2.0f - 1.0f;
    11.  
    12.             return ht;
    13.         }
    m_resolution - a Resolution setting from the settings of the Ocean script.

    Also, in order to be able to use the high waves - it is possible to use the format RGBAFloat for m_map0 texture.


    For the test, I used the following settings for Ocean:


    I have done all these corrections in your project OceanSurfaceEffects_Indie_U5, since it uses the height calculation by CPU. My laptop does not support your later build a calculation by GPU, so I'm sorry if my edits remind slowpoke :)

    Sorry for my english. I'm looking forward to the final version of your ocean!
     
    jason-fisher and John-G like this.
  10. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @ZJP, @Uli_Okm, @Telia: Thanks :)

    @gbarnes: Dont have a feature list at the moment. Will have to see how things go. I have seen the AC link. I Dont think anything on that site would be a problem to implement and would expect the final ocean to be on par with AC's ocean or better.

    @hippocoder: Would love to have you as a beta tester.

    @Arainami: Thanks, I will have a look into that. I did not know that Unity 5 has now added float and half formats to the Texture2D object. This is a real game changer and is long over due! Will update the project today.

    EDIT - The error should be like so...

    Code (CSharp):
    1.  
    2. error = m_gridSizes.x / (m_fsize*2.0f);
    3.  
    Not sure why. Some sort of offset issue.
     
    Last edited: May 8, 2015
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Good stuff - just poke my fatness in pm whenever you like :)
     
  12. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Very interesting!

    Will it work when viewed from great altitude (12 km)? If it does, it will be a perfect fit for the sim I am working on.
     
  13. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Great to see you back working on your ocean. Once you got some foam in there if will look amazing. Following this thread as this is just what is been waiting for ages not being a coder, I need a good full ocean system that's easy to implement.
    Looking to create a ww2 naval simulation so this looks perfect fit that. Like hippocoder if you need a beta Tester, I would love to put it under my hammer and see what I can break :p.
     
  14. Ahnuld

    Ahnuld

    Joined:
    Oct 20, 2012
    Posts:
    15
    Brilliant work once again Scrawk. With foam and perhaps buoyancy, this would be an instant buy for any project involving an ocean. There's no shader as good looking as this available for Unity yet.

    Are you considering support for realistic looking shorelines? as they would require some sort of distance-based transparency, that seems difficult to implement to me.
     
  15. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Is the terrain engine you are working on going to be published as well? That would be awesome!
     
  16. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @Elecman: Yes, 12km should be no problem. There wont be any curvature though. The terrain engine Im working on is for personal use and wont be a asset sorry. In any case this project has priority.

    @John G. Thanks. Will let you know when I have a beta version.

    @Ahnuld: Not sure about shore lines yet. Will tackle that problem when I get to it.

    Will be working on the underwater effects next.

    First step, use the stencil buffer to mask of whats under water. You wont need to do anything to your shaders. The ocean code handles this. The image shows the stenciled area just fill with solid blue at the moment.

    Next step, grab the screen and depth buffer and apply under water light scattering as a post effect.


    Ocean6.jpg
     
    twobob, ZJP, John-G and 1 other person like this.
  17. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,372
    Will it support realistic wave shape dynamics? Smaller waves seem to translate over the bigger waves, because of wind or current. And if you would follow the top of a bigger wave, it will eventually suddenly "stop", only to be replaced by the one after it.

    I have yet to see a simulation which nails this. Some of them have endless rolling waves (which is unrealistic), and some of them have just standing waves. Or a combination of both, which is still wrong.

    Unfortunately it is hard to find a good video but I have seen it many times in real life.

    This is the best video I found so far:
     
  18. OffThHeezay91

    OffThHeezay91

    Joined:
    Feb 23, 2013
    Posts:
    45
    that last image looks beautiful. good job
     
  19. sadicus

    sadicus

    Joined:
    Jan 28, 2012
    Posts:
    272
    I currently own (almost) every water sim from the asset store.
    Bought Unity 4.x when it first launched and have been waiting for this moment ever since!
    beta test approve me!
     
  20. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I tried throwing my wallet at the screen and it bounced off, landing near my keyboard. It did partially flip open so there's that symbolic thing going on.

    Shorelines, or rather how the sea meets the shore is usually a very hard thing, I guess simply fading the water near shallows would help in the meantime I guess.
     
  21. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @Elecman: The wave will look as realistic as I can manage. Couldn't say how good that is until its all done. I can say that the method I'm using (Fourier transform of the unified direction spectrum) is regarded as the most realistic method currently practical on today's hardware.

    @OffThHeezay91: Thanks.

    @sadicus: Thanks. Will let you know if I need more testers.

    @hippocoder: Yer shorelines have always been a issue. I have a few ideas. Will have to see if there practical.

    So Ive spent that last few days structuring the code so it naturally supports multiple cameras. The ocean should work from the view of any camera added to the scene. Sounds like a no brainier but it takes a bit of work to get right. The projected grid needs to have its projection applied per camera as well as a few other per camera data like the ocean mask (see below).

    Also been setting up the code so the underwater effects can be applied. This means generating a mask so the areas underwater can be identified in the post effect shader. I did mention the stencil buffer in last post but turns out its not quite as flexible as I needed. Just went with a conventional mask.

    Also the ocean mesh needs to generate a depth map so it knows how deep objects are below its surface. This depth map can not include the ocean mesh itself or the meshes depth value will block everything else.

    This image is of the camera looking down with the depth values of the objects below the camera being rendered as the color where the Fresnel value would allow you o see underwater.

    Ocean7.jpg

    This images is from below the water with the depth values being rendered as the color again. The image in the top corner is the ocean mask. The red is the ocean top side, the green the oceans under side and the blue is the ocean bottoms background.

    Ocean8.jpg

    Need to decide how to apply the underwater scattering now. Was thinking of something simple for now but will also be looking into a method similar to Brunetons precomputed atmospheric scattering but adapted to ocean water. Could be hard to do. Will have to see.

    Also will be looking into what methods I could use for underwater god rays. Pretty sure I can modify the standard sun shafts shader for this. Was also thinking of true volumetric light shafts using this method which has source code for Unity available. Again could be hard to do.
     
  22. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Great stuff. I'm actually thinking it would probably be better to just get the basic ocean going with all its performance perks then add features over time? might be interesting. Scatter and things like that are great but I'd love it if they're optional or tweakable for performance reasons... using PS4 here so I have fixed performance budgets, I guess!

    For example in GTA 5 (on xbox 360), they never show below and above water at the same time, they just make the switch and disguise with a special effect. Likewise you could decide to make an opaque ocean option so pixels get discarded, saving fill for example the ocean in the distance probably wouldn't need half these features and can gradually get more expensive to render the closer and more important it becomes, ie a practical answer for open world games.

    Just thoughts, since I'm super interested in this solution.
     
  23. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Yep. I get what you mean. Don't worry I'm not going to get to bogged down in detail at this point. If anything start taking to long I will just keep it basic and move on.

    From my experience I've found it best to keep some of the more advanced features in Mind from the start even if you don't end up implementing the full effect then. Nothing worse that trying to and something in later only to discover you have to completely restructure the code.

    All features will be optional with quality options from ultra to low and a LOD for distant objects.

    I wanted to make sure I set up a seamless transition from above the ocean to below from the start. Have a idea for a game that would need that to be supported.
     
    theANMATOR2b likes this.
  24. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    For the lightshaft unity already have volumetric light shaft based from the same article that you mentioned above, maybe it can help you so you can adapt it to your ocean.
     
  25. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    This looks amazing. What caught my eye was the underwater transition. Have not seen this in anything real-time. Looking forward to seeing more.

    I have tried that volumetric lighting script and it looks amazing. Had to stop using it because it kept on throwing a C++ error and crashing Unity. Weird. If it could be worked on and adapted to this that would be amazing.
     
  26. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Wow this is looking fantastic, reminds me of what Roderick was done with Truesky.
    Really hope these work together in the end, I can see these 2 being my go to for environmental assets.
    Hope when you're working on the wave generation you can implement a Beaufort system.
    Would be great to have full sized waves for those nice stormy scenes. :)
     
  27. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    This is great news.
     
  28. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @rea: Yep. I have that project.

    @Baldinoboy: Thanks. The project I tried is this one. Worked in Unity fine for me. No errors. Even Upgraded to Unity5 with no issues.

    @John G.: Thanks. Hoping to have a slider for the ocean conditions based on the Beaufort scale.

    @longraodhwy: Thanks.

    Havnt had much time this week with work but have managed to add some basic under water colors. This is just a place holder to make sure I have all the information I need in the shader (depths, grab, etc). The final underwater effect should look much better but still to decide exactly what method to use.

    I think I have focused enough on the underwater stuff and will be adding foam/shore effects next. Will return to under water stuff later. Also need to make some nice islands to test the scenes with. This was just a quick one.


    Ocean9.jpg
     
    Last edited: May 20, 2015
    Beennn, CaptainMurphy, John-G and 4 others like this.
  29. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,348
    Super cool, the depth fading is one of the sweetest i have seen :)
     
  30. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Very cool! I tried to get the first few builds working for our game but never could get them working with the waves large enough. Are you planning on some more complex foam in this version? We need a foam that generates at the peaks of the waves and then fades down the wave.
     
  31. Axel59

    Axel59

    Joined:
    Feb 28, 2013
    Posts:
    37
    great work !
     
  32. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @nasos_333 and Axel59: Thanks :)

    @CaptainMurphy: Will be working on the foam next. With the other projects if you were using the indie one the waves heights were clamped to quite a small range. The project has been upgraded to Unity5 which now support float format textures so the clamping has been removed. Also its the wind speed that makes the waves larger and its not set up to be changed during run time. A value of 12 should do it, see Arainami's post up above. You might want to give it another go, or you could just wait for this project to be finished which will have support for all those things.

    Made a nicer looking coral atoll today to better show the underwater effects so far.


    Ocean10.jpg
     
    John-G, Teila and Baldinoboy like this.
  33. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    We tested every version that was released. We also tried to work with the version that was in your ProLand conversion but never could get it looking right, unfortunately. On your depth effects are you just using the depth render or does it actually correspond to the water depth at that x/z? I am using Suimono right now and one of the advantages is that a shoal area of water can have a different coloring based on the actual depth and not the shader depth so seeing a shoal area at a low angle is possible. Also, along that same vein, will the waves deform around those areas of shoal you are showing? Mitigating the larger waves and instead moving to beach waves?
     
  34. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    That's looking good, one thing I've not seen an ocean system do right is foam.
    They all tend to generate foam a set distance around the camera, but if you move the camera to a height is very obvious that foam and even waves are not generated to the horizon.
    This totally breaks the illusion of waves if used for example a flight sim.


    Living beside the Atlantic myself, the above image is pretty much what the sea state looks like for 75% of the time.
     
    twobob likes this.
  35. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @CaptainMurphy : At moment I am using the depth buffer. The amount of water the light would go thought between the ocean surface to the object is calculated and a attenuation is applied based on that. You can still see objects from a fairly low angle but they will get darker the closer to the surface you get. Here's a view from the height of the ships upper deck.

    Ocean11.jpg

    I see what you mean by using the actual objects depth at position x/y. The amount of attenuation would be independent of the view angle. The underwater stuff I have added so far is pretty basic and is not final. I will have a look at implementing the effect like you said. I dont think it would be to hard. I could easily have a mode setting to choose between which method you want to use.

    In terms of the oceans waves moving to beach waves around the shore I have some ideas but wont know if its practical until I try.

    @John G.: Thanks John. I will try and make it so the foam still looks good to the horizon. Where you live looks very cold :(
     
    twobob, Baldinoboy and John-G like this.
  36. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Haha yes no Caribbean waters for me, I'm on the west coat of Ireland. Wind and rain pretty much all year round. Spent much of my life on the seas, so I'll be a hard customer to please :p
    Planning on a ww2 naval /sub sim based in the Atlantic /Pacific so water will be the main feature along with Truesky that will be used for environmental.
     
    Baldinoboy likes this.
  37. Rotorist

    Rotorist

    Joined:
    Jan 26, 2014
    Posts:
    11
    Hey Scrawk, attached is my modification of your ocean shader (regular lighting) which I put in some shore foam and shore color using depth buffer. Maybe it can be useful for you in some way!
     

    Attached Files:

  38. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I hadn't noticed this thread, about time! Your efforts should definitely be rewarded not just for your oceans but your entire blog, which i still visit often. You probably have more than enough testers by now but if an opportunity comes id love to take a look, got rather familiar with your oceans over a period of time, fell in love especially with the whitecaps project as you know. Good luck anyways, ill be be checking the thread
     
  39. sadicus

    sadicus

    Joined:
    Jan 28, 2012
    Posts:
    272
    Looking good!
    @Rotorist: which scrawk Ocean project is that to be tested/used in?
    @John G.: all the blue! beautiful.
     
  40. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I think your ocean system would be well suited to use a depth render camera overhead to find where the water should change wave pattern since the wave is always sourced from the same spot and the camera would be at the same point as well. I have always wondered if the edge foam could be rendered from a depth render texture as well. Any of the 'moving tile' systems generally don't behave well with a camera that snaps between points, there is always a frame or two of lag for the render texture to catch up after the tile shift where you get the foam and wave effects 'snapping' to the new tile location but keeping their old appearance. The biggest reason to have the shoreline wave system is more to stop the waves from showing in the middle of low lying land masses. Every ocean system except Suimono that I have tried will show the waves through the terrain and it is hard to depth mask huge areas sometimes.

    For our project we boiled down the foam to 3 unique parts. The first is the peak foam that is created during the tip of the wave being curled from wind or wave angle, the second is the trailing foam that is created from the peak foam and is strong right after the peak creates it but fades as the waves moves along, the third is wind streaks which are created in the direction of the prevailing wind (which is not always the direction of the waves) due to the wind 'breaking off' the tips of the waves and blowing them out in lines. Using the old Community Ocean (this was my last variation that I did of it) I was able to get some realistic looking peak and trailing foam but never got to the point of the wind streaks.

    It appears you already have buoyancy scripts in the system. Do they have any limitations?
    Edited to clarify: limitations in distance from gameobject, camera frustum, or limits on how many can run and need to smear across frames.
     
    Last edited: May 22, 2015
  41. Rotorist

    Rotorist

    Joined:
    Jan 26, 2014
    Posts:
    11
  42. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @Rotorist and @sadiucs: Thanks!

    @lazygunn: Thanks. I do know you love the white cap project. This one is going to be a lot better.

    @CaptainMurphy: The 3 parts of the foam was pretty much exactly what I was thinking. I dont have any buoyancy script at the moment. Will sort that out sometime soon.
     
  43. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @scrawk I guess I am more looking at the height x/z script, from there buoyancy can be done in the users script. I can dig up one of the older ones we used that wasn't quite as complex as our current build if you want a buoyancy script to work from. I imagine most people using the water system would end up making their own since the behavior of each game is pretty unique.
     
  44. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I tried inserting payment details but was incredibly confused where to type them in.
     
  45. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Very much looking forwards to the foam. Any thoughts as to surface displacement and SWE kind of things? With proper wakes and suchlike i cannot see this not doing amazingly well
     
  46. DizzyTornado

    DizzyTornado

    Joined:
    Nov 17, 2013
    Posts:
    134
    I've been using your first ocean shader for about 8~ months, and I would like to test this one, if possible. Looks great by the way!
     
  47. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Yeah, if you need another beta tester, sign us up. I would love to get our ships on that water to see how they react using our buoyancy systems.
     
    John-G likes this.
  48. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @hippocoder: Your persistence to give me money is inspiring!

    @CaptainMurphy: Thanks for the offer of your buoyancy script. Will let you know if I need it.

    @lazygunn: Not sure what SWE stands for. There will be some fancy surface displacement effects but more on that later.

    @MrSecrentMansion: Thanks.

    Ive got a basic web player build if you would like to have a look. There's no foam and the water color looks a bit uninteresting. Should look better once subsurface scattering is added. It does show off the movement of the wave nicely though. You cant move the camera. Still some issue I need to sort out.

    Web Player
     
  49. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Hi Scrawk

    Great work , very realistic waves

    Norby
     
  50. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Ok I'm impressed they are already looking more realistic then I expected. The waves trail out in a very convincing manner. I can already picture they with foam and spray turbulence wisping of the crests.
    Good performance too was getting around 200fps fullscreen.