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 Satansama · Mar 04, 2018 at 07:03 PM · sprite2d gamemasking

Huge performance drop after using sprite Masks

Hi, alt text I am working on a tiled based game and to achieve this visual I had to use sprite masks. 1 mask per tile. My problem is that as soon as I use the masks my fps drops from 150 (1000+ in build) to 3-4. Turning off the masks results in high fps again.

I have around 600 drawcalls.

Any one met with anything similar? What could be the problem?

tilevisuals.png (495.3 kB)
Comment
Add comment · Show 3
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 hexagonius · Mar 04, 2018 at 07:19 PM 1
Share

as far as I know, Sprite $$anonymous$$asks break batching, so ins$$anonymous$$d of all the (I guess atlased) sprites being drawn with one drawcall, each one is drawn separately in conjunction with it's corresponding mask. that's probably quite a lot.
you be sure you can view the frame debugger found under Window menu.

avatar image Satansama hexagonius · Mar 04, 2018 at 07:41 PM 0
Share

Thank you for your answer. You are right. I get 200 draw calls for 1 layer of tiles. Without the masks I get 1. What could be the workaround here? Is it possible to combine the mask sprites and apply 1 larger mask? Would that help?

avatar image hexagonius Satansama · Mar 05, 2018 at 07:45 PM 0
Share

habe a look at tilemaps. might be a pain to set all adherent combinations up, but once done you can expect the same visual result with one drawcall.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Alliballibaba · Mar 30, 2019 at 10:05 AM

Don't know if this is still relevant, but i had the same problem when using many Sprtie Masks. Objects behind Sprite masks are rendered multiple times, which can result in a lot of draw calls. I recommend not using them at all, if you have many individual ones.

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 oroora6_unity · Mar 30, 2019 at 08:53 AM

The problem is that every mask creates at least 2 draw calls, this means that each sprite mask will slow down your rendering by a lot. The solution for this is to not use sprite masks. Instead write your own cutout shader and use a single object.

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

111 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 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

How Get this glow weapon effect 2D 3 Answers

How to choose a size/resolution for the sprites used as game assets in Unity2D ? 2 Answers

Not Able to Change sprite when animation running 0 Answers

2D Sprite image not showing up in scene or game view 1 Answer

2D Animated Background 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