Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Ceto (Scrawks Ocean)

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

  1. Imhotebkin

    Imhotebkin

    Joined:
    Feb 10, 2015
    Posts:
    18
    I'm sorry for being really annoying but I have another question to add up to my 2 previous ones. Thing is the reflection script darkens the objects a whole lot. But it doesn't darken the skybox. So if you rise the intensity the sky on the water will be super bright but the objects are still dark. Iv'e tried adjusting the inscatter tint to match my global fog volume, but it's stronger the closer it is to me not away from me (which is wierd). Here's a screenshot of my problem
    the mountains are really light but their reflection is dark.
     
  2. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,119
    @clickmatch you require a rigid body with gravity enabled and a collider . On the bouyany script you drag the object that contains the collider into the game object slot.
    Make sure density is less than mass or it will sink.
     
  3. clickmatch

    clickmatch

    Joined:
    Dec 3, 2012
    Posts:
    58
    Cool I'll try it out. Been messing with my own version, amazing how complex it is.
     
  4. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    @scrawk Not sure why, but AddShoreMask Foam seems to be a lot more visible when running in the Editor compared to a compiled Windows executable. (I'm using DX11 and Forward rendering.) i.e. the alpha values must be cut in half or more in the compiled version to equal what you see in the editor.
     
    Last edited: Oct 21, 2015
  5. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    My movement script is very basic and is only provided for the demo. Its not recommended you use it in a game.

    The normal method for handling this situation is to use collision boxs in trigger mode around your terrain to check when a object enters the area.

    You can also check the wave height at any location using Ceto's wave query. See the manual for more information about wave queries.

    You could also add a wave overlay that fits the shape of your terrain and then add a clip mask to cut away areas of the mesh. A clip test is supported in the wave queries so you could check if the location has been clipped away and therefore in your terrain and not in the water. Again see the manual on wave queries. You just need to make sure your clip mask has read/write enabled and has alpha from grey scale checked.

    There is currently no script to push down the waves as the boat moves through them. This is something that maybe added in a future update.
     
  6. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Yes, this is a know problem. The objects are darker than the sky box in the reflections so when you increase the intensity the sky box ends up being to bright.

    Im looking into this but haven't managed to find a solution yet.

    Fog is disabled on the reflection camera. Maybe enabling that will help. I dont think it will but its worth a shot.

    In the PlanarReflection script comment out line 266

    go.AddComponent<DisableFog>();
     
    Last edited: Oct 21, 2015
  7. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804

    Thats weird. Had not noticed that. I will have a look and see what the issue is.
     
  8. InfiniteDice

    InfiniteDice

    Joined:
    Jun 30, 2015
    Posts:
    44
    Guess who just splurged 100 CAD on this? ;) Expect imagery to follow.
     
  9. lofwyre

    lofwyre

    Joined:
    Apr 19, 2007
    Posts:
    166
    Hi. Am truly loving ceto, it looks fantastic.

    day_water.jpg

    But when using global fog (in uniStorm) it looks like the water is not affected by global fog height. Is there a way to do this or what would be a good setting to make the water look more transparent (less like black oil).

    stormy_water.jpg

    Thanks for any advice.
     
  10. InfiniteDice

    InfiniteDice

    Joined:
    Jun 30, 2015
    Posts:
    44
    Scrawk, One big question...

    Any reason why when I rotate any of my in-game cameras the ocean cuts in/out.. almost like it's only working with a 30 degree arc.

    Update: All the cameras of one ship entity work fine... the other ones however as I mention above seem to only show the ocean in a small arc. Does the projection fixate itself only to certain cameras perhaps?

    ANSWER: LOL...

    I had a render camera running on the one ship that never was being disabled. Since that's the only camera that was staying enabled, when I enabled the other cameras it wasn't swapping to that area?

    This solves my issue, however might pose long term problems if perhaps I need remote cameras capturing scenes for monitors.

    Question: is there a way to force ceto to use a specific camera via script, in case more than one camera needs to be active at the same time... also at long distances?

    Thanks! :)
     
    Last edited: Oct 23, 2015
  11. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Hi lofwyre,

    By default Ceto uses a material that runs in the transparent queue. This has many advantages so its the preferred option but it means that any post effect that gets applied before the transparent queue will not be applied to the ocean.

    Looks like UniStorm applies the fog before the transparent queue.

    To fix this look in the Ceto/Materials folder. There should be a top side opaque and under side opaque material. Drag these onto there slots on the projected grid component on the ocean prefab.

    You also need to go to the underwater script on the ocean and make sure its depth mode is set to USE_OCEAN_DEPTH_PASS. The other option USE_DEPTH_BUFFER will only work for the transparent materials.

    With the opaque materials the ocean should now run in the opaque queue and have the UniStorms fog applied to them.

    There is some issue with the opaque materials however. There is a issue in Unity versions < 5.2 where the Unity Terrain is not in the refraction grab making the ocean look black where the terrain is.

    There are also some blue artifacts when in the water looking up and against a Unity Terrain.

    The only other options are to add a fog effect in the ocean shaders final function or move UniStorms fog effect to after the transparent queue which may not be possible.
     
  12. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Hi InfiniteDice,

    Ceto has been designed to work with multiple cameras and each camera gets its own separate resources. However there are currently some bugs which means this is not always working.

    With the other cameras showing the mesh as a arc can you tick the projectSceneView box on the ocean script. This might fix that.

    There has been a bug when the ocean is being viewed with the scene and game camera and the same time. There is also a bug when one camera is rendering to a render textures and Ceto is destroying the render target.

    These issue have been fixed and Im going to check for other issues with multiple cameras today and submit a update to Unity.

    Once approved try the new version and If this does not fix the issues you are having let me know.
     
  13. lofwyre

    lofwyre

    Joined:
    Apr 19, 2007
    Posts:
    166
    Thanks for the detailed response. I'll investigate both options.

    Cheers
     
  14. lofwyre

    lofwyre

    Joined:
    Apr 19, 2007
    Posts:
    166
    Hi Scrawk

    It seems uniStorm is just using the standard GlobalFog.cs from Standard Assets image effects. Is there a way I can change this shader for it to be applied after the transparent queue?

    Cheers
     
  15. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Just go into the GlobalFog script (its not a shader change) and comment out the ImageEffectOpaque line.

    Code (CSharp):
    1.        
    2. //[ImageEffectOpaque]
    3. void OnRenderImage (RenderTexture source, RenderTexture destination)
    4.  
    You may also want to check that UniStorm are not using some modified version of the GlobalFog script that wont work after transparent queue.

    Having the fog run after the transparent queue can cause issues with other transparent object that dont write to the depth buffer however. Things like particles effects will have the fog applied to them incorrectly. Since they dont write to depth buffer the fog will use the depth of the objects behind the particle which wont look correct. I dont know if thats a issue for your scene.

    Here a screen shot of the Ceto demo scene with the standard asset global fog ImageEffectOpaque line commented out and using the transparent ocean material.

    OceanGlobalFog.jpg
     
  16. lofwyre

    lofwyre

    Joined:
    Apr 19, 2007
    Posts:
    166
    Hi Scrawk

    Thanks for going to so much trouble. I'll give it a try and let you know how it turns out.

    Cheers
     
  17. clickmatch

    clickmatch

    Joined:
    Dec 3, 2012
    Posts:
    58
    Here's me toying around with buoyancy. Not sure why the youtube video is so jpg-i-fied, but it gets the point across.

    I use a center point object for Y and 4 sub points for rotations. The rotation is averaged between the two bars. I have a sped tilt component I have not implemented yet.

    It's nothing serious, just another one of those, "let's see if I can figure it out"

     
    KingLlama and scrawk like this.
  18. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    839
    Any plans to make this for mobile , a lower version?? The asset store is lacking them, I bought one awhile back, and it went off line sadly... Mobile assets seem to be lacking... Just wondering if there are any plans
     
  19. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    107
    No. Asset is too resource heavy and cutting it down to run on mobile would be pointless, not to mention the amount of work involved. Give it 5 years or so until mobile hardware is capable to run Ceta at a high enough frame rate.
    Hope this helps.

    EDIT: Clarified what I meant by 5 years.
     
    Last edited: Oct 25, 2015
  20. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    839
    5 years.. No thanks. I will just fix the one I been using, . Best of luck with this one.. The one I made actually works great, waves, foam etc, frame rates are fine.. I just wanted to spend my time else where , so I will just have to spend more time tweaking it to make it better is all.

    Thanks anyways. .
     
  21. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    It would most likely be to slow or use to much memory for mobile but there is currently someone testing it on mobile. If it turns out to be practical on mobile then I will let you know.

    There has been someone use it on a android tablet and they said it works fine but I don't know what the fps was.
     
  22. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    107
    Hey,

    I've playing around with Ceto this weekend and I've come across a little bug, not sure if it has been mentioned.
    In deferred/linear setting blur iteration > 0 for planar reflections messes up the reflection map colours.
    See attached image:

    Ceto Reflec Blur.jpg
    P.S. Great product btw! :)


    EDIT: I should also note that if the blur iterations are set to 0 then the reflections are as suspected. This does not happen in Gamma colour space
     
  23. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    839
    Thanks , and please let me know.. .If they had screenshots of it on Android Tablet that would be great.. Would love to see if it looks better than mine.. If it does, and Frame rate is good, I may consider buying it..
     
  24. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804

    Ok, thanks. I will have a look into it.
     
  25. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    There has been a new version of Ceto released.

    This is just a minor version update to fix some of the more important bugs. The issues with multiple cameras in the scene and the issue with the scene view camera should be fixed.

    If you have had these issues try the update and let me know if your still having issues.

    Its possible that some issues with multiple cameras still remain.

    Ceto Version 1.0.7

    - Fixed a issue if the camera far plane in less than double the ocean bottom distance (1000 by default)
    causing a semi-circle artifact in the underwater effect.

    - Fixed a issue where the refraction command was not resizing when screen size changed.

    - Fixed a issue where moving the foam trail a large distance caused a excessive number of
    foam overlays to be created.

    - Fixed a issue with disabling, moving and then enabling the foam trail or foam thruster script.

    - Added a feature to force the grid to recreate itself. (Ocean.Instance.Grid.ForceRecreate = true)
    Set this to true and the grid will recreate itself in the next update.
    The grid will then set this to false. Dont set this to true every frame.

    - Fixed a issue with the underwater effect when viewing the ocean from both the scene and game
    view at the same time.

    - Certain features will not show up in the scene view any more. The ocean will have no
    refractions in the scene view (it will not appear transparent). Some features are difficult
    to support on the scene view camera.

    - Fixed a bug where the copied camera for the reflections, ocean depth and ocean mask was destroying
    the original render target texture.

    - Fixed a bug where underwater post effect was trying to run even if ocean is disabled.

    - Fixed a issue where the mask was still being rendered even if camera did have a post effect script.

    - Possible fix for a null reference exception being thrown in the Projector update.
     
    Last edited: Oct 27, 2015
  26. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Also thread has now been moved to the 'Asset and Asst Store' section.
     
  27. InfiniteDice

    InfiniteDice

    Joined:
    Jun 30, 2015
    Posts:
    44
    Cool - thanks for the update man. I have noticed a few glitches, if they are not addressed with the patch I'll post bug report here for you .

     
    Ian094 and scrawk like this.
  28. kideternal

    kideternal

    Joined:
    Nov 20, 2014
    Posts:
    82
    FYI, I just released my project "VROOM: Galleon" for Oculus Rift using Ceto and couldn't be happier with the results! I'm able to sustain 75 fps even with a ship full of colliders rocking-about in the waves. :)

    Three cheers for Scrawk, for producing (and supporting) such an outstanding component!



    On Steam: http://store.steampowered.com/app/411690
     
    Last edited: Oct 27, 2015
    ibyte, KingLlama, nasos_333 and 3 others like this.
  29. IronDuke

    IronDuke

    Joined:
    May 13, 2014
    Posts:
    132
    @kideternal The water is the best-looking part.:p
    Can't imagine how that happened...

    --IronDuke

    P.S. Seriously though, even though that water is a knockout, the other graphics are really good as well. Nice job!
     
  30. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    If you upgrade to Unity 5.3 you need to remove this line of code from Ceto other wise you will
    get a bunch of errors spamming the console.

    Ceto/Scripts/Spectrum/Buffers/WaveSpectrumBufferGPU.cs

    on line 341 you should see this line of code

    #if !UNITY_5_2
    tex.useMipMap = false;
    #endif

    Delete this bit of code.
     
  31. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,065
    Very cool work
     
  32. DivergenceOnline

    DivergenceOnline

    Joined:
    Apr 19, 2015
    Posts:
    244
    1. How do you get CETO's reflections to play nice with ToD (Time of Day) scattering?
    2. There doesn't appear to be any edge blending, such as where the water meets terrain, but it's my understanding that CETO does in fact do this. How do you enable it?
     
  33. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    1. Im not sure what mean by this. Do you just want the ToD scattering to be applied to the ocean or is the ToD scattering not in the reflections?

    2. If by edge blending you want the water height to fade as it meets the terrain then you need to add a AddShoreLine script to the scene.

    Add it to a gameobject and then set the width and height to match your terrain. The yellow box in the scene window should match the terrain size.

    You can then add a texture to the height mask slot. Where the texture is white it will mask the wave heights to 0 and they will be unchanged where in is black. The texture needs to have 'alpha from grey scale' and 'read/write' enabled.

    I know its not easy to manually make a mask that matches your terrain shape and there will be some editor script to help with this in the future and a AutoAddShoreLine script to do this automatically on play.

    For now there is a very basic script to export a shore mask for you terrain. Add the ExportShoreMask script to your terrain and set the shore level to match the world y water level.

    Then run the scene and stop it. There should be a saved texture to the given file name. It will be white where the terrain is above the shore level. You can then go into photoshop and edit it as needed. I normally extent the white area out a bit with a soft brush.
     
  34. DivergenceOnline

    DivergenceOnline

    Joined:
    Apr 19, 2015
    Posts:
    244
    Currently the reflection seems to be applied on top of the scattering, or its ignoring it entirely. The ToD scattering is a post-effect you add to the main camera for it to be used.
    Screenshot 2015-10-28 18.20.242.png
     
  35. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Heres a thing i did with ceto for ocean, truesky for sky, mesh materializer and polyworld and the newly released gaia for terrain editing - all of which you should definitely check out. Go easy it was only 2 days work, just wanted to show these things looking pretty

    Just hoping sonicether hurries with his realtime gi, waiting for precomputing is a bind

    Shoremask was greated by gaia and its all trixely cause of the exellent hexels

     
  36. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Have you tried rendering out a skybox in code to put in your sky material in the lighting section? You can then select to reflect that skybox in cetos reflections
     
  37. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    Looks like the fog is not being applied to the ocean because its being drawn in the transparent queue and the ToD scatter gets applied after the opaque queue but before the transparent one. I thought this was the issue but was not sure.

    To resolve this you can use the opaque materials for the ocean. In the Ceto/Materials folder there should be a topside and underside opaque material. Add these to the slots on the projected grid script on the ocean.

    You must then go to the underwater component and set the depth mode to USE_OCEAN_DEPTHS_PASS. The other option (USE_DEPTH_BUFFER) does not work in the opaque queue.

    The USE_OCEAN_DEPTHS_PASS option will increase your draw calls so you need to use the depth mask setting on the same script to control what gets rendered in the pass. It should only contain elements that are under the water and make sure what ever layers SpeedTrees are on are not selected as they dont work with replacement shaders.

    There is some issues with the opaque materials however. There is a issue in Unity versions < 5.2 where the Unity Terrain is not in the refraction grab making the ocean look black where the terrain is.

    There are also some blue artifacts when in the water looking up and against a Unity Terrain.

    The only other options are to add a fog effect in the ocean shaders final function or move ToD post effect to after the transparent queue which may not be possible and has other side effects.

    You may aslo be able to add the ToD post effect script to Ceto's reflection camera and have the fog be applied to the reflections. Not really sure if that would work but might be worth a try.

    The reflection camera is created in Cetos PlanarReflection script.
     
  38. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    That looks stunning :)

    I did say I was going to send you a script for the ocean that will give that poly world style look and I will try and do that today.
     
    clickmatch likes this.
  39. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,065
    Amazing work, very unique
     
  40. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Cheers! I had the idea of using a large wave mask overlay texture of a tiling 'polygonised' greyscale image to get close to the appearance but dont know the performance implications, any graceful solution appreciated! I tend to nag about rivers a bunch and after messing with ceto and its wave speed parameter i think it could do the job! Is it possible to use an arbitrary mesh for the waves instead of a projected grid? And additionally is it possible to adjust the direction of flow using that valve style flowmap? Rivers would be great hah
     
  41. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hey cheers, ive been liking the look of your grass system too, when money is in better shape i might have a go
     
    nasos_333 likes this.
  42. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,065
    Nice, i will try to add support for GAIA and guarantee compatibility with Ceto as well.
     
  43. DivergenceOnline

    DivergenceOnline

    Joined:
    Apr 19, 2015
    Posts:
    244
    I'm a designer not a programmer. But that solution you mentioned about adding the scattering post effect to the reflection camera seems like a winner, so how do you "do that in code" (specifically) please?
     
  44. CaptainMurphy

    CaptainMurphy

    Joined:
    Jul 15, 2014
    Posts:
    746
    I am a programmer, but shaders are pretty darn near black magic as far as I am concerned. I, too, would like to see this solution ironed out. Otherwise what we have is you can see the terrain in the distance is scattered but the reflection doesn't correlate.
     
  45. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @DivergenceOnline : In that case try the opaque materials first. I know they do work with ToD and the reason they where added was to address this issue.

    The other options where just added as a last resort. I dont even know if adding the ToD scatter to the reflection cam will work. If you really want to try this method though see below...

    @CaptainMurphy: I think the issue with the reflections being to dark is also making the issue worse. Maybe once thats fixed it wont be so bad. I have looked into this few times but have not found the issue yet. Im going to have another look tomorrow.

    If you want to try adding the ToD scatter script to the reflection camera though heres a script that will do it. You need to add it to your camera and you need to replace the TODScatterScript name with what name the ToD post effect is called.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace Ceto
    5. {
    6.  
    7.     [RequireComponent(typeof(Camera))]
    8.     public class AddScatterToReflectionCam : MonoBehaviour
    9.     {
    10.  
    11.         void Update()
    12.         {
    13.  
    14.             //if ocean not in scene or enabled return.
    15.             if (Ocean.Instance == null) return;
    16.  
    17.             Camera cam = GetComponent<Camera>();
    18.  
    19.             CameraData data = Ocean.Instance.FindCameraData(cam);
    20.  
    21.             //If reflections have not run return.
    22.             if (data == null || data.reflection == null || data.reflection.cam == null) return;
    23.  
    24.             GameObject go = data.reflection.cam.gameObject;
    25.  
    26.             TODScatterScript component = go.GetComponent<TODScatterScript>();
    27.  
    28.             //Add the scatter component to the reflection camera if not already added.
    29.             if (component == null)
    30.                 component = go.AddComponent<TODScatterScript>();
    31.  
    32.             //set anything needed to script here.
    33.             //component.somevalue = yourValue;
    34.  
    35.         }
    36.  
    37.     }
    38.  
    39. }
     
  46. scrawk

    scrawk

    Joined:
    Nov 22, 2012
    Posts:
    804
    @CaptainMurphy: Can you answer these questions for me so I can get to the bottom of this reflections issue. I know Ive probably asked these before but its hard to keep track of everything.

    1 - If that scene was in linear or gamma space. Im starting to thing this is a color space issue.

    2 - If you had to turn down the reflection intensity so the sky reflections are not to bright but thats made the other object like the terrain to dark?

    3 - Is the that opaque or transparent ocean materials?
     
    Last edited: Oct 30, 2015
  47. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I dont know if this will help tod users but using truesky theres a script that creates a cubemap rendertexture and assigns it to a material with a simple shader that is assigned to the skybox slot in your lighting settings - if you set ceto to reflect the skybox you get a much better surface

    Saying that, however, i do seem to have found a bug with ceto in VR, or two maybe - if you tilt your head the camera tilts as normal along with the scene except for the cubemap reflection, so ive been using very low res cubemaps and blur to hide the issue for now

    Secondly the waves can seem to jitter a little in the OR when you move your head, effect seems most prominent while looking down
     
  48. sadicus

    sadicus

    Joined:
    Jan 28, 2012
    Posts:
    271
    Wave Overlays - tutorial request
    Using Gaia to create the Shoreline Alpha image.
    found: WaveOverlay object to the ocean
    found: Shoreline Alpha image
    ...lost.
     
  49. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    The box representing your overlay starts very small, it should be scaled to the size of the terrain in the inspector and then you can chuck the shoreline texture into the slots and tweak
     
  50. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,119
    @sadicus. Took me a little while to figure that one out too.
    After creating your terrain in Gaia you can export an alpha map from the utilities section in Gaia.

    You need to add the shorelinemask script to any empty game object, I added it directly to the terrain initially and couldn't get it to center.

    In the inspector for the script you need to add the png image that Gaia created to the Height Mask slot, also you can add the same image to the Edge Foam slot also to have waves reduced to flat at the shoreline.

    Most important is to make sure the yellow box is the correct size to fit your terrain.
    My island I thought was 2000x2000 but on closer inspection it was 2048x2048 and was causing me not to see the effect as they were inside the island.

    Also make sure you click on the image and in its properties make sure alpha from greyscale is selected.

     
    Last edited: Oct 30, 2015
    AdamGoodrich, ibyte, bartm4n and 3 others like this.