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

CG. Get fragment color from previous pass.

Discussion in 'Shaders' started by Zaborius, Mar 15, 2013.

  1. Zaborius

    Zaborius

    Joined:
    Mar 15, 2013
    Posts:
    9
    Hi! As mentioned above, is there any way to use output color from first pass fragment shader in second pass? I would be grateful! )))))
     
  2. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,864
    EDIT: Sorry i misunderstood.
     
  3. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Depends what you want to do with it... but not without GrabPass - which is Pro only.

    If it's very simple maths - like multiply by a value or add a value, then the blending modes will let you do that.
     
  4. Zaborius

    Zaborius

    Joined:
    Mar 15, 2013
    Posts:
    9
    I want to use output fragment color from first pass to offset UVs coordinates in second pass depends on rgb values...
     
  5. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Yeah, you'll need to use a GrabPass then. Which requires Pro render textures.
     
  6. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Why do you need two passes?