Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 FramnkRulez · Jul 16, 2013 at 04:06 AM · terrainwater

Problem with simple water over terrain

Starting with a terrain I've created via an imported heightmap, I'm trying to fill in the ocean areas using simple water (as per Unity documentation). However when I add simple water to the scene, I can see the underlying terrain flash through the simple water as I move the camera around. It's worse when I move the camera at some angles, and better with other angles.

Comment
Add comment · Show 9
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
avatar image Benproductions1 · Jul 16, 2013 at 11:22 AM 1
Share

How far is the "underlying terring" from the water surface. You might be experiencing Z-fighting

avatar image amphoterik · Jul 16, 2013 at 11:24 AM 0
Share

What Ben said. Either raise the water or lower the ground and see if that helps. Also, a screenshot could help.

avatar image FramnkRulez · Jul 17, 2013 at 12:05 AM 0
Share

I understand what you all are saying about z-fighting and I think you're probably right. I'm starting with real geo data for my heightmap, and although I see a defined 'ridge' on the coastlines of my heightmap, it doesn't look very high. How much of a height difference between flat and where my terrain starts should I see after importing it to avoid z-fighting with water? Would a screenshot of my heightmap or the terrain in unity be more useful in diagnosing the issue?

avatar image amphoterik · Jul 17, 2013 at 12:55 AM 0
Share

@FramnkRulez any distance between water and ground of about .1 or more will prevent z-fighting. Gives us a pic of the problem please.

avatar image Benproductions1 · Jul 17, 2013 at 10:37 AM 0
Share

@ampoterik That's not entirely correct. The depth buffer is exponential, meaning that inaccuracy increases at range. If you want to go all out for the $$anonymous$$imum value to prevent z-fighting, you will need to calculate the accuracy of the z buffer at the maximum distance of objects.

For instance, a offset of 0.1 will not suffice at preventing z-fighting at a distance of 90000 units and a maximum view distance of 100000 units (over-estimated guess) ;)

Show more comments

1 Reply

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

Answer by Benproductions1 · Jul 18, 2013 at 04:21 AM

Hello,

I will try to explain why your problem happens before I give solutions.
(basically) Every rendering engine, determines which points on an object are closer to the camera by using the depth-buffer (or Z-buffer). This Z-buffer is per-pixel and a value between 0 and 1. 0 is for a point that lies on the near-clip plane of the camera, while 1 is on the far plane camera.
The Z-buffer does not scale linearly between the near and far clip planes.
It scales exponentially, meaning that the further away a rendered point is, the more inaccurate the Z-buffer becomes.

This means that at close distances, a point on your water may have a smaller Z-buffer value than the same point on your terrain, however as you move the camera away, these values become the same, because of the previously mentioned inaccuracy. In cases where two objects, at points have the same depth-buffer value you get the Z-fighting (depth-fighting) effect.

The only way to fix this, is to either increase the distance between the two objects, or change the accuracy of the depth-buffer (by changing the near/far-clip planes).

Hope this helps,
Benproductiosn1

Comment
Add comment · Show 1 · 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
avatar image Benproductions1 · Jul 18, 2013 at 10:26 AM 0
Share

WTF is with the unexplained downvote??

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.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

Water4Simple & Water4Advanced internal LOD issue 1 Answer

How to make rain pools 3 Answers

Collision is glitchy 1 Answer

Cloth, Mesh or Terrain for wavy sea water? 2 Answers

Why is this water/terrain clipping occurring? 1 Answer


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