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
1
Question by bfowle · Jan 25, 2014 at 05:58 PM · 2dmasking

Inverse Depth Masking 2D Sprites

I am prototyping a 2D game out with 4.3's new SpriteRenderer and pipeline.

I am trying to achieve the following effect:

  1. I have a hidden "ground" layer that only appears once the character comes within a certain vicinity to it

  2. The character has attached to it, a circular sprite that will act as this "cutout" effect

  3. I ran across this post, that had a sort of "similar" look - http://forum.unity3d.com/threads/139858-Depth-Mask-with-Blending-Edge - but instead of having the world outside of the circle desaturated, it would be hidden; and the sprites within the circle would be shown.

Here is what I hope to accomplish (first: "ground" elements, second: red box = the clipping mesh, third: inverse mask result)

Inverse Mask

I have searched and read many forums/answers posts and unfortunately couldn't find anything that helped me. I know I will need to use a shader or possibly multiple cameras with depth masking set. I tinkered with this a bit in multiple cameras and had no luck. All of the shaders I have seen for cutout are for 3D, and using them on a 2D sprite complains in Unity.

Any help would be very welcome. Thanks!

inversemask.jpg (119.8 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 bfowle · Jan 26, 2014 at 04:31 PM 0
Share

Some more insights to this:

  • I was able to mask in/out at a certain alpha in a shader, however this gives the "opposite" effect of what I want.

  • I have a plane masking the part of the level which should be 'hidden' at the start

  • A mesh that overlays this plane should then un-mask and therefore 'show' the part of the level behind it

Is this at all possible with shaders, or does a 2-camera setup have to be done in tandem with shaders?

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

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

Rect Mask 2D won't update if I move 0 Answers

unity2d camera switch color palette with radical transition effect 0 Answers

How to implement a movable (!) 2D mask? 2 Answers

How to make a dynamic fog of war for a 2d maze? 1 Answer

2d lighting effect 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