Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

GrabPass and Queues

Discussion in 'Shaders' started by Misscelan, May 29, 2017.

  1. Misscelan

    Misscelan

    Joined:
    Mar 8, 2013
    Posts:
    176
    Hi there,

    I have and object with a shader with two passes.

    Code (CSharp):
    1. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+1" }
    2. GrabPass    {    }
    3. Pass {  //Some stuff }
    And then I have another one with a single pass with the following tags
    Code (CSharp):
    1. Tags { "RenderType"="Opaque"  "Queue"="Geometry+10"}
    On the second pass of the first shader, I do some stuff with the GrabPass Texture I just grabbed.
    The problem is that the second object appears in the GrabPassTexture even though the GrabPass is supposed to grab the texture before the second object is drawn (at "Queue" = "Geometry+1") The second renders after (at "Queue"="Geometry+10").

    Any idea what might be going on?
    Thanks!
     
  2. Misscelan

    Misscelan

    Joined:
    Mar 8, 2013
    Posts:
    176
    I found out people having similar problems:
    http://answers.unity3d.com/questions/828086/grabpass-and-transparent-queue-materials.html
    https://forum.unity3d.com/threads/i...-how-to-use-a-grabpass-in-two-shaders.182905/

    I have tried:
    - using a separate shader for the GrabPass
    - using "Queue" tags inside the GrabPass
    - using a different texture name for the GrabPass

    All with the same result, GrabPass is always rendered at the end of the Geometry queue.

    It seems GrabPass is always executed at the end of each main queue (Geometry, Transparent, etc..) but not in between Oo?

    Is there anyone experiencing a similar behavior? or can someone from Unity confirm if that is the expected behavior?

    Thanks!
     
  3. Sparrowfc

    Sparrowfc

    Joined:
    Jan 31, 2013
    Posts:
    100
    The GrabPass can be excuted at specified renderqueue. look the the material of second one in debug mode to see the actual renderQueue of that material. if you've changed the shader of that material, the renderQueue may not equal what you write in shader