Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Aurelien · Jul 03, 2011 at 11:41 AM · scenelargez-fighting

Large scene and Z fighting

Hi,

I have a Z fighting problem with a large scene in unity :

I create a scene dynamically with geographic informations (heightmap and textures) from a server (like a Google Earth application).

I use kilometers as unit in Unity.

My scene is about 30km x 30km, so it's about 30 x 30 units in Unity.

Because of data georeferencing, it is centered on (300, 6000) point in Unity.

My camera is configured with near plane 0.01 (10 meters) and far plane 50 (50 km).

Everything is ok, but when I display the sea on top of the ground, I have a lot of Z fighting between sea and ground, specialy :

  • near the coast, where there is about 50 cm or less between sea height and ground height (it's about 0.0005 units delta between sea and ground)

  • when the camera is near to the ground

How can I avoid this ?

  • should I change the units (switch to meters or Mega-meters) ?

  • move the center of the scene to (0, 0) point ?

  • dynamically adapt near and far planes of the camera ?

  • use a shader with offset -1, -1 to render the sea over the ground ?

Regards, Aurélien

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

3 Replies

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

Answer by Marnix · Jul 03, 2011 at 12:40 PM

  • Option 1 will not change a thing, because it is about the difference between min and max.

  • Option 2 doesn't change a thing, because it is just a position. Has nothing to do with your viewport.

  • Option 3 is the best! Make sure that your z-buffer doesn't contain very large AND very small numbers. The smaller your interval, the better. Changing the near plane will make the most difference, because it numbers out very small values.

  • Option 4 will create an artifact probably

  • Option 5 (alternative): Don't use z-writing and z-reading on the sea. Make sure that it is drawn later in the RenderQueue. You can change this in your shader.

Comment
Add comment · Show 2 · 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 flaviusxvii · Jul 03, 2011 at 02:37 PM 1
Share

"You can change this in your shader."

OR.. just change material.renderQueue directly, if that's the only difference.

http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$aterial-renderQueue.html

avatar image Marnix · Jul 03, 2011 at 02:38 PM 0
Share

Ah yes, probably a good one. But not so easy with z-reading and z-writing right?

avatar image
0

Answer by Aurelien · Jul 05, 2011 at 08:55 AM

Thanks for your help !

I tried 3 & 4 and option 3 is the best !

I can't use option 5 because there is "Islands" and the sea the semi-transparent, so I don't use z-writing, but I need to use z-reading

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
avatar image
0

Answer by vestax_ion · Jul 22, 2011 at 04:16 PM

I have to say that unity is conceived to easily have character type objects on the 1-2 unit scale, in other words, 1 unit is a meter, and while it may not make any difference in the rendering, all the settings, such as tree placement are foreseen like this so it could be that some of the coding inside the engine has detailed viewing more tuned to that end.

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Number of materials on a model 2 Answers

Zoom into a very large image(z-fighting problem) 0 Answers

What is the best way to make a large game 2 Answers

Reducing the size of the scene (Textrues and media are minimal, num object is huge) 0 Answers

Scene Box/Rectangle Editor. Does one exist? 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