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
1
Question by Xroft666 · Jul 26, 2011 at 02:17 PM · dynamic batchingalphablend

Alpha blending, depth sorting and batching

Hello! Making 2D game, where I have very many transparent objects, I noticed a strange thing with dynamic batching. If I have alpha blended objects (in my example, there are about 500 grass planes), which I z-sort when starting a game, everysthing is OK. Grass is batched perfectly. But the thing is going wrong when I'm trying to group different objects with different materials. For instance I'm making a tree, so there is a parent empty object, and 4-5 objects for leaves, crone and so on. Every different part has its own material. So, I put the tree in my scene and duplicate it few times, with X offset. Batching is all right. Because they have the same Z-depth. But if I change Y coordinate (depending on Y coordinate, script makes calculations for Z coord), batching is broken. I know that depth buffer has problems with alpha blending. But with the single objects everything is ok. Even if I have a group of objects with one shared material, z-sorting wotks. The bad thing happens only when I have a group of objects with different materials.

Thanks in advance :)

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

Answer by Jessy · Jul 26, 2011 at 03:38 PM

Use a different queue on every material. http://answers.unity3d.com/questions/9942/force-elements-in-same-batch.html

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 Xroft666 · Jul 26, 2011 at 04:18 PM

Thank you, it helped ) But damn.. if I have 10+ types of trees and other different vegetations, for each subobject I have to create its own shader with different queue value?

Comment
Add comment · Show 12 · 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 Jessy · Jul 26, 2011 at 05:28 PM 0
Share

This should be a comment, not a question. But yes, you either need to do that, or put them in an earlier queue than 2500, and not have them sorted automatically by depth. You can also script renderQueue, but it isn't serialized. http://forum.unity3d.com/threads/58794-renderqueue-sorting?p=376039&viewfull=1#post376039

avatar image Xroft666 · Jul 27, 2011 at 12:27 PM 0
Share

Thanks a lot :) The second choise sounds good

avatar image Xroft666 · Jul 28, 2011 at 09:42 AM 0
Share

One last question... i hope :) If alpha blending has problems with depth sorting, why it is put in 3000+ query by default, so it has to be sorted by depth?

avatar image Jessy · Jul 28, 2011 at 10:19 AM 0
Share

I'm not sure what you mean. Those queues are helpful, so farther-away objects are rendered first, providing a better chance that blending will look right. With flat objects far enough apart, it's a perfect solution.

avatar image Xroft666 · Aug 03, 2011 at 10:27 AM 0
Share

I have only now implemented my objects into whole project, and have only now understood that they are not sorting. What I wanted is: use blended objects with sorting and batching. But, if I use static render queue, there is no chance to sort objects in the scene? Or as you said I can script render queue, but I think it is very not optimized? Thank you

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Easy way to remove hidden surfaces in a span of alpha-faded wall segments? 1 Answer

Mark object do not batch it dynamic 3 Answers

Dynamic batching is not done. 1 Answer

Sprite Manager2 : manually changing depth sorting without a manager 2 Answers

Alpha blending issue in unity 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