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
2
Question by capnbishop · Feb 16, 2010 at 04:59 AM · depth-bufferrenderorder

How do I specify the render order of GameObjects?

I want to create a series of layers from my 3D objects. They all exist on a 2D plane, and can pass through one another. Rather than having them blend together when they collide, I want to render them in a controllable order, clearing the depth buffer each time, so that they are drawn directly on top of on another.

One way of doing this is to have multiple cameras that clear their depth buffers, and have specific culling masks. This works, but I find that as I add more cameras, frame rate takes a hit. Not only that, but it's a bit prohibiting, since I expect to have a large number of objects to draw in this ordered fashion. Further, the order in which they are rendered changes, which would make things challenging to juggle the culling masks and cameras as objects come in and out of play.

Any ideas of implementing this in Unity? Oh, and I don't have Unity Pro, so I need something that will work in the free version.

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

Answer by Eric5h5 · Feb 16, 2010 at 05:57 AM

You can use different shaders that specify a different render order but are otherwise the same. For example, one could have

Tags {"Queue"="Transparent"}

and another could have

Tags {"Queue"="Transparent+1"}

which would render on top of the first one.

Or you can use objects at different depths, and position the colliders so they all still collide with each other. There's no rule saying the collider has to be in the same position as the mesh.

Comment
Add comment · Show 4 · 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 capnbishop · Feb 17, 2010 at 02:05 AM 0
Share

Excellent, that works. I was looking at the shader queue tag, but didn't know that I could do something like +1.

avatar image yoyo · Apr 21, 2010 at 04:55 AM 1
Share

Queue tag method works great, thanks all! Note that the Tags specification goes inside the SubShader (not Shader or Pass), as described here: http://unity3d.com/support/documentation/Components/SL-SubshaderTags.html

avatar image yoyo · Jan 06, 2011 at 07:41 PM 0
Share

Note that you can also set material.renderQueue if you prefer not to modify the shaders, or you want to use the same shader in multiple queues.

avatar image Calvin2274 · May 16, 2012 at 05:03 AM 0
Share

Hi,

yes, it is work when the planes are the same scale and size however, I am going to put different size of plane just like wall and paper but it still keep twinkle... how can I fix it ?

Calvin

avatar image
1

Answer by Jaap Kreijkamp · Feb 16, 2010 at 05:39 AM

Use an orthographic camera (checkbox in camera properties) and place objects at different depths.

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 capnbishop · Feb 16, 2010 at 05:41 AM 0
Share

$$anonymous$$y scenario already involves an orthogonal view. However, I want to use colliders/triggers, which will require keeping everything on the same plane.

avatar image Jaap Kreijkamp · Feb 16, 2010 at 06:14 AM 1
Share

your collider could extend into the z-plane as well! Your alternative is having every object a separate shader, then you can set the queue depth, or draw object yourself with Graphics.Draw$$anonymous$$eshNow.

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

Rendering Order Revisited 1 Answer

Custom Transparency shader occasionally losing transparency? 1 Answer

How to get the depth values of the camera view? 1 Answer

CommandBuffer.SetRenderTarget becomes strange with BuiltinRenderTextureType.Depth 0 Answers

How to Render an Background on Top 2 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