Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 xortrox · Jul 03, 2014 at 12:40 AM · shaderterrainshaders

A problem with cutting holes in objects (terrains) using depth mask

So I've been at this for a couple of days now and I've been through several solutions, first thing I tried was using a depth mask shader to cut a hole in an object, it works but the problem is that the player is supposed to walk through the hole and upon doing so the player can sometimes see the wall behind the depth masked object or parts of it.

(this happens when the mask object is a tiny bit "off" the wall, I tried multiple near/far settings for the camera as well, all that does is move the problem back/forward) alt text

Now the problem with that approach is also that I can't put the depth masked object exactly where the wall is because then I get the z-fighting effect (I'm also surprised that this is usually an accepted method for cutting holes in terrains, even saw a tutorial on it using this technique)

So after this attempt also failed I went for a direct approach of making my terrain support transparency, this works but only for very special scenarios and it takes a lot of extra work getting it just right depending on what angle the "entrance" hole needs to be due to the fact terrains work with height maps making the texture get stretched.

So I was wondering if anyone knew if I am doing something wrong when it comes to the depth mask approach?

Is it supposed to actually be perfectly aligned with the object and I'm just messing up somewhere with my shader (is z-fighting supposed to occur when you use depth mask?)

Are there any other ways to go about this?

(this only happens when the mask object is "fitted" to the cube or perfectly aligned with the cube) z-fighting problem

line shouldnt be there.png (149.2 kB)
this happens.png (32.5 kB)
Comment
Add comment · Show 1
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 xortrox · Jul 03, 2014 at 12:58 AM 0
Share

I forgot I also did an approach using 2 cameras where 1 camera would render anything but the masked object and the other camera render just the masked object ontop of that, didn't work as well.

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

21 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

Related Questions

FX/Flare is always on top 0 Answers

How to make terrain partially transparent (lower opacity) 1 Answer

How to hide Unity terrain trees when they are blocking the camera view? 0 Answers

Adding custom materials that are made using shadergraph to terrains 1 Answer

Lightweight Render Shader not receive shadows 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