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. Dismiss Notice

Modify z-buffer in perpixel shader

Discussion in 'Shaders' started by HolyShovel, Sep 27, 2014.

  1. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156

    Hi all. I watch this video, and very impressed. This is awesome idea for parallax shaders, but i don't understand, how this works (how send custom depth info into depth buffer). Any ideas?
     
    Last edited: Sep 27, 2014
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,414
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's just a shader that writes depth at it's simplest. Pretty much what resident evil used to do. If you have static backgrounds that need to be interacted with, it can be useful.

    You however need to save the depth information somehow from your 3D modelling package or from a high resolution scene.
     
  4. HolyShovel

    HolyShovel

    Joined:
    Jun 19, 2013
    Posts:
    156
    Yes. I understand this. What i want to do:
    1) Calc all visual data in shader.
    2) Calc the depth offset based on textures.
    3) Send new depth into z-buffer.
    But I don't know how to implement the last point... and how it works on different pc operation systems.
     
    Last edited: Sep 27, 2014