Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 impurekind · Aug 13, 2018 at 09:37 AM · optimizationbatchingstatisticssetpass

Why is my game doing 175 SetPass calls and 2319 batches?

It's literally just a few thousands textured quads and little else.

175 SetPass calls, 2319 Batches wit 0 saved by Batching, 838 Shadow Casters . . .

Are these numbers bad--it somehow seems like they are--, what would be making the count so high with a game that is literally about as complicated as the original Wolfenstein in terms of geometry and textures (and that's about all I have in there right now), and how am I supposed to go about optimizing this kind of stuff?

The Unity manual for the Statistics Window suggests this is probably something I want to manage, but then doesn't say a single word on how to actually do anything to do with this or how it works in games.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Sonky108 · Aug 13, 2018 at 09:50 AM

Hi,

The topic is really huge and you can start digging it from: https://www.reddit.com/r/Unity3D/comments/34p6ld/can_someone_explain_what_setpass_calls_are_exactly/ and

https://docs.unity3d.com/Manual/DrawCallBatching.html.

You should check also Fram Debugger https://docs.unity3d.com/Manual/FrameDebugger.html.

It allows you to check why drawing another object costed with new DrawCall.

The general path to lower DrawCalls is:

  1. Minimize amount of used materials (sharedMaterials are great!)

  2. Minimize amount of dynamic objects.

  3. Static meshes can be combined into one mesh using one material since they won't move.

  4. Realtime shadows are expensive. Maybe use lightmaps?

  5. UI elements also can have huge impact. You can use Sprite Packer.

I think that are just basics, but they will greatly improve performance of the game :)


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 impurekind · Aug 14, 2018 at 12:44 AM

Man, I'm intimidated by most of that stuff you just said.

All I did so far was put in a few cubes and meshes and stuck some textures on them that I created as .png files from Photostop (maybe 30 images output at 512x512 just so the pixel are doesn't look either all blurry or all jaggy), added a single directional light, put in a couple of character controllers and that's about it. And now I have to worry about all this stuff you just mentioned. :-o

Guess I'll add this to my link of Unity stuff I need to check out at some point. . . .

It's becoming a pretty frikin' long list.

PS. How do you do shared materials as opposed to just loading in single images into Unity and assigning them to objects as and when needed?

Comment
Add comment · Show 11 · 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 Sonky108 · Aug 14, 2018 at 06:39 AM 0
Share

Yup, the list seems to be long, but it's worth giving a try! For example, when you create 30 cubes you can put all of the textures into single texture which will return a single material (I guess some proper UV mapping has to be done - I'm not 3D modeler :P ). As a result all of the cubes will be drew with single DrawCall (at least it should). When changing any material property within script using $$anonymous$$eshRenderer.material it will create new instance of the material with applied changes -> any new material cost another DrawCall. When using $$anonymous$$eshRenderer.shared$$anonymous$$aterial Unity will change propierties without creating new material, so the cost will not be increased, but that change will be applied to all of the objects using the same material (those 30 cubes).

I think that following the list and reducing DrawCalls should be considered at design level and especially default platform. When creating an application for PC it's not so neccessary to drastically reduce DrawCalls (but it's a good practice!). On the other hand during creating a game for smartphone it's mandatory to keep that number as low as possible. $$anonymous$$ost smartphones will not even allow to use realtime shadows.

avatar image impurekind Sonky108 · Aug 14, 2018 at 11:12 AM 0
Share

So, how do I start putting all of the textures into a single image and using it in such a way that the game knows how to select out each specific area of the image for whatever object?

Just a heads up on where to start would be cool.

avatar image Sonky108 impurekind · Aug 14, 2018 at 11:25 AM 0
Share

To be honest, I have no idea. I assume it is done in some program like Blender/3ds $$anonymous$$ax. Few packages which I bought from assetStore have that kind of materials. For example, textures for all small props have been put into single image. As I said, I think it's somehow connected with UV mapping, but I have never had a lot of patience to learn 3D modelling :)

Show more comments

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

95 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

Related Questions

SetPass calls - important to keep this number low? 5 Answers

grouping graphics 0 Answers

Optimize Having Thousands of GameObjects 0 Answers

Should I build my level with few meshes or many meshes on the iPhone? 1 Answer

How to force static batching being performed at runtime? 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