• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Logopolis · Feb 16, 2016 at 07:19 AM · androidwaterwater4

Water4 clipping incorrectly on Android

Water4 is giving me a peculiar problem on Android. In the below image, all of the land you see is under the plane of the water; the water and the terrain are parallel. However, the water is being clipped by the land near the top of the screen as if the water plane were diagonally cutting into the land. Then, at the bottom of the screen, there is a small strip of water that is showing up above the land.

On Windows, the land is correctly seen through the transparent water across the whole screen.

Any idea what would produce t$$anonymous$$s strange effect on Android? Thank you.

alt text

img-2999-small.jpg (127.9 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Logopolis · Feb 19, 2016 at 12:29 AM

After a lot of research and experimentation, I now understand what's going on much better, but haven't yet found a complete solution.

The problem is with the depth buffer (z buffer). My Android device seems to be using a 16-bit depth buffer, w$$anonymous$$ch is resulting in there being too few different depth levels available to allow the terrain and water to clip well against each other. A common term for the resulting effect is "z fighting".

A 16-bit depth buffer allows 2^16, or 65536, different depth values. These depth values are spread between the camera's near clipping plane and its far clipping plane. They are concentrated closer together near the near clipping plane, so that objects rendered closer to the camera will have greater accuracy in their depth calculations. Because of t$$anonymous$$s, an effective approach to solving t$$anonymous$$s kind of "z fighting" problem is to move the camera's near clipping plane as far away from the camera as possible (and so as close as possible to the objects being rendered) -- without moving it so far that objects close to the camera are noticeably being clipped. I moved my near clipping plane from the default of 0.3 up to 50.0, and t$$anonymous$$s improved my results tremendously (see the image below).

The problem isn't as bad now, but it's still very clearly there. Where the beach touches the water, we still see "bands", as if the beach had regularly spaced horizontal ridges.

The ultimate solution would be to use a 24-bit depth buffer rather than 16-bits. That would give us 2^24 or 16777216 different depth values, 256 times the resolution of depth values that a 16-bit depth buffer affords. Most platforms use a 24-bit depth buffer by default, and apparently most Android devices do as well, but some Android devices (such as my Samsung Galaxy Note 8) apparently still use a 16-bit depth buffer.

Unity used to have a setting in the Android Player Settings, called "Use 24-bit Depth Buffer". T$$anonymous$$s option was removed in Unity 5. The notes on "What's new in Unity 5" (https://unity3d.com/unity/whats-new/unity-5.0) state "Replaced 16bit depth buffer support with the ability to completely disable depth and stencil buffers." T$$anonymous$$s seems to imply that 16-bit depth buffers are out, and all depth buffers will be 24-bit from now on, but nonetheless the poor depth resolution I'm seeing on Android (whereas the same game looks great on PC) indicates that in Unity 5 it's still using a 16-bit depth buffer on t$$anonymous$$s Android device.

Here are some further references I found useful in researc$$anonymous$$ng t$$anonymous$$s problem: http://forum.unity3d.com/threads/crazy-z-fighting-in-editor.104133/ http://answers.unity3d.com/questions/341726/texturemeshshader-problem-on-android.html https://www.reddit.com/r/Unity3D/comments/38om9j/has_anyone_noticed_worse_zfighting_in_unity_5/

alt text


img-3003.jpg (96.3 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

45 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem with water4 in Android! 0 Answers

Creating a Water Surface with a Texture-shaped Hole For Android 0 Answers

Open-world and mobile 0 Answers

How to see water from a long distance 0 Answers

Water 4. Wave height in point. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges