Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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
    Alright.

    It took me a little bit more for this update. I lost some time on adding an interpolation feature for the waves creation, but it didn't worked well. But I am on track now to bake wave loops and load them instead for on the fly calculations. If this turns out good we are gonna have a 1ms ocean system.

    Anyway this update is major for me: https://github.com/eliasts/Ocean_Community_Next_Gen/

    inspector.jpg editor.jpg




    12/12/2015 Major update

    • Buoyancy has been rewritten with very good and fast results.
    • Custom inspector for buoyancy with additional variables.
    • You can save/load a buoyancy setup for a vessel.
    • Partially rewrite of the boat controller script. Boats behave more realistic now.
    • Choppy waves, wind and wave slopes are able to influence the vessel's condition. This adds a lot of realism.
    • The shader has been rechecked again. Higher performance is back in now. The previous mobile fix added some unneeded overhead.
    • More multithreading optimizations.
    • Math optimizations.
    • The Editor Inspector has been improved and prepared for the future additions.
     
    Last edited: Dec 12, 2015
    John-G, hopeful and Torigas like this.
  2. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    https://github.com/eliasts/Ocean_Community_Next_Gen/

    13/12/2015 Hotfix update

    • I had to rewrite the Get water height and get choppiness functions. They had some bugs and were not accurate enough.
    • Added an option to buoyancy script to use a more accurate but slower function.
    • The simple buoyant object can work also with rigidbodies now.
     
    hopeful likes this.
  3. Gherid_lacksGPS

    Gherid_lacksGPS

    Joined:
    Dec 3, 2011
    Posts:
    111
    First off, I think it's fantastic that you all have picked this back up. Just wonderful.

    A few questions:

    - Orientation of buoyant objects, particularly static, seems limited to the Y axis - vertical position to wave. Objects don't "rotate" or "align" to the face of a wave, as if "rolling" over They just "hover" over it? Does that make sense? I've tried messing with drag, various settings, etc. Am I missing something or is this simply how the buoyancy script functions?

    - It feels like buoyant objects are "sucked" back to the wave surface when they become airborne, ignoring gravity. At speed, boats / vessels react more like "frolicking dolphins", rather than an object skipping across the water / launching off waves. Again, is there something I'm missing, a function or setting? Or, is this simply how the script is designed?

    - Finally, has anyone looked into synching over a network? Perhaps a bit beyond scope, but was just curious.

    Again, its amazing this was picked up. A great resource for the community, you're rock stars.
     
    hopeful likes this.
  4. elias_t

    elias_t

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

    There are 2 scripts regarding buoyancy.
    One is meant for smaller objects and one for boats and ships. The first is more limited.
    The second should give you the desired behavior but needs some tweaking on the parameters (or even in the script. It was meant to work best with mobiles. So there is still room for a lot of improvement.)

    edit: I forgot to mention that it works with a box collider only now to have more performance. But a mesh collider (hull?) will be added for sure in the future.

    This is why I have coded the load/save buoyancy+rigidbody settings.

    try to increase the slices number, use the "more accurate" flag and play with buoyancy power, damp coefficient etc.


    But there will be further optimizations in the future.

    On other news the baking of the wave creation cycle is on the road and also a c++ implementation.
     
    Last edited: Dec 14, 2015
    Gherid_lacksGPS and hopeful like this.
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    My impression is that putting it in c++ will be a big optimization.
     
    namanam and elias_t like this.
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    @elias_t any news on projected grid mesh?
     
  7. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    @rea. This will come later I suppose. I want to optimize it to death first and then starting adding new stuff.

    (no. 666 post. I hope it doesn't doom the implementation :) )
     
    idurvesh likes this.
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    well you should summon them maybe they can help with the implementation :D
     
  9. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. I didn't intend to upload an update today, but I discovered a major bug in the buoyancy script.
    Now it should behave much better.

    https://github.com/eliasts/Ocean_Community_Next_Gen/

    Gherid the 2 videos below I believe they will satisfy you. This is the best a box collider can do.
    I am thinking now to add a special optimized hull creator for more realistic results.





    Here is the changelog:
    15/12/2015

    • Major Bugfix in the buoyancy script. Now Buoyancy will work much better.
    • Buoyancy fixes on boats to work well with various sizes of the ocean.
    • Ability to run the buoyancy simulation of an object in fixed or regular update.
    • More shader modifications. Added one more lod and improved foam on higher quality lods.
    • Math optimizations on Vector3 Normalize gave some extra performance boost.
    • Added 2 more lod materials and shaders that support reflection and refraction.
    • Now the highest quality shader lod is lod5.
    • Now the ocean materials are saved in the ocean presets. This required to put them in the Resources folder!
     
    Last edited: Dec 14, 2015
  10. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    Hi. Are materials in Ocean Sources folder missing? It seemed to be case for me. I just copy/pasted them from an older version and got it to work again.
     
  11. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. As stated in the changelog, I moved the materials in the Resources folder so the system can load various ocean presets at runtime. I recommend to use the new method for the system to work correct.

    edit: I will upload a version with the Library folder, as it seems some prefab connections are lost.
     
    Last edited: Dec 14, 2015
  12. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. I have updated the project with the Library folder included.
    That should resolve any issues with lost prefab connections.

    15/12/2015 second part

    • Uploaded project with 'Library' folder to avoid losing prefab connections.
    • Small bug fixes.
    • Small performance increase. (~5%)
    • Slimmed down the Exocortex plugin.
    • WebGL compatibility fixes.
    • Buoyancy update.
    • Vector Normalization performance increase.
     
    Last edited: Dec 15, 2015
  13. Elixus

    Elixus

    Joined:
    Dec 15, 2015
    Posts:
    2
    This is a really beautiful ocean model! Really impressive work :D

    A few comments/questions:
    -The wave offset animation speed seemed a little sensitive and caused the ocean to appear to flow in different directions. As my game contains land next to an ocean, I needed the ocean to appear to flow inland. At some speed values, this happened, and at others it appeared as if the water was flowing away from the land. I did a temporary fix by hard coding the wave offset values in the Ocean script.
    -I can't seem to change the transparency of the water. The slider for the material doesn't seem to do anything, and I tried hard coding the values in the shader but that didn't work either, unless I was doing something horribly wrong! :p
    -Is there a way to reduce the glossyness of the ocean? (Note that I have the specularity set to 1). I might be totally wrong, but doesn't choppy water appear less glossy than calm water? My ocean looks a bit too glossy during a storm, although maybe I just need to smear some vaseline onto my sun to fix this.

    Any thoughts/progress about adding the shoreline foam? I had a look at the standard assets Water4Advanced prefab/script, which has the setting to apply an "Edge Blend". Not entirely sure how they did it but it might be worth a look.
     
  14. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. The shader part didn't took so many updates/improvements because I want to optimize as much as it gets the wave calculations.

    Yes shore lines will be added and I have done some old work which should look really cool.
    But this will come later.

    However I made an update today that addresses your issues: https://github.com/eliasts/Ocean_Community_Next_Gen/

    16/12/205

    • Changed the bump and foam scrolling in the shaders. WaveOffset speed parameter has been removed.
    • Improved specularity in the shaders.
    • Added extra shaders with alpha support.
    • Added shader with Reflection and alpha.
    • Added extra lod materials to support the new alpha shaders.
    • Simplified the far lod shaders to improve performance.
    • The buoyancy editor saves now also boat controller parameters if the boat controller is attached to the object.
    16/12/2015 second part

    • Added ability to adjust the reflection strength.
    • Fixed some issues with the new alpha shader switching.
    • Slimmed down more the Exocortex plugin.
    • Updated and added more presets.
     
    Last edited: Dec 16, 2015
  15. Elixus

    Elixus

    Joined:
    Dec 15, 2015
    Posts:
    2
    A really nice update! Thank you :)
     
  16. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Got distracted with the shader ...

    I have added basic shore line foam but struggling to have the depth mask on the boat working and setting its render queue so it doesn't show shore foam because of its depth writing.

    The SM2 instruction limit is almost reached now. So it will be very difficult to have shore foam and translucency on SM2.

    newshader.jpg

    newshader2.jpg
     
    Last edited: Dec 17, 2015
    Elixus and Gherid_lacksGPS like this.
  17. NullSignal

    NullSignal

    Joined:
    Sep 18, 2013
    Posts:
    45
    I'm getting this error on the Ocean script

    Assets/Ocean/Plugins/Exocortex_FFT/Complex.cs(274,84): error CS1061: Type `ComplexF' does not contain a definition for `GetModulus' and no extension method `GetModulus' of type `ComplexF' could be found (are you missing a using directive or an assembly reference?)

    Is there a fix for this?
     
  18. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I have completely slimmed down the Exocortex plugin. If you downloaded the latest version you can delete Complex.cs.
    Or delete the plugins folder and replace it with the folder from the repo.
     
  19. NullSignal

    NullSignal

    Joined:
    Sep 18, 2013
    Posts:
    45
    Yep, that got it. Thanks!
     
  20. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Got some basic per vertex translucency going:

    translucency.jpg
     
  21. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    ooh is the translucency already pushed into the latest repo?
    and is there a way to make the waves settings to updated at runtime?
     
  22. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    No, it is not in yet. I am rewriting big parts of the shaders now. The HQ shader has reached the 64 intructions limit in its vertex shader part. Including translucency and shore foam.

    edit: Nevermind the renderqueue rant. I got it sorted now. I will clean up and update the repo.

    You can already load the ocean settings at runtime, as long as your tile settings are the same with the previous setting. (size, polycount, no. of tiles etc.)

    tr.jpg
     
    Last edited: Dec 19, 2015
    Gherid_lacksGPS likes this.
  23. Gherid_lacksGPS

    Gherid_lacksGPS

    Joined:
    Dec 3, 2011
    Posts:
    111
    Was recording with Fraps - V 3.5.99, an older version - and was consistently getting anomalies in buoyancy. At speed the object would "buck" when apexing a crest. I've added some simple down force and COM to my prefab, and shut them off thinking those were the issue, but no such luck. Kinda weird, once even slowly ascending into "orbit" then crashing back down to the water when I let go of any boat control - forward - input. Just a heads up.

    I'll continue to test and see if it's just my set up, but like I say, no issues when not recording.
     
    elias_t likes this.
  24. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Try to record at 60 fps. At 25 fps I believe it locks the framerate while the default update of the buoyancy happens in the regular Update() function. Either check the "use FixedUpdate" checkbox on the buoyancy inspector.
     
    Last edited: Dec 21, 2015
  25. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Teaser post. Update is coming later today.

    shore5.jpg
    shore4.jpg
    shore1.jpg
     
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Will it be possible to eliminate the tiling type effect that's visible in the 3rd pic above?
     
  27. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Yes. But it will come later. For sm2 however some shaders will be not able to support this or they will use a 2nd pass.
     
    hopeful likes this.
  28. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. Here it is: https://github.com/eliasts/Ocean_Community_Next_Gen

    It took more then a week to get the most out of the SM2 shaders. I will focus next on continuing the performance tweaks and then alternative algorithms and meshes with SM3 shaders and more per pixel effects.

    editorV3.jpg

    22/12/2015 Major update

    • Shaders almost totally rewritten.
    • Added per vertex translucency shader lod.
    • Added shore line foam support (It can be switched on off by code or by the editor, per lod). (You can define the shore length and the shore foam power.)
    • Shaders calculate their own linear fog (if enabled). This was done to save shader instructions. (That means that only linear fog is valid now. Use the fog far and fog near in the unity editor to set the values.)
    • Fog can be switched on or off per lod.
    • Added the ability to display only fog color after a certain range. (Called distance cancellation.) Can be switched on or off per lod.
    • Added Specular Power slider. (Specular didn't had power factor before.)
    • Fresnel calculations have been simplified in the shaders to reduce shader instructions.
    • Added the ability to set render queues for the ocean and the boats. This is useful if you don't want to show shore foam around the boat.
    • Reordered and revamped the inspector.
    • Simplified the Exocortex plugin even more.
    • Added more materials and ocean presets to demonstrate the new features.
    • Added a new scene with an island to test the shore foam.
    issues: 1. If you set the render queue of the boat to 2501 and higher to avoid the shore foam around it you lose shadows. 2. If you have a render queue that shows foam around the boat some white pixels appear around the silhouette of the boat. That is because the depth buffer is used. Will look to smooth this out in a next update.

    If anybody has any idea how to resolve the above 2 issues I would be very grateful.
     
  29. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    If you are getting errors in the console while running the demos, select the Mist prefabs and set their layer to "Water". This applies mainly for Unity 5.3.1.
     
  30. NullSignal

    NullSignal

    Joined:
    Sep 18, 2013
    Posts:
    45
    Is there any way to make this ocean mostly clear? I'm trying to show underwater details and it's just not working. I can see the transparency/translucency working, but it's just not enough. Also, is the Follow checkbox not intended to basically make this an endless ocean? Because that's not working for me at all.
     
  31. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. Sure you can.

    Make sure you use the reflective/refractive or Alpha/Reflective shader lods.
    For the reflective/refractive lods raise the reflectivity and make the water color more white and less saturated:

    clear1.jpg

    clear1b.jpg

    For the Alpha shaders make the water color less saturated and more dark.

    clear2.jpg
    clear3.jpg


    The demo right now is set up so the ocean follows the boat.
    If you want the ocean to follow your main camera, assign it on the inspector as target, with 'Follow' checked.

    Or use this command within your code:

    Code (CSharp):
    1. AssignFolowTarget(Camera.main.transform);


    On other news: I have ported the core of the system to optimized c++ with very good results. I am getting now 0.5-1.2 ms for the core. I am adding parallelization and/or OpenMP/SIMD/GPU acceleration. But this depends on the platform. The Android being the hardest to add NEON acceleration.

    The main bottleneck is the Mesh.vertices = assignment. Unity should provide more support to assign vertices faster to the vbo.

    Proof of performance:

    2ms.jpg
     
    Last edited: Dec 29, 2015
    ZJP, Hormic, AlenH and 4 others like this.
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    It's all awesome, but this is really awesome. :)
     
  33. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    I decided to pick this up and give it a shot to see how it would work in my game. There are a couple of issues. The biggest being that there doesn't seem to be a way to have it build one water surface exactly how I want it in the correct position. No matter how I move around the starting position, it still builds in some random direction. Is there a way to get the water tiles to be exactly the way I want them?

    Also, I keep getting the following error:

    Code (csharp):
    1.  
    2. UnassignedReferenceException: The variable player of Ocean has not been assigned.
    3. You probably need to assign the player variable of the Ocean script in the inspector.
    4. UnityEngine.Transform.get_position ()
    5. Ocean.calcPhase4 () (at Assets/Ocean/Scripts/Ocean.cs:628)
    6. Ocean.updWithThreads () (at Assets/Ocean/Scripts/Ocean.cs:427)
    7. Ocean.Update () (at Assets/Ocean/Scripts/Ocean.cs:397)
    Not sure why this is happening, but perhaps you can shed some light on how I can go about fixing it.

    Also, I don't always want a sun in the scene, yet the water system won't work if there's no sun set. There should be a way for the system to work without a sun.

    I recommend trying to have the water in a scene with no boat and no sun. Looks crazy.

    What is the "Target" for? I left it blank since I don't have a boat on the water. Doesn't seem like the system likes having that blank, which is why the error above happens. I added a blank object in the scene and it gave all kinds of wonky behavior.

    I think this can be a great asset, but there needs to be no dependence on certain things since everyone has different stuff in their scene and not everyone will need every feature. Still, I'd like to continue working with this since I think the demo scene looks great and I think it can ultimately look great in my game.
     
    Last edited: Dec 30, 2015
    hopeful likes this.
  34. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hi. 1st let me state that I haven't designed the system from the ground up.
    I had used the old variation in the past for some projects with some optimizations.
    Then when Laurent asked some help I jumped in to add foam bump support.
    And from there I took the system at 16ms and brought it to 1ms.

    Ok. The target is just a transform where the sea gets spread around it. If you assign your main camera it will follow your main camera.

    I posted above that you can change the transform that the sea follows like this:

    Code (CSharp):
    1. //Call AssignFolowTarget(Camera.main.transform); so the ocean follows the main Camera.
    2. public void AssignFolowTarget(Transform tr) {
    3.     player = tr;
    4. }
    5.  
    But yes, there was no prediction if somebody didn't assign a follow transform or a main light.

    Add this to the Ocean.cs script:

    Code (CSharp):
    1. void OnEnable() {
    2.     //if target == null assign the main Camera
    3.     if(!player) { player = Camera.main.transform; }
    4.     //with no light with enabled shadows, if you have shore foam enabled you will get depth buffer artifacts. In that case use Deferred Legacy render path or add a dummy light with shadows enabled.
    5.     if(!sun) {
    6.         if(useShaderLods) { for(int i=0; i<numberLods; i++) { if(mat[i] != null) mat[i].SetVector ("_SunDir", Vector4.zero); } } else { if(material != null) material.SetVector ("_SunDir", Vector4.zero);}
    7.         if(useShaderLods) { for(int i=0; i<numberLods; i++) { if(mat[i] != null) mat[i].SetColor("_SunColor", Color.white); } } else { if(material != null) material.SetColor("_SunColor", Color.white); }
    8.     }
    9. }
    And change this line at the Start() function:

    Code (CSharp):
    1. sunLight = sun.GetComponent<Light>();
    to this:

    Code (CSharp):
    1. if(sun) sunLight = sun.GetComponent<Light>();
    It will assign the main camera as the target, and will avoid the sun light.

    However this way you will loose specularity.
     
    hippocoder likes this.
  35. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    506
    Okay. I'm just curious why it needs to follow anything? Water is just sitting there and doesn't need to move at all. Like a building in the middle of a city.

    Also, in my game a scene doesn't necessarily have a Sun or a camera in it when it's being created. This is because the zone is loaded and deleted when it's not needed and the actual sun/weather stays in RAM all the time. So when a zone is being created, there aren't any cameras or Suns. I guess I'll have to jump in and modify the code to handle this, but I haven't seen any other asset work like this.

    Thanks for the information. Can the target just be a blank object and not a camera? If it's where it starts, then I would imagine that any blank object should work. I tried to do this yesterday, but the water looked pretty crazy. Heh, heh.

    How does the water know what layers to use for the coastal foam?
     
  36. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Any ocean/sea system uses an approach where the more detailed water is around the player/camera.
    Being it a tiling system, a projected grid or a radial grid.
    In the future I plan to implement variations of these.

    The ocean needs a sun to feed the shaders information about sun direction, color and/or intensity.

    Anyway I have resolved these issues now for the next update. If they are blank the main camera is going to be used and a dummy sun.

    For the shore foam: Any mesh that writes to the depth buffer will get this. If you set the renderqueue above 2500 it will not produce shore foam, but it will not receive shadows as well.
     
    hippocoder likes this.
  37. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I have reduced unnecessary vbo updates and now the system together with the new optimizations takes around 1ms without the job frame spread and around 0.4ms with a 3 frame frame spread.

    I will make the native plugins for all the other platforms and then update the repo.
    The gpu acceleration stuff might not make it into this update though.

    fast2.jpg
     
    Last edited: Dec 31, 2015
    Gherid_lacksGPS and Elixus like this.
  38. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Ok. This is another big update.

    https://github.com/eliasts/Ocean_Community_Next_Gen


    05/01/2016

    • Added native plugin support for the core functions. Significant speed increase! The core functions went from 6.7 ms to 1ms and below.
    • Preprocessor defines are defined in Player Settings now (SIMD;THREADS;NATIVE)
    • Native plugins for: Android, iOS, tvOS, WebGL, WSA81, WSA10, Winx86, Winx86_64, Linux-x86, Linux-x86_64, MacOSX Universal. (The above platforms can enable the native plugin support by declaring the NATIVE preprocessor define in the player settings.)
    • Made il2Cpp compatibility changes.
    • Removed unnecessary vertex buffer updates! That gave almost an extra 2x speed increase.
    • Tweaked shaders to use one texture fetch less.
    • Fresnel uses same calculation on all shader variation and lods now.
    • Preliminary SIMD vector operations support.
    • Math optimizations.
    • Moved the mist prefabs to the water layer to avoid a Unity5.3.1p1 bug/glitch.
    • Improved runtime changing/loading of the ocean.
    • Now when you run the simulation and focus on the scene view, (in the editor only) the ocean follows the editor camera.
    • If the camera raises above the sea, the height offset between the lods is reduced proportional to the height.
    • Added the ability to change the foam duration.
    • Added the option to specify the low lod number.
    • If the target to follow is a camera do not draw interactive foam. (Multiple boats that draw interactive foam will come later.)
    • Autodetect if no target or sun is assigned and assign the main camera as the target and a dummy vector with white color as the sun.
    • Since the vertex buffer speed increase gave much better performance, the fixed tiles have been replaced with a fixed disc that gives better horizon results.
    • Buoyancy function optimized more. Added native buoyancy functions that will perform batched calculations on Vector3 inputs. (See comments in uocean.cs.)
    • On most devices, when the forward rendering path is used, the depth is not drawn and the shore foam is not working. So I added a forceDepth flag for the main Camera. (See this post: http://forum.unity3d.com/threads/depth-texture-not-working-on-some-devices.319568/ )
    • Added more comments in the code.
    • The native plugins use the kiss_fft lib: http://sourceforge.net/projects/kissfft/ (bsd license)
    The performance gain of the native plugins will vary depending on the platform and os.
    The biggest performance increase is on windows.
    The native plugins have parallelization in them. Various methods have been used:
    Linux and android use openmp, iOS and MacOSX use the GrandCentralDispatch, Windows and WSA use PPL.

    edit: if you want to disable parallelization in the native plugins, use uocean.setThreads(1).

    On a next update gpu acceleration will make it also in, through openCL, openACC and AMP.
    This will allow even a 128x128 simulation to run close to 1ms.

    This update conludes the support for mobile devices. I will concentrate on SM3 and desktop features next.
    (edit: of course alternate ocean mesh drawing methods will be implemented and some better fft libraries.)

    On my iPhone 5s I get very smooth results (60fps) @4ms cpu time.

    On Android I saw some good improvements but my devices are old and I am gpu bound there.

    See ya.
     
    Last edited: Jan 5, 2016
    John-G, idurvesh, Dan_Ran and 4 others like this.
  39. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    https://github.com/eliasts/Ocean_Community_Next_Gen


    09/01/2016

    • The native plugins got more multithreading support. (They should run faster now.)
    • Choppy scale, wave speed & wind direction can be changed during runtime without disrupting the ocean simulation. (This allows more dynamic weather conditions!)
    • Now you can load any ocean preset at runtime! Even if it has different tile number, polycount, size etc.
    • Fixed a bug where far tile lods would not get updates when the lod skipping was disabled.
    • Fixed a bug where the foam would not vanish when using the native plugin and having the spread frames disabled.
    • Added more native buoyancy functions.
    • Linux editor compatibility fixes.
    • WP8.1 & WSA8.1 compatibility fixes.
     
  40. idurvesh

    idurvesh

    Joined:
    Jun 9, 2014
    Posts:
    495
    amazing work going on ...kudos brother.....you are nailing it.......plz keep updating.....
     
  41. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Can't believe I missed this thread. Amazing work you guys are doing with this community ocean and in particular the buoyancy system its unreal.
     
    twobob likes this.
  42. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Got a broken normal on the ocean shader with the latest update.
    BrokenNormal.png
    Also just curious why stick with tile mesh. not using one big radial mesh?
     
  43. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    What he said
     
  44. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I have tested the latest update on various devices and platforms.

    What are your specs?
    Have you done a full replacement of the files?

    I am not sticking to the tile mesh. Other methods will come. I just wanted to finish the speed optimizations.
     
    John-G likes this.
  45. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    nope not changing anything,
    GTX 660
    dx11
    deferred

    That's great, can't wait to see what you gonna add :)
     
  46. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Since my last nvidia card got burned out I have no nvidia card to test on.
    But on my end every combination will work.

    When you say you got this on the last update, you mean the 09/01/2016 or the 05/01/2016?
    Because on the last one no shaders were touched.

    Make sure the normal maps are assigned as textures and not normal maps.
    Make a reimport.
    Delete the Library folder and reopen.

    If these don't work try this last one:

    In the player settings remove the NATIVE prepossesor directive. (It could be that some tangents get not calculated as they should.)

    If again your issue persists I might send you a shader variation to see how this goes.

    What unity version are you using?

    For anybody else with an Nvidia card: Do you have the same issue with the normal map?
     
    Last edited: Jan 10, 2016
  47. idurvesh

    idurvesh

    Joined:
    Jun 9, 2014
    Posts:
    495
    Great, like river up down slope will be nice addition
     
  48. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Well, rivers are another thing. The current simulation code cannot apply to rivers.
    The shader however could get a variation with flowmaps to be used on river meshes.
     
    idurvesh likes this.
  49. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Impressive work so far for sure. How are you assigning verts? AFAIK there's a new api for that stuff coming if it's not here yet.
     
    twobob likes this.
  50. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Well the verts are assigned with the classic mesh.vertices = myCalculatedVetices.

    The old variations assigned them multiple times when there was no need for this. Actually I am impressed that nobody noticed this.

    I don't know about the new api. Will we get a method to assign vertices faster?