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

Mobile Ocean Water

Discussion in 'Assets and Asset Store' started by KuangZheng, Oct 9, 2013.

  1. Deleted User

    Deleted User

    Guest


    We did as you wrote us, but the water got les FPS than we need.
    Your water looks great, but it has Artifacts on mali 400.
    And there are many phones with mali-400. (http://www.gsmarc.com/model-finder/gpu/mali-400mp/)
     
  2. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    Still use low quality water, delete these codes in low quality shader:
    Code (csharp):
    1.  
    2. float2 uv:TEXCOORD3;
    3. o.uv =TRANSFORM_TEX(v.texcoord.xy,_ShoreLineTex);
    4.  
    I was finding a Galaxy device and maybe I can borrow one tonight. I'll debug it on the real device. Sorry for these.
     
  3. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    This a Vertex/Fragment shader? or a surface shader?
     
  4. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    It's Vertex/Fragment shader.
     
  5. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Hi, I've done this and now have tons of water objects. This might become a bit of a memory issue for mobile because of the sheer number of water objects with multiple components on them. It's also very difficult to work with so many water objects if the size needs to be adjusted, etc.. Is there no way to make the shoreline work with a few larger objects, maybe a custom mesh with more polys? With this many objects when I zoom out in the game I also get tri counts of 150K instead of the average 40K when using regular unity water.

    Also, now that have I have so many water objects I am getting an odd effect when i pan the camera around. The different objects seem to change their look so you can see the outline as you pan around. These flicker no matter how far away the camera is (zoomed/in):
    http://cl.ly/image/070g3p0V2M3s
    http://cl.ly/image/0C1N34402L2d
     
  6. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    You can replace the water mesh to your own mesh. But it will be not much different. When camera rendering,if there is only one big water mesh,all of its vertexes will be caculated even you can't see it . But with many small meshes, those far you cannot see will not be caculated.
    However,150k is too much. It's impossible to run on mobile devices.

    You can try to scale the whole water object to bigger and reduce some objects while the shore line effect is acceptable.But your scene is too large so I think the high quality water will always have some performance problem. More over you need transparent effect, which has a really large calculation too.

    So here are my suggestions:

    1.Scale the ocean object to bigger unitl shore line effect begin to pixelate. Maybe in this scale you can reduce many water objects.

    2.I think the low quality is more suitable for your situation, you can scale it at will and not be limited by the shore line effect.
     
  7. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Ok, I'll see what is possible. It's very hard to test different sizes of the objects because you have to manually duplicate them and align them so many times, so if you do think of a script that automatically fills a set area with the water objects (of a specified size) that would be very helpful.

    What about the other problem with the flickering water objects when the camera is moved?

    For more modern mobile devices or even low end computers the number of tris and objects is not a problem so I might still use the plugin if we can fix the flickering effect from my screenshots.
     
  8. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    OK,I'll try to write a auto generate water thing this weekend, maybe need some time.

    How did you duplicate them? Only duplicate the "Water" object,DO NOT duplicate "Ocean_HighQuality" object.And make sure the edge of them is meeting.
    I duplicated it several times and it didn't has the flickering effect.

    I don't know how your terrain looks like under the water so I'm not sure if scaling the "Ocean_HighQuality" works.

    How about telling me your email and the width you want so I can create one on my computer then send you a package?
     
  9. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    I tested it on a S2 and a S4 , and I find that if the wave scale is too large, it will show pixelate on S2. I have no friend using S3,so all I can get are S2 and S4. I think the S4's gpu does some optimize with it, actually the wave scale is too big(bigger then normal map texture) so it shows pixelate.
    You said the high quality ocean looks good,I guess it's because the high quality ocean has a brighter color,so it seems not so obvious.

    Can you reduce the wave scale of low quality ocean and make it brighter(by setting the Top Color of material) then show a screenshot on S3 for me? So I can see if it's the problem.
     
  10. Deleted User

    Deleted User

    Guest

    Samsung Galaxy S 2/ S 3 has Mali-400MP GPU
    Samsung Galaxy S 4 has IT PowerVR SGX 544MP3 GPU or Qualcomm Adreno 320 GPU
    Thats why we decided that your water has artifacts only on Mali-400MP.



    After we deleted these codes in low quality shader, the artifacts disappeared on Samsung Galaxy S2 and S3.
    $Screenshot_2014-04-25-10-49-10.png
     
  11. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    That's good. Your game looks great. ;)
     
  12. Deleted User

    Deleted User

    Guest

    Thanks for your opinion)
     
  13. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Yes, I only duplicated the Water objects, not the Ocean_HighQuality parent object and the edges are meeting. I think it only happens if you duplicate many many times, about 32 objects on the x axis and 25 on the z axis.

    This problem happens with no scaling changes on the water objects or the Ocean_HighQuality parent object. I'll PM you my email.
     
  14. SamTheBay

    SamTheBay

    Joined:
    Jan 11, 2014
    Posts:
    14
    I am trying to use this in a 2d game so I need to change the water to be on a different plane. However, when I rotate the water, it seems to mess up the effect. Is there any way that I can change the code so that it will work? Or, is it possible that you could add an option to specify the plane that the user wants the water to be on at creation time?

    Thanks!
     
  15. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    Hi,

    This ocean can't rotate by x or z axis now. All the calculation is based on horizontal plane. Maybe you can try to add a camera that only see ocean from a tilt direction, and combine this camera to your other camera.
     
  16. MySchoolLife

    MySchoolLife

    Joined:
    Dec 21, 2013
    Posts:
    4
    Hello
    When I move to camera position (1500,15,500), mosaic occurs in water.
    In this case, what should I do?

    Model : SHW-M250L
    Phone Name : Samsung Galaxy S2
    CPU : Samsung S5PC210 Exynos 4 Dual 4210


     
  17. KuangZheng

    KuangZheng

    Joined:
    Feb 25, 2013
    Posts:
    75
    Hi,

    This water' shader have some precision problem in GPU mail400,which is the GPU of Galaxy S2. Some people meet this problem too, they resolved it by reduce the scale of scene. If it not work, you can contact Unity Asset Store Administrator to refund. I' really sorry about it.
     
  18. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    ...And that is due to rounding errors in the UV coords apparently. the best way would be to try and make a water mesh that already tiles the UVs (UV grid mesh) and of course, removing the tiling parts will fix the problem too. (I had to do this with one of my own shaders for my game, due to horrible pixelation! :D)

    OVER A YEAR OLD ADDITION: Having the UV offsets going much higher than about 3 (or lower than -3) can introduce the same artifacts. That's something I found out a while ago...
     
    Last edited: May 21, 2016
  19. anshul-bhardwaj

    anshul-bhardwaj

    Joined:
    Feb 28, 2012
    Posts:
    34
    Hi,

    The water effect is only visible for a small distance. Can we control that?
     
  20. LeaveOneBlood

    LeaveOneBlood

    Joined:
    Jun 25, 2016
    Posts:
    14
    @MySchoolLife upload_2017-2-28_20-41-36.png
    how to resole this problem at last,please help to give me your solution,Now I meet this problem too
     
  21. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    First, check the texture map itself isn't point filtered.
    Second, I think this shader doesn't properly wrap UV offsets, so it means on some devices, rounding errors cause the bilinear filtering to break, (Mali GPU's are renound for this) the best way to reduce/fix the problem is making sure your water plane's UVs are in the 0..1 range.
     
  22. softaVille

    softaVille

    Joined:
    Jan 15, 2020
    Posts:
    3
    Hey, does anyone know if this works on Oculus Quest? Or any other water shader...