Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

The Community Ocean Shader (Open Source) Unity 5

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

  1. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    There is this wind direction values which are default to 10. No matter what numbers I put there the foam and the waves are not changing direction. What might be wrong?
     
  2. elias_t

    elias_t

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

    These values will mainly influence the waves and still do not behave as expected.
    I will look into it and hope to fix this in a following update.
     
  3. ArmandAnton

    ArmandAnton

    Joined:
    Mar 19, 2019
    Posts:
    4
    Hi, I'm trying to change variable ocean.scale using keyboard.
    I would like to increase or decrease the wave scale thanks to a Key like KeypadPlus or KeyPadMinus.

    Is it possible to realise that ?
    I can't figure out how to achieve it, can you please advice?
     
  4. elias_t

    elias_t

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

    You can alter the ocean.scale value.
    When it changes it will be picked up and applied.
     
  5. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    I copied the new native plugins especially because of the new 64 bit version to my current project and tried to build for Android but get an error:
    Found plugins with same names and architectures, Assets/Ocean/Plugins/Android/libs/arm64-v8a/libocean.so (ARMv7) and Assets/Ocean/Plugins/Android/libs/armeabi-v7a/libocean.so (ARMv7). Assign different architectures or delete the duplicate.
    Any Ideas?

    (I should mention, that I cannot make a full update of the whole ocaen system, because I had to change things in ocean.cs)
     
    Last edited: May 8, 2019
  6. elias_t

    elias_t

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

    You have to mark the 64 bit android plugin as armv8-a in the inspector.
     
    Kobald-Klaus likes this.
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    any hopes we'll get a lwrp version?
     
  8. elias_t

    elias_t

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

    Right now I try to keep the lib compatible for unity 5 through unity 2019 with the same codebase.

    I will try at a later date to do an lwrp version.
     
  9. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    has anyone compared performance on mobile with community shader and aquas or similar?
     
  10. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    a quick question since it's driving me crazy. I don't need the wave movements (maybe a slight one but not big waves) because i'm doing a lake. So what I did was create a plane, scale it to whatever: 300x300. Then drop the Ocean Material to it. I was expecting to see a flat water surface, but instead all the tiling is messed up. I tried changing the tiling for the textures on the material but it seems to be ignored.
    How can I create a lake then? I really don't use the waves.
     
  11. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    I'm having 2 issues here.
    1) No shore line. As you can see on the screenshot. When I enable shore lines everything looks like this.
    noshore2.jpg

    2) No shadows. As you can see the trees stop casting on the water.
    noshore.jpg

    I'm using Unity 2019.1.3f and the shader variant 3 (medium quality). Compiling for Android opengl 2.
     
  12. elias_t

    elias_t

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

    The lib is not intended to be used on lakes.
    However with some small modifications a shader variation could be made fro lakes.
     
  13. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    1. There seems to be a z-depth issue here. This should be resolved with the next udpate.
    2. The next update will support shadows.
     
  14. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    any estimates on the next update?
     
  15. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    something got broken? I see on previous posts that shadows were already supported (and shore line)
     
  16. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
  17. am_salperton

    am_salperton

    Joined:
    Mar 6, 2017
    Posts:
    10
    Still 4 years of searching for a good ocean that works in VR. Even Ceto is buggy in VR.

    "Try to edit the Ocean.cs script, to have dedicated reflection/refraction cameras per eye."
    I don't think we can access separate eye cameras in Unity right now.
     
  18. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    I think this is slow dying. It's unfortunate because there is nothing faster than this for mobile and looking so good. I can handle the programming no problem to keep updating it but I'm horrible at shaders. I can't understand half of what's inside the shader code. If anyone mind to comment the shader code for newbies like me, it would be awesome and I may be able to learn it and modify it, that way we don't depend on 1 or 2 people for the community updates. Right now i'm stuck without shorelines and shadows just because I can't figure out where they are handled on the shader.
     
    EL_NINO_, Mauri and Nullic like this.
  19. JuriKnauth

    JuriKnauth

    Joined:
    Jul 26, 2017
    Posts:
    7
    When I reload the scene the waves get a lot rougher - after a few reloads it's madness..

    How can I reset the ocean, when the dynamic waves are enabled?

    SOLVED it - I store the current Time.framecount and Time.time when the scene is loaded and then subtract it whenever these values are used... (Ugly but it works for my purpose).

    Anyway superb job - really dig the ocean shader!
     
    Last edited: Jun 20, 2019
  20. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    thank you for this.

    the ocean seems to be approx. 4 times the unity regular scale
    which adds other problems if want to use with other systems that use physics

    I tried the boat physics with other scales and can't seem to find right values
    if using regular scale, the boat looks like a toy boat (with buoyancy problems) in big ocean
    (and the ocean cannot be scaled down either to look right)

    I think I'll experiment a bit more if can find a middle ground around x2 scale
    but I'd ask if there's a plan to adjust it to regular unity scale
     
  21. elias_t

    elias_t

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

    Sorry for the absence. The lib is still internally updated but there is still some work to be done for it to be ready to pushed to github.

    Unity forum is not pushing email notifications to me when people post here...

    I hope in the following month to push an update.
     
  22. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    man, last post was in may... that's almost 4 months ago. Why don't you push to GitHub as a branch and we merge when ready? Otherwise it's only you and only you working on this and the idea was to have it "community". I'm more than happy to keep updating it but it seems to be dependent only on you nowadays with everyone else just waiting for you to submit or resurrect. It's not healthy for an open source project.
     
    Alverik likes this.
  23. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Did you read my post? I'm more than willing and happy to keep updating it... the open source community project can't be stuck like this for months waiting on a single person. Please if you have developed internally can you submit the changes and we keep up with it?
     
  24. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    ok, I guess we need to begin looking for other ocean shaders. The "community" shader is not so.
     
  25. BlueRain01

    BlueRain01

    Joined:
    Aug 22, 2010
    Posts:
    86
    @elias_t I hope life is going well with you , I understand you don't have to update the project , but i wish you get some time and push what you have done so far , so ppl can pick it up
     
  26. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Hello. I am in between projects but I will try to push an update.
     
    JamesArndt likes this.
  27. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    will this work with LWRP ?
     
  28. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Well, this is one of the reasons that I have left the development of this project behind.

    With all this render systems confusion, constantly changing...
     
  29. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    you right. Thank you.
     
  30. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    please keep it built-in RP compatible. LWRP / URP only if doable
    looking forward to it too, always chekin github
     
    Last edited: Feb 29, 2020
  31. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    He said he already fixed the shorelines and shadows in August 2019. All he has to do is push the shader to the github and we can easily continue the work and help with updates. No need for LWRP/URP or anything else.
     
  32. Bamboidski

    Bamboidski

    Joined:
    Oct 26, 2019
    Posts:
    8
    Hey guys, anyone figured out how to fix the shorelines?
    Also, I have an issue when I build on Android I get this:
    Screenshot_20200308_155628_com.DefaultCompany.OceanTestURP.jpg

    p.s. surprisingly this wonderful ocean works on URP, not with the use of shader graph though, however I believe it can be adapted.
     
  33. StigTerma

    StigTerma

    Joined:
    Jun 7, 2019
    Posts:
    10
    Hi there.

    I'm trying to light up the water using spotlights with cookies. How come I can't see my cookies on the water surface?
     
  34. iichiversii

    iichiversii

    Joined:
    Nov 23, 2011
    Posts:
    139
    I'm having this exact same issue, has anyone a solution to this?
     
  35. Mjfan198

    Mjfan198

    Joined:
    Feb 15, 2017
    Posts:
    1
    Hi Guys

    I'm working at the moment on a ship simulator project... but i have small problems with the reflection of the ships...

    Small example here..




    Could anyone give me a tip, how to fix this problem ?

    Best would be a 1/1 realtime reflection
     
    Last edited: Apr 3, 2020
  36. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    Hi,
    I have a reflection "offset" problem, meaning that the reflections are all shifted to the left depending on the field of view.
    see attached pdf.
    BUT: It ONLY happens, when I target MAC/Windows and not on iOS or Android.
    I am searching since days now. I found, that LOD5 is used from the ocean shader, when switching to mac/windows, but I cannot find any code that could affect this issue.
    (I am using a pretty old version, I think 2 years+ old - but updating is not possible - breaks everything)

    UPDATE:
    when I takeout this term in shaders LOD5
    //half2 bumpSampleOffset = (i.objSpaceNormal.xz + tangentNormal.xy) * 0.05 + i.projTexCoord.xy;
    half2 bumpSampleOffset = i.projTexCoord.xy;
    the offset is gone. but of course the surface of the water is like a mirror then. So the error seems to be in tangentNormal.xy.
     

    Attached Files:

    Last edited: Apr 3, 2020
  37. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    guys i don't think you read the thread before posting. Nobody is replying to anything. The project is basically dead unless someone understand shaders and can fix it.
     
  38. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    seems so. I want to move to crest, but migrating will be a real pain. So I postpone since 2 years.
     
  39. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    I did find the Problem and made a fix. I mean, it´s not really a fix more a dirty workaround hack.
    For some reason this line in all the shader LODs
    Code (CSharp):
    1. half2 bumpSampleOffset = (i.objSpaceNormal.xz  + tangentNormal.xy) * 0.05  + i.projTexCoord.xy ;
    works only on iOS and Android. for Windows/Mac standalone it has to be:
    Code (CSharp):
    1. half2 bumpSampleOffset = (i.objSpaceNormal.xz  + tangentNormal.xy) * 0.05  + i.projTexCoord.xy +half2(-0.05,0);                  
    I have absolutely no idea why this is so. Took me hours to find that out.
    Just in case somebody comes across the same issue.
     
    recon0303 likes this.
  40. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    what does half2(-0.05,0) do? I know very little about shaders
     
  41. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    I am not a specialist either. It seems half2 is kind of a vector2. So with +half2(-0.05,0) I am shifting every pixel a bit to the right, because the other term on the left does it wrong - for whatever reason.
     
  42. Skeketor23

    Skeketor23

    Joined:
    Apr 6, 2019
    Posts:
    49
    Hi everybody,

    I'm using the mobile ocean shader. Does anybody know how I can get transparency to the water?

    Thanks

    Update: ok, sorry for the question, I missed the refraction in the settings
     
    Last edited: Apr 15, 2020
  43. Skeketor23

    Skeketor23

    Joined:
    Apr 6, 2019
    Posts:
    49
    I got a huge problem with this asset, maybe I'm missing something. But what is the best way to move the water to another height? For me it only works when the ocean object is at spot (0,0,0). I also want to use it for a small pool. I'm able to only render one tile, but it also only works when in the center of the map.
    So is there any good possibility to move the origin of the water to a different location?
     
  44. Ants0406

    Ants0406

    Joined:
    Apr 8, 2020
    Posts:
    2
    I know this project seems dead but does anyone have any clue how to get this project to work in webGL 2019.3. There seems to be an issue related to the Ocean.bc file as per this link https://fogbugz.unity3d.com/default.asp?1163092_ata4ac2o89voc2fn

    I am currently getting the below compile error in unity 2019.3 WEBGL project

    ** look for the error unresolved symbol below...

    stdout:
    stderr:WARNING:root:--separate-asm works best when compiling to HTML. Otherwise, you must yourself load the '.asm.js' file that is emitted separately, and must do so before loading the main '.js' file. [-Wseparate-asm]warning: unexpected number of arguments 1 in call to '__cxa_pure_virtual', should be 0warning: unexpected number of arguments 0 in call to 'InitWaveGenerator', should be 1warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 5 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 3 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0error: unresolved symbol: _Znajerror: unresolved symbol: _ZnwjAborting compilation due to previous errors
     
  45. elias_t

    elias_t

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

    This is an issue with the emscripten compiler version used from unity2019 and up.

    I will upload a 2019 version of the webgl plugin.
     
    recon0303 likes this.
  46. elias_t

    elias_t

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

    It seems that the webgl plugin for the Unity2019.x and up versions will take more then I thought to work.

    But you can run the lib if you remove the NATIVE preprocessor directive from Player Settings->Other Settings->Scripting define Symbols.

    In that case you can safely delete the WebGL folder from the plugins folder.

    According to my tests it should run very well following that path also.
     
  47. Ants0406

    Ants0406

    Joined:
    Apr 8, 2020
    Posts:
    2
    This is exactly the info I was looking for. I can confirm my WEBGL build in unity 19.3 is working once again. Thank you for your awesome support to the community!!
     
  48. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    very nice work.
     
  49. Connor-x

    Connor-x

    Joined:
    Apr 14, 2020
    Posts:
    1
    Hey, so I was wondering how I would go about only having certain areas covered with water and how would I stop the tiles from generating whenever the boat moves out of a tile, I'm fairly new to shaders and don't completely understand how they work, any help would be greatly appreciated! :)
     
  50. whidzee

    whidzee

    Joined:
    Nov 20, 2012
    Posts:
    166
    elias_t likes this.