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 Marnix · Aug 25, 2011 at 11:40 AM · cameralayerswaterdepth-bufferclear

Combining multiple layers and water

I have a major problem with my depth buffers and I hope that someone knows a good fix for this one.

I am using two layers for drawing. The first layer draws the background of my scene, which is very far away. It uses a clipping plane of 100 - 10000. When this is done, the depth buffer is cleared by the second camera and it draws the default objects into the scene (cl pl: 0.3 - 1000).

Updated
This worked just fine, until I started to use Water 4 (Pro and Simple). The water shader seems to do something with my backbuffer when the water is drawn. You can actually see the previous frame in the air, instead of my backgrounds from the first camera.

I have narrowed the problem down to the shader only by disabling all scripts that were attached to the prefab. The shader seems to be the problem. When I change it to Diffuse, everything is fine again.

I cannot place a picture of my game because of confidentiality, but I can post a diagram of what I'm doing.

clear -> camera 1 with sky -> clear depth -> camera 2 with default and water

So the first problem summarizes to: How can I remove this strange effect and let the background return to its original state? Why is the water shader blocking this?

The second problem has to do with Warwick's comment. How do I get both cameras in my reflection? Do I have to change the code of the water script?

Comment
Add comment · Show 4
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 Waz · Aug 25, 2011 at 11:54 AM 0
Share

Water doesn't clear the display color buffer, only that of the RenderTexture it is targeting. Or is your problem simply that the reflection is only reflecting the near objects in your scene?

avatar image Marnix · Aug 25, 2011 at 05:29 PM 0
Share

@Warwick Allison: I will post an example movie of my problem and will include a diagram of my scene flow tomorrow. The problem you are describing is indeed also a problem that I'm dealing with, but is not the problem described above. I think I will have to adjust the code of the water scripts, which is something I actually don't want to do.

avatar image Marnix · Aug 26, 2011 at 08:37 AM 0
Share

@Warwick Allison: You are completely right. It is not the clearing of the buffers. See my updated question. It is actually quite different now.

avatar image Robacks · Feb 10, 2014 at 03:55 PM 0
Share

Having the same Problem. Is there a solution other than not using the unity water?

It is related to GrabPass and Forward rendering vs Defered rendering. See this link.

0 Replies

· Add your reply
  • Sort: 

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

Clear depth buffer between two layers 0 Answers

Bloom to Only effect Objects on UI layer ? 0 Answers

Water effect on camera lens 2 Answers

Can I render a single render but only with the objects that are not occluded by other objects (on other layers)? 1 Answer

Render tooltip on top of everything with MRTK 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