Search Unity

The Community Ocean Shader (Open Source) Unity 5

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

  1. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Weird. I used the lib on Unity5.6.2f1 and worked ok. Try to check the foam texture settings.
     
  2. PapaCUh

    PapaCUh

    Joined:
    Jun 17, 2017
    Posts:
    6
    @elias_t

    I tried using Unity 5.6.2f1 and the result is the same. The game already starts with those white squares around the player even without moving it. Other variations of the foam settings produce the same results.
     

    Attached Files:

  3. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    On what hardware you have these results?
     
  4. PapaCUh

    PapaCUh

    Joined:
    Jun 17, 2017
    Posts:
    6
    @elias_t

    It is not working correctly on this machine:

    Windows 8 x64
    Intel i5 3210m 8gb RAM
    Intel HD 4000 graphics card

    I tried on two other machines and work correctly on both:

    Windows 7 x64
    Intel i5 4690 8gb RAM
    ATI Radeon R7 370

    Windows 7 x64
    Intel Q6600 (Core 2 Quad) 6gb RAM
    Nvidia GeForce GTX750TI
     
  5. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. Then I suspect it is drivers/hardware related. Because on a MacMini with hd4000, it works ok on me...
     
  6. PapaCUh

    PapaCUh

    Joined:
    Jun 17, 2017
    Posts:
    6
    @elias_t

    I used the latest available drivers (march/17) and the problem continues. :(
     
  7. st-VALVe

    st-VALVe

    Joined:
    Jan 8, 2014
    Posts:
    13
    do you plan some further performance optimizations for waves generator script? is there any potential for that?
     
  8. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    Hi, I am facing a problem with android build. The ocean seems to be rendered only inside some radius. How can I increase the radius. I am using glaxy S7.
     

    Attached Files:

  9. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    st-Valve. Yes. Better fft lib and for mobile some more interpolation routines.
     
    st-VALVe likes this.
  10. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. This seems to be a camera low far plane.
     
  11. st-VALVe

    st-VALVe

    Joined:
    Jan 8, 2014
    Posts:
    13
    so I have just one question now - WHEN?!))
    we DO need it!
     
  12. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    Are
    If you are referring camera's far clipping plane, then its actually very large as you can see in the new pic, a distant ship is also visible.
    If you are referring to something else, can you please elaborate it a bit more.
     

    Attached Files:

  13. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Don't know yet... I am only one man...
     
    st-VALVe likes this.
  14. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok then. It must be the ocean fog flags. Raise its radius in the ocean settings.
     
  15. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    I have mist turned off. I have attached the screen shot of the ocean settings. I can't found any radius variable in ocean settings.
    Also I have fog turned off as well.
     

    Attached Files:

  16. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    Its working fine in Unity but I am facing this problem in android device(Galaxy s7).
     
  17. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    It is not the mist. I cannot see the lower right settings where the ocean fog settings are.
     
  18. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    Sorry about that here is the new Screen shot
     

    Attached Files:

    • OSS.png
      OSS.png
      File size:
      214.6 KB
      Views:
      917
  19. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    Will it work if I turn fog off?
     
  20. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Yes. But you can just increase the fog distance in Unity's fog settings.
     
  21. SandeepSps

    SandeepSps

    Joined:
    May 26, 2017
    Posts:
    8
    Still facing this problem. It works fine on OnePlus 3t, Xiaomi note 4, but its not working on Samsung devices.
     
  22. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Sorry. This must be a Unity/samsung driver thing then.
     
  23. Jeremy-Lv

    Jeremy-Lv

    Joined:
    Mar 17, 2013
    Posts:
    16
    Where is the source code of c++ so... and why those code use c++,for what calc ?
    More faster ?

    Thanks a lot ~~
     
    Last edited: Jul 18, 2017
  24. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. The old c# code is slow, although it is much faster then the original version.

    I made the c++ native plugins, which give much more speed. They will be kept closed source for now.
     
    st-VALVe likes this.
  25. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    just reading the older posts about a commercial version.

    Take a cue from successful authors and make it worth your while. Enough so you can afford to respond quickly to issues and be on top of bugs. $35 to $50 would be completely reasonable for a good asset. Cheap will scare away professionals more often then not.

    Closed source will make it not worth nearly as much, not to professional developers. Something like unity itself that has a company behind it you know isn't going away fine. But for something that you would want to tweak, or by a company that is just a one man show, that's a huge risk and I'd probably pass if it was closed source. Too many cases of authors abandoning their work and then we get stuck with something that is impossible to fix ourselves.
     
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    My best advice for a paid version: have it completely done, with all features, before release. Once you release, a ton of time will go to support, with people asking all kinds of questions. The requests will be greater in number and more histrionic the more incomplete the package is. Developers chronically underestimate this situation, and report that the time taken to serve the demands for support reduce their profits to minimum wage or less.

    A complete package that already answers issues of performance, VR, mobile, shadows, reflections, transparency, and so on will require less support and will be more successful for the plugin developer.
     
  27. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    @snacktime , @hopeful

    Thank you both for your comments and advises.

    In my mind I had such paths in mind. But real life issues arise all the time.

    Lets see.
     
  28. Hitch42

    Hitch42

    Joined:
    May 12, 2015
    Posts:
    98
    If you plan on releasing a commercial asset, be sure that you're prepared to stick with it for a while and make that known. For some reason, several well-known Unity ocean shaders have had trouble or stopped updating all together. Not to criticize you, but reading "But real life issues arise all the time." makes me very wary about purchasing an asset, especially an ocean one. I'd hate to see yet another ocean shader asset on the market, only to have it stop support shortly after.
     
  29. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I didn't mean that by "real life issues". I meant that other contracts kept me away from starting it.

    I publish assets on the asset store and I update them since 2012.
     
  30. Kenthria11

    Kenthria11

    Joined:
    May 6, 2017
    Posts:
    20
    The issue i'm experiencing is- I've added a big ship, so the camera is higher. If the camera is above a certain height everything is covered in a glossy white.

    Is there a way around this?
     
  31. eXonius

    eXonius

    Joined:
    Feb 2, 2016
    Posts:
    207
    Probably, yes. But I'm too lazy to test it myself. If you could set up a small example project and upload it I could try to figure out what needs to change.
     
  32. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    This is really a brilliant project but I'm having a problem with mobile performance. Running the Mobile demo on a top of the line iPad I can get only a maximum of 30fps. Tried targeting Metal, OpenGLES3, no difference.
    Are there specific Ocean shader or inspector settings I can tweak to get better performance?
     
  33. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367

    I am getting a pure 60 fps on iPhone 5S.
    Have you enabled the NATIVE;THREADS preprocessor flags ?
     
  34. eXonius

    eXonius

    Joined:
    Feb 2, 2016
    Posts:
    207
    I want to change the length and width of the waves. Where in the code do I need to look to change this? I can't seem to figure it out.

    In the "Waves Settings" I can set the "Scale" but that only seems to affects how high the waves are. The thing is my scene use a smaller scale (it's a strategy game with cam from top) so I need to change the length and width of the waves not just the height.

    Maybe you know @elias_t ?
     
  35. elias_t

    elias_t

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

    Yes you can do that by changing the tile size here:

    Untitled.png
     
    eXonius likes this.
  36. eXonius

    eXonius

    Joined:
    Feb 2, 2016
    Posts:
    207
    Thanks! I didn't realize the tile size affected the wave size.
     
  37. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    Hello, I am unable to see anything in the inspector on unity 2017.1.x builds. Only the background and Mobile/Desktop dropdown control are visible.

    I see these messages in the console:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.EditorGUIUtility.TempContent (System.String[] texts) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIUtilityBindings.gen.cs:327)
    3. UnityEditor.EditorGUI.Popup (Rect position, Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUIStyle style) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorGUIBindings.gen.cs:550)
    4. UnityEditor.EditorGUILayout.Popup (Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6475)
    5. UnityEditor.EditorGUILayout.Popup (Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUILayoutOption[] options) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:6468)
    6. OceanGeneratorInspector.OnInspectorGUI () (at Assets/Ocean/Ocean/Editor/OceanGeneratorInspector.cs:163)
    7. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1240)
    8. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Code (CSharp):
    1. Unexpected top level layout group! Missing GUILayout.EndScrollView/EndVertical/EndHorizontal?
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
  38. omerselman

    omerselman

    Joined:
    Mar 5, 2016
    Posts:
    20
    Probably, no not probably it is definetly the best water shader around. Optimised, free, good looking. Thanks mate you are a hero.
     
    elias_t, eXonius and hopeful like this.
  39. vectorCharlie_f

    vectorCharlie_f

    Joined:
    Sep 12, 2017
    Posts:
    10
    @elias_t much respect!!

    I'm trying to find a way to make the ocean simulation identical every time the game starts. Is that possible?

    Perhaps there is something in the code that gives the start point its randomness. Any leads?

    Thanks so much!
     
  40. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. The only variable (besides the inspector ones) that dictates the procedure of the simulation is the Time.time float.

    Find it in the Ocean.cs script and replace it with one that fits your needs.
     
  41. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Sorry for the late reply. i have been away from this thread for a while.

    I do not have this issue on 2017.1. Perhaps reimport the project?
     
  42. gsimons

    gsimons

    Joined:
    Oct 3, 2017
    Posts:
    5
    Hey there,

    Thanks for the great work you have done on this simulator, it's a great piece of work! I am using it in a simulator, but run into some problems when I adjust the time scale. The physics seem bodged up when you increase the time scale. The boat sinks much farther and other strange effects happen when moving.

    To recreate add for example this simple script :

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class ChangeTime : MonoBehaviour {

    // Use this for initialization
    void Start () {
    Time.timeScale = 10f;
    }

    // Update is called once per frame
    void Update () {

    }
    }


    Any idea why this happens and on how to fix it?

    EDIT: Ah of course I discover the solution just after posting this: You should set Use FixedUpdate to True!

    EDIT 2 : Well kinda fixed, the physics do become very unstable if I increase it too much (let's say to 10x). The boat will behave erratic. Any way to fix this? Preferably I want to run the simulation as fast as possible (for machine learning)

    EDIT 3 : The same happens when altering the target frame rate!
     
    Last edited: Oct 13, 2017
  43. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. You should alter all the time dependent functions in the Ocean.cs script. Not sure if this will be enough though.
     
  44. gsimons

    gsimons

    Joined:
    Oct 3, 2017
    Posts:
    5
    Hi Elias,

    Thanks for your quick response. I thought as much. Could you point me in the rough direction of where to look for the functions of interest? Personally I thought the Boyancy script would be the most important, as the rendering of the ocean itself seems fine (and is also of less interest for the machine learning).

    Thanks again.
     
  45. gsimons

    gsimons

    Joined:
    Oct 3, 2017
    Posts:
    5
    I managed to make the erratic behaviour disappear by dividing the computed boyancy by Time.timeScale, but this also causes the boat to sink much lower, which makes sense because the boyancy is less. I think I am on the right track, but I need to add this factor somewhere else.

    I made some videos of the behavior, but unable to upload here. Any idea on where to add this time factor?

    Thanks

    EDIT: If someone else stumbles here. Just don't scale the time factor by too much and use fixed updates!! This is relevant when using the Unity ML Agents for example
     
    Last edited: Oct 18, 2017
  46. vectorCharlie_f

    vectorCharlie_f

    Joined:
    Sep 12, 2017
    Posts:
    10
    I am still struggling with creating a simulation that is identical every time I run it and I am hoping someone has another lead for me.

    I've replaced the Time.time floats with a float that increments by 0.001 every frame. However, the simulation is still different everytime I run it. What else in the code or the inspector might be contributing to the randomness?

    My reason for wanting to do this - I have a rough ocean which occasionally has a freak wave that rises higher than the camera. I want to be sure that these freak waves do not occur.
     
  47. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Sorry for the late reply. I am hardly occupied on some other projects right now.

    You are right when the wave noise is created a gaussian random number is used in the InitWaveGenerator function.

    To modify this now you must disable the NATIVE preprocessor directive and modify the c# version of the function.
    I will however try in the next days to allow to pass the random numbers to native plugins also.

    Which platform interests you the most?
     
  48. vectorCharlie_f

    vectorCharlie_f

    Joined:
    Sep 12, 2017
    Posts:
    10
    Thank you! I'm building for the Android platform. Gear VR to be specific.

    Your explanation goes over my head but if you end up implementing something which helps me achieve this, that would be fantastic.
     
  49. uchikat2

    uchikat2

    Joined:
    Jun 1, 2017
    Posts:
    3
    Hi, I'm on version 2017.1, and when I open the Ocean_with_ships_island demo scene, I'm not able to see any foam around the islands or the boat. Any hints as to why? None of the shaders show foam. CommunityOcean.PNG
     
  50. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello. I have it running as it should on unity2017.1.

    Try to reimport the project and make sure your camera renders depth.