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
2
Question by Jaap Kreijkamp · Jan 10, 2010 at 06:15 AM · renderingiphoneperformancebatching

Force elements in same batch

In our game iphone game we're drawing fake shadows under about every object. Although most are defined static (can't move only destroyed) they aren't batched all together. This is probably done to prevent drawing order issues. But as with many shadows this results in easily 10 draw calls for the shadows alone it would be useful to be able to force them in one batch (and live with possible ordering issues). Is there a way to do this?

alt text

Comment
Add comment · Show 2
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 Jessy · Jan 10, 2010 at 06:58 AM 0
Share

An answer to this probably will also answer my question: http://answers.unity3d.com/questions/2372/what-exactly-in-a-shader-stops-batching-from-happening

avatar image Jaap Kreijkamp · Jan 10, 2010 at 12:55 PM 0
Share

Possibly it's more about which lights affect the objects then distance from camera, but it's black magic. Added an answer to your q with my findings.

1 Reply

· Add your reply
  • Sort: 
avatar image
5

Answer by ReJ · May 24, 2010 at 01:11 PM

First, make sure all your fake shadows use the same material. Next, 'move' all your fake shadows into the separate rendering layer (Render Queue) by specifying:

Tags {"Queue" = "Transparent-1" } in the shader


Explanation: Unity have to sort all transparent objects by distance instead of sorting them by material. If you have different materials on transparent objects in your frame, then chance of them being batched decreases. By putting them into the separate rendering layer you tell Unity to sort them independently of other transparent objects - maximizing batching.

Comment
Add comment · Show 2 · 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 Jaap Kreijkamp · Jun 11, 2010 at 12:31 AM 0
Share

I already did that (sorry, haven't been in Answers for quite a while) but still get more batches than I would expect when using lighting, even though the shader doesn't use lighting. We fixed it with making shadow part of of the objects using vertex colors to make them transparant.

avatar image The-Scripter · Aug 21, 2012 at 10:53 AM 0
Share

You can avoid editing the shader by using a script to change the queue. This script will do it if it is attached to 1 of the objects using the material. http://wiki.unity3d.com/index.php/SetRenderQueue

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

1 Person is following this question.

avatar image

Related Questions

Render process on Unity iPhone? 2 Answers

Drawcalls or Batched, which is more important to performace? 1 Answer

Is there any way I can statically batch procedurally generated objects? 0 Answers

Dynamic Batching and Instantiating 2 Answers

,Drawing 100 000+ cubes 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