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 lakehaze · Jun 30, 2011 at 11:09 AM · meshlayerdrawcombinez-depth

Combining Mesh changes Draw Order?

We mesh.combine() our 2-D 6 quad character meshes into a single mesh. Finally, we are getting predictable results animation wise, but the combine operation seems to screw with the draw order of the quads.

The order goes correctly on FBX import: 0-armB 1-legB 2-legA 3-torso 4-armA 5-Head

The character is stacked along z in that order, with 0.1 units separating each layer. After combining the mesh, the z order is retained (as can be seen from a perspective camera), but the quads don't draw in their z-order. Even though the torso is 0.2 units behind the head, the torso is drawn on top.

What is causing this?

Comment
Add comment · Show 3
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 Waz · Jun 30, 2011 at 12:04 PM 0
Share

Wouldn't armA normally come after head? (no answer to you question, of course, but it'll bump it ☺)

avatar image Waz · Jun 30, 2011 at 12:08 PM 0
Share

Have you disabled the Z buffer in some way? mesh.combine will not preserve the order of triangles.

avatar image lakehaze · Jul 01, 2011 at 04:17 AM 0
Share

Arm vs head priority, I suppose, would depend on character design. Our characters are giant headed, with arms that cant reach over their heads, so it seems better to have beards and stuff draw over the shoulders... But I may reconsider down the road.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by lakehaze · Jul 01, 2011 at 04:12 AM

Okay, the mesh combiner uses mesh names to sort order. I renamed my meshes in Maya with a prefix that denoted their z-order ("head" -> "z6_head") and the resulting combined mesh displays correctly.

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 Dreamora · Jul 01, 2011 at 12:49 AM

If you combine meshes they will no longer ahve distinct depths, the sorting happens on mesh level not triangle level. As such you better don't do combine mesh with anything that has a transparent / transparent cutout shader otherwise you have to go into the resulting mesh and sort it manually on the vertex-triangle level

Comment
Add comment · Show 1 · 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 lakehaze · Jul 01, 2011 at 02:51 AM 0
Share

That's unfortunate. Thanks for the reply.

avatar image
0

Answer by am_ · Sep 07, 2015 at 09:24 AM

Actually you can merge meshes in the order you want in Maya. Turn on Shading->Object transperacy sorting to see how it would display in Unity.

For example if you have the following meshes: - characterHead - characterBody

You just select it in the reverse order you want for Z-ordering after combining the meshes. So in this case you would select the characterBody first, then shift select the characterHead and then merge.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Combine Objects/Meshes to reduce drawCalls 2 Answers

is there a more optimal way of drawing multiple meshes? 1 Answer

Combine meshes, Weld planes together 0 Answers

CombineMeshes unexplainable draw calls 0 Answers

Decombine script or recalculate part of mesh? 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