Search Unity

The Community Ocean Shader (Open Source) Unity 5

Discussion in 'Shaders' started by laurent-clave, Nov 30, 2015.

  1. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    My current solution was simply decreasing the value of Every X Frames down to 1 (in the Ocean's Inspector tab under Reflection & Refraction section). Before, flickering always appears when in a non-maximized Game window even when using one Camera but NOT when it is set to "Maximize On Play" with a single Camera. Flickering does not happen to me now with that even when using 2 Cameras. Maybe you can try playing around with the configuration for Reflection & Refraction if you still haven't done so.

    Here is another possible solution, from a reply I received from @elias_t. If this is related to rearranging the values specified in the Ocean's Render Queue (in Inspector tab) and the Material's Shader Render Queues, then this somehow did not work for me. But you might want to try it also just in case.

     
    Last edited: Sep 19, 2018
  2. mrowton

    mrowton

    Joined:
    Oct 28, 2015
    Posts:
    5
    Thanks for the replies! Interesting about maximized and non-maximized. Seems like i tried the "xframes to 1" solution.
    anyway, I'll try and repro some of the issues and test your solutions.
    Thanks again guys!
     
  3. mrowton

    mrowton

    Joined:
    Oct 28, 2015
    Posts:
    5
    Silly, much more consistent results when just using maximize on play and not messing with the location of the game window. I was just "deving" and moving stuff around not realizing I was the problem.
    Thanks guys! back to work.
     
  4. IsometricBacon

    IsometricBacon

    Joined:
    Sep 28, 2017
    Posts:
    29
    Has anyone had any luck getting the Reflection running in VR? I'm using an Oculus and 2018.2.

    I can get the refraction displaying ok by modifying the main Camera as outlined in the Github, but I still get the reflection flicker.
    https://github.com/eliasts/Ocean_Community_Next_Gen/issues/6

    I'm turning it off for now - but if someone has managed to get it running I'd be keen to hear about it.
     
  5. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    Not sure, if this is the same issue - on iOS reflection with fog seems not to work at all. I found out, that the problem is the on the fly generated reflection camera. So I changed ocean.cs to use a preset reflection camera which I put inside the scene. Now the reflection is looking good and has also fog on it which makes it look very natural.
     
  6. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    WARNING! Unity 2018.3b9!
    • shaders do look totally different.
    • speed is down at least 50%. Maybe it´s the native plugins?
    I did not try to fix anything yet because I have no will to dig into and change my code at that moment.
     
    Flurgle likes this.
  7. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    For some unexplained reason I am not getting notifications on replies here.

    Anyway on Unity2018.3.b12 everything behaves as expected.
     
  8. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @elias_t Hey Elias, have you made any headway on the grid resolution system / displacement system? Also wondering if that code is out there someone for someone to help work on.
     
  9. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    Yes I have made some progress. The lib will be used the next months in some real time film production so I have to work on it. But I have some other things to finish first.
     
    Flurgle likes this.
  10. Tony-Lovell

    Tony-Lovell

    Joined:
    Jul 14, 2014
    Posts:
    127
    I used the same method successfully.

    [media]


    I am going to have to check out the Community Ocean if I get back into this.

    tone
     
  11. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    114
    Wow. Just found this asset. Thanks. Unbelievable. Using 2018.3.0f2. Will try it in HDRP as that is my preferred pipeline.
    Cheers
     
  12. unity_hUGr0wWRISeorQ

    unity_hUGr0wWRISeorQ

    Joined:
    Dec 14, 2018
    Posts:
    2
    Hello ! I'm working with this asset since few weeks, and i' have a problem ...

    I changed the boat model, and i'm using mine, a big tanker ;)
    But i still do not understand how to adjust all this values, like mass,drag to have a boat with buoyancy effect and can move forward/backward, right and left.

    If i up the mass the boat just go under, and if i put a small value like 1 or 2, when i try to make it move, the boat just go too fast, and fly ^^

    Moreover, how could i remove this :


    I would like to have a water plan which looks like boundless. and not without this disc.

    If someone have solution ;)
    Thanks
     
    Last edited: Jan 28, 2019
  13. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    243
    I can't wrap my head around this. When I open the demo scenes, things work fine. When I add the Ocean prefab to my own scene, I get a null reference exception about Ocean.calcPhase4N () (at Assets/Ocean/Scripts/Ocean.cs:943) . I even created a prefab from the working demo-scenes and added that to my scene without luck, what should I do? The demos look so nice!
     
  14. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    is there any documentation? i've just download it and i see tons of libocean.a versions and i don't know if they are required or which ones to pick. I thought it was only a shader.
    Also on mac i get tons of artifacts with the default demo.

    I also don't understand the difference on mobile fast q or low q
     
    Last edited: Feb 27, 2019
  15. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update 28/02/2019

    - Fixed a bug that was introduced when the fixed gaussian table was implemented.
    Now no crashes should occur when going from lower to higher tile resolution.

    - Added arm64-v8a native plugin for Android.

    - Added macOS 64 bit only native plugin.
     
    Last edited: Feb 28, 2019
    hopeful likes this.
  16. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    It seems not all scripts/files have been copied over.

    Try to copy the Ocean folder from the demo project to your project and go from there.
     
    Flurgle likes this.
  17. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update 28/02/2019 (b)

    - Added support for 32 bit indices and 256x256 tile grid.
    - Added unity ui fps counter.
    - Fixed a bug on setting the scene as dirty when making changes to the inspector.
     
    hopeful and Flurgle like this.
  18. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Update 06/03/2019

    • Improved Translucency in the shaders.

    • Moved the reflection/refraction renders from OnWillRenderObject to Update because sometimes the reflection camera got stuck.
     
    hopeful likes this.
  19. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Some very good news.

    1. I have managed to come to a good and fast solution to render the depth to a second camera and use this for the shore line foam. You will be able to exclude through its culling mask meshes that you don't want.

    Untitled2.png

    2. Shadows are supported now!

    Untitled.jpg

    Next would be to support multiple point lights.
     
    hopeful likes this.
  20. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    Is there a particular trick to getting shadows on water?
     
  21. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Well not really.

    But because of the nature of the shader and all the handling of the depth textures it was difficult in the past.
    Now that i have separated the depth texture it was quite easier to add.
     
    hopeful likes this.
  22. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Point light support is getting closer.

    But I have an issue.
    i used the fragment shader parts from the wikibook but (as others) I have a square billboard around the point light.

    Untitled2.jpg

    If I use a squared attenuation it gets away, but you have to use higher intensity and range ...

    Untitled.jpg
     
    Flurgle likes this.
  23. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    The new depth render method has made it possible to implement a better looking and more randomized shore foam effect:

    Untitled.jpg Untitled2.jpg
     
  24. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    nirvanajie likes this.
  25. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Yep. Ceto is very good.
    But too slow for my taste.
    I aim at minimal overhead.
     
    hopeful likes this.
  26. Mroczny95

    Mroczny95

    Joined:
    Sep 30, 2017
    Posts:
    1
    Hey this ocean system is amazing. Two out of three projects I am currently having fun with make use of this asset and in both views: RTS Camera, and TPP, it looks very nice. As many mentioned above, I also have to admit this is probably one of the best Ocean Systems for Unity in terms of simplicity and visual effects (though i have not tried the most expensive ones).

    In one project I have working day/night cycle and I can't wait to see how shadows work together. When do you plan to commit latest version with working shadows?

    Best regard!
     
    hopeful and Flurgle like this.
  27. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    It needs some more work since the shaders need an overhaul.
    Also the inspector needs to change in some parts a lot.

    I would guess in 4-6 days.

    Right now I am inspecting some ways of adding ship foam wakes in an optimized manner and have some good first results.

    One very strange issue I am facing now is that the shore foam that comes from the depth camera will change if the ocean object is selected in the inspector, and it is driving me insane.
     
  28. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    What is the water physics like in this asset? Are both bouyancy and water resistive forces simulated? What about slamming forces such as when nose of boat hits side of a mounting wave?

    Thanks for any info you can give on this, our studio are about to take on a realistic naval sim project so doing some preliminary research!
     
  29. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Buoyancy is there in a basic form.
    There will come an update that will take an optimized hull into account later.

    Basic resistive forces are applied mainly by the slope of the waves and wind.

    Slamming forces could easily be added by checking some points on the ship. Check their speed (vertical and planar), check when they go underwater and add the desired effect.

    Take a look at the Buoyancy.cs script.
    It could be easily modified to your needs.
     
  30. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Brilliant thank you, I may message you regarding this once we start but sounds great
     
  31. unity_hUGr0wWRISeorQ

    unity_hUGr0wWRISeorQ

    Joined:
    Dec 14, 2018
    Posts:
    2
    Hello !

    When i run my game, I got an error about the Ocean.cs file
    Here is :

    IndexOutOfRangeException: Index was outside the bounds of the array.
    Ocean.GetHeightChoppyAtLocation2 (System.Single x, System.Single y) (at Assets/Ressources/Ocean/Scripts/Ocean.cs:2054)
    Buoyancy.update () (at Assets/Ressources/Ocean/Scripts/Buoyancy.cs:157)
    Buoyancy.Update () (at Assets/Ressources/Ocean/Scripts/Buoyancy.cs:133)

    I'm using your shader since few month, and it's first time i got this error.
    So i downloaded the latest version, and exactly the same error ...

    I did not change anything on the shader, just added the prefab and ran the game.

    The error does not appear all time, if i stop game, retart it few times, it will work few seconds and crash again
     
  32. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Have you copied all the scripts and plugins folder over?
    Just adding the prefab is not enough.
     
  33. ArmandAnton

    ArmandAnton

    Joined:
    Mar 19, 2019
    Posts:
    4
    Hello ! I would like if it's possible or not to change de tile's loading range.
    I would like to increase it.
     
  34. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    Increase the Tiles count and the Tiles size (better use power of two here)

    If the tile size is large you should raise the tile grid resolution.
     
  35. ArmandAnton

    ArmandAnton

    Joined:
    Mar 19, 2019
    Posts:
    4
    Hi ! Ok thanks it's working right.
    But how could i fix that ? The space between discs.

     
    Last edited: Mar 20, 2019
  36. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    This is a strange behavior.
    The disc should be very close to the last lod tiles.

    I don't know what happened here. But you could just lower the disc at runtime after the ocean creation.
     
  37. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Hi, thank you for taking the time to provide help here.

    I'm not sure how I can remove that dark part in the distance?

    upload_2019-3-22_21-25-12.png

    I'd like to "fade out" the ocean in the background by making it brighter the further it is (atmospheric perspective just like in real life). I can't figure out how to achieve it, can you please advice?
     
  38. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello.

    I would disable shader lods and enable fog.
    Then play with the fog distances and color/intensity values.
     
    roseportalgames likes this.
  39. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Hi thank you disabling Shader LODs worked

    However I cannot find any "Fog" settings? Are you referring to Mist? If so which one should I use to create atmospheric perspective?
     
  40. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
  41. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi.

    Even if you are not using fog in your scene, when you enable Shader Fog L0.L1.L2, you can alter the fog settings at the Unity Lighting Window and it will be taken into account.
     
    roseportalgames likes this.
  42. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Oh, sorry, I didn't realize you were referring to Unity's fog.

    It doesn't seem to affect the ocean, though? No matter how I put the settings I can't see any difference. Hmm.

    upload_2019-3-23_20-35-34.png

    Thanks for your support,
     
  43. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    The shader supports it.

    Try raising the near value and end value.
     
  44. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Anyway.

    A new version will come out shortly and I hope this issue will be resolved.
     
    hopeful likes this.
  45. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Could it be a platform issue? I'm set to Android build.

    BTW I'm getting this error when I try to build:
     
    Last edited: Mar 23, 2019
  46. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
  47. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Yes it could.

    Try Forward rendering path.
     
    Last edited: Mar 23, 2019
    roseportalgames likes this.
  48. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    You have to assign each android plugin for the appropriate cpu target.

    If you are not using a version of unity that supports arm64 android you can safely delete it.
     
    roseportalgames likes this.
  49. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Got it, thanks a lot!

    I have one more question, sorry:

    what's the easiest way to (for mobile-friendly) add a boat wake? I'm not actually going to add a boat, I just need to show the effect. I'm guessing I need to move a transparent cube or something through the water but I'm really not sure where to start. The demo scenes don't seem to have a boat wake either.

    Thank you <3
     
  50. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    If you assign a mesh as the "player" it will generate interactive foam at its position.

    For a more realistic wake you would have to create a dynamic mesh with an alpha blended shader, that would update its vertices at the ocean height.
     
    roseportalgames likes this.