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 digzelot · May 30, 2017 at 05:16 PM · renderingperformancemodelingstatic batchingoptimazation

Question about Static Batching

I'm considering/thinking about the set-up work that needs to be done in max/maya in order to utilize static batching

I have 5 cartoony-looking trees, all sharing the same 3 materials: light green, dark green, and brown.

1 tree == 1 object (within 3ds max): all trees use these same 3 materials.

If I have all 5 unique trees sitting next to each other in Unity, will Static Batching "break apart" the 5 trees based on the materials they share, and recombine them (based on their materials) to assist performance? ie, so now instead of having 5 separate trees, I have 3 new meshes after Unity has done its static batching thing

I'm wondering if this is the case, because I could then duplicate those 5 tree's any number of times (let's say i now have 500 different tree objects, but they only use the original 3 materials) - static batching would then combine them into 3 meshes instead of 500 separate trees?

Is there any special work that should be considered while modeling in order to utilize static batching?

Thank you!

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
0
Best Answer

Answer by Hanoble · May 30, 2017 at 05:32 PM

The details you are looking for can be found here. There really is not much work on the modeling side when it comes to static batching, the important thing to remember is that these objects CANNOT move. It is best for things like buildings, world pieces, etc, and it works by combining those objects behind the scenes to reduce set pass calls, but does have a slight memory overhead.

As far as your question about the trees is concerned, static batching would take all of those trees and combine there geometry internally, but this is not something you see in the editor. It would not take your meshes and change the number from hundreds to one, but you would see the set pass calls be significantly reduced via the stat window. Depending on how many trees you have, the memory overhead could actually not be worth the FPS increase from the batching, but this is something you could certainly test yourself.

Dynamic batching you did not ask about, but it has limitations and requires more knowledge on the modeling side to take full advantage of (vert limits, multipass shaders, etc). All of this information can be found in the link provided earlier and I would highly suggest you spend some time reading up.

You can use the stats window in editor to actually see the batching information and the frame debugger is also a great tool if you want to really dig into exactly what is happening with your set pass calls and batching.

Comment
Add comment · Show 3 · 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 digzelot · May 30, 2017 at 09:31 PM 0
Share

Hi Hanoble, thanks for the reply - I've read through the optimization link a few times, and I'm hoping to just get a solid understanding of some of it's aspects. For example, early in the docs it says

"Only GameObjects sharing the same $$anonymous$$aterial can be batched together. Therefore, if you want to achieve good batching, you should aim to share $$anonymous$$aterials among as many different GameObjects as possible."

I read this as "a sphere with "material A" on it and a cube with "material A" on it will be batched together"

  • what I'm wondering is:

"object A is made up of two pieces, one piece has material A and the other has material B; object B is made up of two pieces, one piece has material A and the other has material B..." will these 2 objects be batched?

as i read that question back I would guess no, the 2 objects would not be batched together, but i'm still unsure... for what it's worth (regarding memory overhead) this is a game being dev'd for mobile platforms

thanks again!

avatar image Hanoble digzelot · May 30, 2017 at 09:49 PM 0
Share

You need to think of those objects made up of other objects in terms of each one of those pieces is a single object, Object A is not a batching object, rather the two pieces with materials on them are the batching objects. In the scenario you gave, the parts of Object A with material A would batch with the parts of object B with material A, and the parts of object A with material B would batch with the parts of object B with material B. Parts of those 2 objects would batch with each other, and if you look into the frame debugger you would see what it is actually drawing on each set pass call and which parts of those objects are batched together.

Batching can be a bit confusing at first, but it is undoubtedly 100% worth it, especially when you are talking mobile. Getting familiar with those tools is the best advice I can give, along with checking the performance on your target platform. I have used batching to take games with thousands of objects and 5 fps to 60 fps with nothing more than static batching. For objects that need to move, dynamic batching has more restrictions, but is equally as important.

avatar image digzelot Hanoble · May 30, 2017 at 10:10 PM 0
Share

That clears it up and makes complete sense! I'll become familiar with the frame debugger - Thanks again, you've been very helpful!

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

84 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

Related Questions

Mobile game - should I reduce my vertex count? 1 Answer

how to i off load rendering to my gpu? 0 Answers

slow rendering and frozen frames in unity 2019.4.16f 3 Answers

What is static batching and dynamic batching? 0 Answers

Performance drop with transparent objecs overlying big meshes 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