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 hulahoolgames · Jan 27, 2016 at 08:27 PM · optimizationdrawcallssetpass

Why so many SetPass Calls?

I have 40 car objects in the scene all using the same material and texture. Each car model has 4 child wheel mesh models that use the same material and texture. When I have 1 car in the scene it says SetPass calls : 2. When I have 40, draw calls increase to 18. If I deactivate 30 cars then it drops to 8 draw calls for 10 cars. And sometimes it says 10 draw calls for 10 cars. What is going on here? Shouldn't the 40 cars take the same draw call as 1 car? And why do draw calls differ for same amount of cars?! I am missing any basic knowledge here? Any help is appreciated. alt text

screen-shot-2016-01-27-at-31206-pm.png (76.4 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Eno-Khaon · Jan 27, 2016 at 11:03 PM

The SetPass Calls (or draw calls) are performed per object in your scene. It doesn't really matter whether the objects share the same shader or not. Each separate object in your scene requests its own draw call.

But why do you have such a strange count on draw calls?

Dynamic Batching does what it can to be consistent and not batch unnecessary objects together. This isn't always consistent, however. In some cases, objects may be batched in obvious ways and in other cases, they aren't. It's simply Unity doing what it can to decrease the number of draw calls when it seems to be the best opportunity to do so.

One way of seeing exactly when objects are batched together is to make a shader which modifies color (or vertex position) based on the local position of the vertex. Because the object center for batched objects is always the world's zero vector, your color or motion will become very different than expected/intended when the objects are batched together.

That said, this variety in how objects do wind up batching together is why you see variable results. If everything batches together, you'll have two draw calls. Otherwise, 40 of the cars will use up to 80 draw calls.

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

36 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

Related Questions

One mesh , one material , no textures ,but multiple draw calls 2 Answers

What's a good draw call count? 2 Answers

Level creation, draw calls, and texturing 3 Answers

Load External Images into Atlas to reduce drawcalls 0 Answers

Is Draw Call the main factor to consider for mobile optimizations? 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