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
0
Question by Khelz · Jul 11, 2018 at 01:41 AM · rendertexturemaskstencil

Are sprite masks incompatible with Render Textures?

Hello everyone,

I've just noticed on a new project that Sprite Masks don't seem to work when the camera renders to a texture via a Render Texture target. Everything works just fine on the Camera and in-editor views, but the RenderTarget texture appears as though neither the masks nor one of my custom shaders are active.

The custom shader that isn't working correctly makes use of the stencil buffer. Thus, I'm assuming the stencil buffer is the culprit and that the built-in Sprite Masks are implemented with the stencil buffer.

Is this a bug? Intended behavior that I'm misunderstanding?

I haven't tried writing the pixels from the Camera over to the texture myself yet as I'm about to head to bed, but that's what I'll try next. Figured asking here might save me some time and effort tomorrow with any luck :)

Any insight is appreciated. Thank you all!

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

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by AdayMelian · Nov 13, 2020 at 02:06 PM

I know this is old but I stepped into this problem now with Unity 2020 and I could solve it by changing "Depth Buffer" into RenderTexture object on Project Tab to "At least 24 bits depth (with stencil)"

I hope this helps!

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 DanTaylor · Nov 13, 2020 at 02:46 PM 0
Share

Thanks - I will give that a try! (I still haven't found a fix, so thanks for sharing!) :D

avatar image DanTaylor · Nov 13, 2020 at 02:54 PM 0
Share

Hmmm. Where is this setting? I can't seem to find it in Unity 2019. :/

avatar image
0

Answer by Brachiosaurus · Jun 22, 2021 at 06:57 PM

Hey, I know this whole discussion is pretty old, but I was having the same issue and I fixed it just by enabling Post Processing on the camera in the inspector.

If anybody out there is struggling with this, give that a try.

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 Khelz · Jul 11, 2018 at 02:45 AM

I'm happy to post screenshots or provide any additional information that might help us get to the bottom of this!

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 DanTaylor · Mar 16, 2020 at 06:06 AM

I am having the same problem. Sprite Masks work fine in a normal camera... but don't work when shown in a render texture. Any solutions? Cheers, Dan

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 Khelz · Mar 16, 2020 at 02:14 PM 0
Share

Hi Dan,

This was a long time ago but I don't think I ever got this fixed.

Sorry, that isn't much help but I didn't want to leave you hanging on any false hope.

avatar image DanTaylor Khelz · Mar 16, 2020 at 04:45 PM 0
Share

Thanks for the info - that's much appreciated. Looks like I'll just have to write a specific shader to handle masking then. Yay. :/

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

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

Related Questions

Record WebCamTexture 0 Answers

Shader problem with 2D fake lighting 1 Answer

Using depth textures 0 Answers

Rendering screen on texture and grabbing part of it 0 Answers

In Unity 2D how can I make a shader aware of the Z coordinate (depth) of the object it is about to draw over? 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