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 ModLunar · Dec 18, 2017 at 03:28 AM · renderingshadersgraphics

What's the order of events in Unity's rendering pipeline?

So lately, I've been getting into shader writing, and have been beginning to use CommandBuffers. But I would like to know: what things happen and in exactly what order when Unity is rendering using Forward Rendering and Deferred Rendering?

For example, I can make a CommandBuffer execute right after my camera renders the skybox. But I'm not sure if the skybox is rendered before the geometry, or before/after lighting, (or like when does shadow stuff happen?) etc. It would be helpful to have a visual/diagram of the order of these things -- I looked a lot in the Unity manual but couldn't find a concrete order of it for each rendering path, or maybe I just missed it though :p.

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 Glurth · Dec 18, 2017 at 09:19 AM 1
Share

Found this page I assume? Good pic showing the pipline order of the various CameraEvents used by CommandBuffers. https://docs.unity3d.com/$$anonymous$$anual/GraphicsCommandBuffers.html

avatar image ModLunar Glurth · Dec 18, 2017 at 03:26 PM 0
Share

Ah yes! Thank you, this was actually one of the pictures I've been looking at xD but it does help.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Dec 18, 2017 at 04:41 AM

The whole rendering process is very complex and not well documented. However the usual skybox is actually rendered after the opaque geometry to avoid overdraw and to keep the fillrate low. The skybox is usually drawn where the z buffer still has it's "cleared" value. Well, at least that's what seems to be the case in almost all of my tests.


In general the materials are rendered depending on the render queue value which is a value between 0 - 5000. Some predefined values are defined in the RenderQueue enum.

 public enum RenderQueue
 {
     /// <summary>
     ///   <para>This render queue is rendered before any others.</para>
     /// </summary>
     Background = 1000,
 
     /// <summary>
     ///   <para>Opaque geometry uses this queue.</para>
     /// </summary>
     Geometry = 2000,
 
     /// <summary>
     ///   <para>Alpha tested geometry uses this queue.</para>
     /// </summary>
     AlphaTest = 2450,
 
     /// <summary>
     ///   <para>Last render queue that is considered "opaque".</para>
     /// </summary>
     GeometryLast = 2500,
 
     /// <summary>
     ///   <para>This render queue is rendered after Geometry and AlphaTest, in back-to-front order.</para>
     /// </summary>
     Transparent = 3000,
 
     /// <summary>
     ///   <para>This render queue is meant for overlay effects.</para>
     /// </summary>
     Overlay = 4000
 }

Lower values are rendered before larger values. The Skybox seems to be drawn at 2500. So if you draw something at 2500 it seems to be "behind" the skybox while 2501 is drawn "infront" of the skybox (so it's drawn after the skybox).

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 Bunny83 · Dec 18, 2017 at 04:48 AM 0
Share

Though certain named / tagged shader passes might be run explicitly by Unity

avatar image ModLunar · Dec 18, 2017 at 03:23 PM 0
Share

Ah I see, thank you! :D

By the way, do you happen to know where the shadow pass fits with all of that too? (I apologize for all the questioning, I'm trying to understand the order of events based on this page on the CameraEvent enum in the reference: https://docs.unity3d.com/ScriptReference/Rendering.CameraEvent.html)

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

91 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Strange Render Order Issue 0 Answers

Animating signal flow along paths? 1 Answer

Unity RenderPass: Reading from input buffers 1 Answer

Creating a Masking Object with Variable Pass Through 0 Answers

Force a custom surface shader to not compile a deferred pass? 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