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 relativegames · Dec 11, 2013 at 08:49 PM · shadersdrawcallsdrawing

Draw order when using RenderTargets ?

I'm curious what the draw order is when using render targets because I'm seeing some weird behavior in Unity 4.3 . Respectively, when you have transparent objects that get rendered by a camera, and then the camera has a post processing effect, the draw order is fucked up.

What my setup is : I render opaque and transparent objects from Camera 1, I then have an image filter that combines Camera1 with Camera 2 (which renders it's own objects). Whenever I disable the filter on Camera 1, everything looks ok, when I add the extra filter, transparent objects are not rendered.

However, I found a small fix : have all transparent objects render in the Geometry+1 que. If I add this to all transparent shaders, everything renders correctly ! However, this means modifying all transparent shaders + built in ones to make everything work correctly which doesn't sound feasible. It seems as though the render target filter draw call is getting called BEFORE drawing transparent objects which sounds stupid. Is this a bug ? Is it Intended ?

Comment
Add comment · Show 1
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 OP_toss · Dec 11, 2013 at 09:45 PM 0
Share

I've seen this issue before and honestly I couldn't fix it. $$anonymous$$ine was more related to the alpha getting rendered incorrectly when using RenderTextures, so alpha blending was messed when I went to combine in the post effect.

A quick fix though would be to set the queue using the material. This avoids having to modify the Shaders themselves, and gives flexibility in doing it on a material basis.

Hope this helps!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by relativegames · Dec 12, 2013 at 11:39 AM

Ok, so after about 3 hours of trying to tweak the image shader I noticed something, the SSAO shader when turned on/off did not exhibit this issue, so turning it on or off did not have any impact on transparent objects, they were still getting rendered. So then I realized that my shader was copied from a "standard unity shader" which had a lot of tags. So basically after removing these :

     Tags {"Queue"="Geometry+3"  "RenderType"="Opaque"  }
     LOD 200
     Pass
     {
         Lighting On
          
         Tags {"LightMode" = "ForwardBase"}


It started working as expected. You still need the "Pass {" but everything else needs to be removed. I also added

 ZTest Always Cull Off ZWrite Off Fog { Mode Off }

from the SSAO shader.

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

17 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

Related Questions

How to change drawcall order? 1 Answer

Game work slow in other devices.. 1 Answer

Is there an any way to use batching with UV tiling? 1 Answer

How do I use Multiple Render Targets with Unity 3.5 2 Answers

Custom Shader with Canvas Renderer limit draw calls. 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