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 xanthoran · Nov 30, 2011 at 06:50 AM · render ordersm2

Sprite Manager2 : manually changing depth sorting without a manager

Hello! I asked this on the SM2 forums, but I thought I would try here too.

I'm trying to make an isometric game with lots of sprites (some animated, some not). Because of the iOS texture size limit, many of my animated characters must be super sprites to fit them all.

My main issue is the age-old z-sorting problem that isometric games have, where some sprites should be 'behind' others based on the location of the footprint (not the sprite itself). I've successfully calculated the z-order index, and I can even implement exactly what I want if I use simple packed sprites and a single sprite manager, using 'setDrawLayer()'. However, all of my characters and buildings and whatnot will never fit on a single texture for a single sprite manager.

My question is how to manually force depth sorting for multiple super sprites that are not associated with a sprite manager. I understand that currently, SM2 will automatically do this based on the distance from the sprite to the camera (which is almost what I need), but I need it to base this on the distance from the footprint to the camera (which i have already computed).

Does anyone know where I might be able to modify SM2 to do this?

Thanks, Peter

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
0

Answer by Jeston · Nov 30, 2011 at 08:59 AM

In short, you can't because sprite manager creates a composite mesh from all its managed sprites and uses the bounding boundary's center as its position. You will see a yellow box with a + symbol, the + is where at in the scene unity considers the composite mesh at. So you can't move non manage sprites to interpenetrate within the boundary itself. Think of sprite manager as creating a single mesh as opposed to rendering out x sprites.

I also do not think I would use a sprite manager for this, Unity is pretty good at determining the batch draws dynamically provided that in a given boundary all sprites belong to the same material. I would probably make your zsort slightly smarter.

Sprite Manager does have a layer property which determines the sorting order of sprites within the same sprite manager.

If you don't bother with sprite manager though, make the z coordinate as a function of height from base floor line. z(y) = (depth spacing) * y; and move all your pivots to bottom center and the number of draw calls will be based on how many bounding zones are made up of sprites from 1 material.

Hope that helps

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 xanthoran · Dec 01, 2011 at 01:38 AM

Thanks, but actually, I tried all of those things to no avail. What finally ended up working for me was just modifying the renderQueue number on the materials associated with each sprite at runtime. It was way simpler than I thought it had to be.

-Peter

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

PackedSprite object returning null 0 Answers

Orthographic camera rendering order not always working 2 Answers

Alpha blending, depth sorting and batching 2 Answers

Generated mesh render order 0 Answers

Unity 5 - Build Shader Error 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