Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Zaffer · Jul 03, 2013 at 01:52 AM · draw callsstatic batching

How to tell if static batching is working?

Hi,

I have a large, open landscape scene with lots of rocks (maybe 100 or so). The rocks all share one of six different materials. According to the doc on static batching, Unity - Draw Call Batching, if I check the Static check box these rocks should batch. However, when I run the scene, the stats always show zero draw calls saved by batching. Is static batching in fact happening? If not, how can I make it happen? Thanks.

Zaffer

Comment
Add comment · Show 10
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 SinisterRainbow · Jul 03, 2013 at 02:53 AM 0
Share

No, I don't believe it is happening. It must be something else. Are these rocks you are creating from a script or have set up the scene ahead of time? Are you changing any textures during runtime or doing anything during runtime to them?

avatar image fueldown · Jul 03, 2013 at 03:10 AM 0
Share

Also, check the scaling of the rocks. AFAI$$anonymous$$, the objects scaled on different axis do not batch. e.g. the rocks scaled like (1,1,2) and (1,2,1) won't batch, but (1,1,2) and (1,1,3) will be. If you are setting the scale factors on runtime i.e. through scripting, you should take care of this.

avatar image SinisterRainbow · Jul 03, 2013 at 03:10 AM 0
Share

also, can you post a screenshot of the scene with the hierarcy in the screenshot as well.

avatar image Zaffer · Jul 03, 2013 at 04:11 AM 0
Share

I modeled the rocks in Blender, making them in 3 different shapes. I then made prefabs for each of the shapes in 7 different sizes with 6 materials for each (see screen shot) – plus some miscellaneous larger rocks for a cave. I’m not changing the textures or doing anything to the rocks at runtime. As for scaling, all the rocks are scaled at 1,1,1 at all times (that’s why I made so many different sizes, to avoid scaling). Thanks for your help, I really appreciate it. alt text

rocks.jpg (130.6 kB)
rocks2.jpg (124.2 kB)
avatar image SinisterRainbow · Jul 03, 2013 at 04:41 AM 0
Share

It's no problem. I checked out your scene on your website and it's nice.

Did you make 6 materials for each size or each of those many rocks?

anyway, i think it's solved now. You should just make a prefab for each unique rock mesh, (not each size of each unique mesh UNLESS you want it to look really different (like really tall or something..but that will mean it can't be batched, and is often better solved by just creating a new unique mesh). You should be able to scale (in all directions equally) for each rock later when you place it in your scene. If you drag one prefab into the scene, then duplicate it (Ctrl-D) and resize it (equally), it takes no time, and you can have a wider variety of sizes, plus it will batch. Then apply one of your 6 rock materials to it..(you should only have 6 rock materials total, not 6 for each mesh (if they are seamless textures)).

if you have 6 materials for each of the 3 unique rocks, and use all 18 rocks in the scene (and they are visible), it's at least 18 draw calls and 18 objects. (assu$$anonymous$$g no bump or specular maps or anything else on your material). But even so, you can duplicate these rocks and resize as many times as you want and it should still batch.

Now on the other hand, if you have only 6 unique textures total, and 3 unique rocks, then use the 18 combinations, you shouldn't get any batching, but your drawcalls should be just 6.

IF you have a unique material for each rock AND size, batching won't help a lot :).. aka, if you find two materials with the same texture, and nothing else unique about them, delete one.

As a note: the scene will only inform you of objects and batching when it sees to of the same rock in the viewport. If you have one rock on the other side of the board that is the same as a rock you are viewing, it won't batch, because it won't even be drawing the other (far away) rock. (not drawing something in the first place is of course, better than batching) :)

Try a new scene, drag in a rock, and then duplicate it in the scene. (You may want to test scaling, but i'm almost positive equal scaling will not affect batching. )

SO basically, to batch, the object must have the same $$anonymous$$aterial, and scaled equally in all directions only (or not scaled at all)

anyway, if that doesn't work, post back as something really strange is going on. (= but i doubt it.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

17 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

Related Questions

Getting statistics info in a script? 0 Answers

Static batching doesn't reduce draw call 0 Answers

StaticBatchingUtility.Combine crash on device 1 Answer

Texture Atlasing only beneficial with Batching? 0 Answers

Static batching not working 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