Search Unity

Ceto (Scrawks Ocean)

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

  1. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Scrawk this is looking beautiful , good progress

    Norby
     
  2. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    That is amazing.

    I am not one to buy anything till it is on sale. I am getting this immediately. My upcoming project is begging me for it.
     
  3. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Sounds great, would this work for objects as they cut the water surface for example a periscope rising/lowering thru water surface or the the floats of a water plane as it touches down on the water.
     
  4. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Yep, I can add that. Was also thinking of something for helicopter rotor wash as it gets close to the surface.

    Just another foam trail with some smaller ones on each side a shorter back trail with some strips.

    Ocean25.jpg
     
  5. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Fantastic, cant wait to hook this up with UnityFS and a nice float plane and a few ships too.
    All it needs now is some wave dispersion from the bow wakes. :)
    Also do the foam trails follow the larger waves.
     
    Karearea likes this.
  6. Rycons

    Rycons

    Joined:
    Nov 23, 2013
    Posts:
    31
    Looking amazing scrawk, Really liking the trails!
     
  7. sashahush

    sashahush

    Joined:
    Sep 5, 2012
    Posts:
    75
  8. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @John G.: Im going to look into making foam trail the waves but unsure if its possible at the moment.

    @sashahush: Havnt done anymore work on the underwater stuff. Hopefully it will look like that image.
     
    Rycons and John-G like this.
  9. Uli_Okm

    Uli_Okm

    Joined:
    Jul 10, 2012
    Posts:
    95
    Hi @scrawk , any estimated time of when you will have an beta (a open beta please) of this asset? I think that a good ocean implementation will help a lot of people out there (like me) even in an beta stage.
    Thanks, and keep the amazing work
     
  10. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    I dont want to put a time frame on it at the moment. Have got a lot done this week and at this rate it will be sooner rather than later. It probably wont be a open beta.
     
  11. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    If you want someone to play with getting it networkable just let us know. We are currently working on a project that does networked water with each player.
     
    Konst likes this.
  12. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Yep, counting on you for the network testing :)

    Trying to keep networking in mind during development.
     
  13. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Nice network support will be fantastic, using bolt myself so can see how that works when time to.
     
  14. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    205
    It would be fantastic if the ocean system (along with reading wave height for buoyancy) could be run in a headless (--batchmode) server i.e. doesn't require a Camera at all to function properly.

    Regarding syncing, the simplest solution would be to allow us to specify our own time value (the network time, in this case) for the simulation so that both the server and the client can have identical simulations due to having the same network time.
     
    John-G likes this.
  15. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I think we all put that bug in his ear a couple pages back, lol.

    We currently are using the Community Ocean with a time offset and it works quite well. That system is pretty simplistic since it is just repeating tiles so all you really have to do is figure the offset from 0,0 according to tile size and then the time offset. Hopefully it will be equally as simple for this.

    I really am also hoping for a headless mode so we can run the buoyancy of ships server authoritative and have it match up smoothly and not waste the resources on having to render anything at all. That way we can just send out the transforms to the clients and not have to force them to calculate the buoyancy themselves.
     
    BackwoodsGaming likes this.
  16. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    CaptainMurphy did ask something similar but I will give a bit of a update on that.

    The way I've set thing up it can already run in a headless mode very easily. The rendering of the mesh and the generation of the wave data like displacement is separate. If you wanted a headless mode you would just not add a the projected grid component to the ocean but still add a wave spectrum component. That way the wave data will still be generated but there wont be any mesh rendered. You can then do buoyancy calculations if you want on the wave data.

    The data is generated from a time value so yes I'm just going to add the ability to provide your own time value if you want. There will be a IOceanTime interface and the default implementation will just use Unity's time since start up. You can then just implement your own however you want add that to the ocean instead of the default.

    Im just setting up the buoyancy code now but the way it works is that you submit a wave query to the ocean it will send a wave query result back with the information you want. The query can have different modes with each mode returning a different amount of information and the level of error and detail you want can be adjusted. I'm not sure of the performance cost of a query at the moment but its about 0.01ms and I haven't done any optimization yet. I may also add the ability to batch queries into a group and then run them on a separate thread.

    Just a last though on the headless mode. If the wave data is generated on a sever then the client will need it to render the mesh at some point. The client could just generate its own data and use that or you could send the data to the client. The amount of data will vary depending on the resolution but a typical amount would be about 0.2mb for the displacement data at a medium setting. I'm not sure if that's a ok amount to send from a sever so let me know. You would need the data to be sent at lest every 3-4 frames to prevent a jerky movement of the data. The slope data for the normals is calculated separately so you could have the client generate this every frame. It runs completely on the GPU so is quite cheap to calculate. Iv noticed that this helps the wave movement look quite smooth even if the displacement data is only being generated ever few frames. Its only when you have the waves intersection the camera view that's its noticeable so if your looking down most of the time you wouldn't really notice.
     
    hippocoder, sashahush and John-G like this.
  17. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I have been mulling over the buoyancy code for a while and that is a bit of a muddy thought process. I like the idea of returning a batch of data since that could then encompass the bounds of all of the buoyancy points in an object. Maybe the routing could return a grid of info with a size component passed in for client authoritative setups? Our thought was to make buoyancy server authoritative and have the client pass in the points/volume of an object that is needing to be calculated for (or set them at the start and not change them) and the server simply sets that objects transform rather than having to pass back and forth multiple times.

    As far as running headless, would you be able to pass over the settings that are being used to render the ocean and then limit subsequent changes to just a time offset? I can't see changing the ocean every single frame to pass the data to render, more like passing along the current setting class and the time offset that the server is at. From there the server can just sync the time offset and the settings will be the same otherwise.
     
  18. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Just a bit of a update on progress. Im currently very busy with work the next week or so but am very close to have a playable demo to release. It would still be missing under water effects and shoreline effect but could make for a good demo for beta testing.

    I probably made it sound more complicated than it is. Its just a way to ask the ocean what the wave height is at position xz. From there Im sure you can write a script that can handle buoyancy how ever you want. I will be providing buoyancy scripts that will be fine for the majority of users. Im sure you have much better ones already written and as long as they just need the height of the wave at position xz then they should be straight forward convert. I know you have offered your buoyancy scripts a while ago and if your still happy for me to have them feel free to PM them to me. Im sure they could be quite helpful.

    Yes you can just pass the settings once and then just pass the time from there. The generated data I as talking about (the 0.2mb) is the displacement textures that are created based on the time value passed. This data is needed to render the mesh and for buoyancy calculations. Since Im not familiar with networking Im not sure if you would just generate this on the server and send it to the clients or generate it on both the sever and client so you dont need to send a texture every few frames to render.
     
    Last edited: Jun 30, 2015
    elbows and spraycanmansam like this.
  19. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Just a image of the larger wave conditions. The ship is 40 meter long for scale.

    Ocean26.jpg
     
  20. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    There are no words - cept well done! It's looking very good for such early work
     
  21. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Quite marvellous.
     
  22. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Looking awesome, and looks like you have the trails following the water surface too :)
     
  23. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I was not sure how your script worked for getting the height at X/Z, whether it was just querying a texture color or if it was using a collection of vertices that were being tracked. It still might be good to have the ability to return a collection of points so that the player only has to make a single call but get back all the data they need so that you aren't making multiple single calls for an object to calculate, just cutting down the number of round trips to the script. Some of our larger ships are cut into multiple 'decks' of buoyancy and each of those are cut into segments, so we would end up making calls for all of them separate. If we could make a single call and get a collection that covers the entire area that the ship is over then we could do more of it in one shot using interpolation between the points returned.

    Ah, I get it now, I was not quite sure what you were passing that was .2mb. I cannot think of a time when passing the texture would be a good thing over network. Simply having the same offset and settings would be sufficient to do the rendering as far as I have seen in most systems. I just can't imagine trying to pass a texture to 32 clients for a match every few frames for .2mb... :eek:
     
  24. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I would expect each machine to just look the same based on a t value for time, but I could be wrong.... then sampling would be trivial across networks (if deterministic)
     
  25. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    That is an amazing shot. Enough to make my day;).
     
  26. InfiniteDice

    InfiniteDice

    Joined:
    Jun 30, 2015
    Posts:
    44
    Nice, I like the look of this as well. I've taken a look at the other offerings on the store and if this is at the right price and it's easy to pull the xy with a simple call I'll be very interested. Funny thing I was just talking with Capt. Murphy yesterday about how I need to find something to replace my placeholder water.
     
  27. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    From our experience with other water systems it has to start with the same location (usually 0,0) so that if the system is based on tiles then that should keep the tiles lined up between clients, then have the settings matched to the server using an onChange command so that it only sends settings to clients when necessary but can also be queried for new clients joining, and finally just keep them synced with the time offset.

    Usually the height at position on a system like this can be very precise since it is based on a texture (I assume) that has a high resolution for the query to look at. Usually that texture is held in memory so it isn't having to query a disk for it either so your read times are very fast.
     
  28. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey scrawk. I remember there being speak about a shoreline effect but I do not remember and am too lazy to look back. How would it be with the waves? For instance having those amazing waves in the shot above out in open sea and then coming up to an island where the waves splash against the shore and are calm in the shallow areas. Like Suimono or the awesome AC4 water. Do you plan on doing something like this or just have one wave scale for the plane?

    I know it is a lot but with your waters shading and the shore effects it would be amazing.
     
  29. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @hippocoder: As long as all the other settings like wind speed, wind direction etc are the same then yes, same time value, same result.

    @InfiniteDice: Yep, the ocean height for any world location can be quickly retrieved from any xz position.

    @CaptainMurphy: Yep, its based on a texture. Im not very familiar with the community ocean project but if it works by using FFT to make the wave textures then this pretty much works the same. Im just using a different spectrum and more data is being generated.

    @Baldinoboy: There will be shoreline effects but have not got to that yet. Have not decided on exactly what features to have or methods to use yet.
     
    Baldinoboy likes this.
  30. Cargh

    Cargh

    Joined:
    May 17, 2011
    Posts:
    36
  31. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Cool. Let us know as it progresses. Really looking forward to seeing that.
     
  32. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    @scrawk FYI, don't use a raycast and the hit.textureCoord to pull the texture x/y point, it will kill frames when you get past about 200 objects calling for height info. It will need some sort of offset figured out in code. We are running into that on another project and it is killing us right now.
     
  33. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Not using that method but good to know.

    Will be doing some performance tests soon to see what number of height sample you could expect to do each frame.

    Will post the results when done.
     
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Good stuff! looking forward to getting my filthy paws on this.
     
    spraycanmansam likes this.
  35. DenisM

    DenisM

    Joined:
    Dec 6, 2013
    Posts:
    62
    The big lack of any whater asset in store is missing of xy plane. Dont miss it.

    2D physics in unity is xy plane. So there is must be shader for xy plane.
     
  36. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You can easily convert the physics to xz simply by swizzling what you draw, ie y becomes Z and camera is top down, or render ocean to texture (just suggestions), or even use Physx (which is pretty damn quick in Unity 5).
     
  37. DenisM

    DenisM

    Joined:
    Dec 6, 2013
    Posts:
    62
    Cant understand what do you mean by swizzling xz. 2D physics is only xy plane, so all of your objects must be in that plane right?

    Render texture is waste of your full screen overdraw.

    Physx on mobile platforms or different gpu is not a good solution.


    Writing xy shader for water if you are author of it is 1-2 hours. Simply because you just know where you need to change z to y.
     
  38. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yes but your problem is:

    1. this isn't something thats efficient on desktop, never mind mobile
    2. I'm hoping the author won't mess around trying to make this work in 2D because I think it's dumb to try and shoehorn AAA next gen techniques into tiny mobile 2D titles, but that's just my 2p
     
  39. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    There won't be any 2D sorry. It's not something I'm interested in and the methods used for the waves and mesh are not applicable to 2D.
     
  40. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    Thank you. I am happy to hear the asset won't be trying to tackle things outside of its scope. Especially when using a 3d water solution for 2d is overkill in the first place and I can't imagine any advantage to doing so.
     
  41. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I think there very affordable 2d line water things in the asset store iirc. Thinking of this system in terms of 2d made my brain go crosseyed
     
  42. stanislavdol

    stanislavdol

    Joined:
    Aug 3, 2013
    Posts:
    282
    I totally agree!
    2D and 3D water require different approaches.
    There is absolutely no reason to combine them into one Frankenstein's monster.
     
    Baldinoboy likes this.
  43. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    First off, Beta version should be ready in 1 week give or take a few days.

    Just downloaded the Blacksmith environment asset from Unity and dropped Ceto into it. Almost worked first time. It uncovered a few small issues. Should make a good test scene.

    Ocean27.jpg

    Ocean28.jpg

    Ocean29.jpg

    Ocean30.jpg
     
    Last edited: Jul 15, 2015
  44. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Those shots look splendid, will shore foam make it into the betas?
     
  45. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    No shoreline or underwater effects will be in the beta. Just havnt had time to start on that yet.

    I will try and make a start on it while people are playing around with the beta.
     
    hippocoder and John-G like this.
  46. Rycons

    Rycons

    Joined:
    Nov 23, 2013
    Posts:
    31
    It's looking good even without the shore foam. I hope I get a chance to test this out! :)
     
  47. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    looks great.
     
  48. KPaton1

    KPaton1

    Joined:
    Jun 17, 2015
    Posts:
    1
    Who will get to try out the beta?
     
  49. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    ME! MEMEMEMEMEMEMEMEMEMEMEMEMEME!

    Everyone knows that hippos have a thing for water.
     
    John-G, scrawk and CaptainMurphy like this.
  50. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    How about public demo for those who not into beta.......:)