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

See Through Shader Approach

Discussion in 'Universal Render Pipeline' started by richardjdury, Feb 23, 2021.

  1. richardjdury

    richardjdury

    Joined:
    Dec 1, 2020
    Posts:
    2
    Hi all,

    I’m working on an isometric game for mobile where the views of characters are often blocked by walls and other obstacles. I know this is a common problem and I’m aware of the possible solutions (this reddit post sums them up well [link]).

    I would like to incorporate the “x-ray bubble” method and cut a hole in the obstructing objects with a smooth edge, and there many solutions to achieve this effect:
    • See Through Wall Shader - Unity 2019 Tutorial - Shader Graph [link]
    • Wall Cutout in Unity Shader Graph [Tutorial] [link]
    • See through walls shader | Under60sec Unity tutorial [link]
    • How can I create a “see behind walls” effect? [link]

    I’ve incorporated this effect successfully, however I have a few issues:
    • Issue 1: For all examples listed above, the shader only works for one character. Ideally I would like this to apply for all characters on screen.
    • Issue 2: All materials applied to objects obscuring all characters need to be found with every update and have their shader variables altered. Would this be computationally intensive?

    I have thought about ways in order to resolve these issues:
    • Solution to Issue 1: Replicate parts of the shader graph which generate the cutout shape and supply each with the position of a different character. Combine them all before they are fed into the alpha channel of the PBR master.
    • Solution to Issue 2: Use a shader independent approach (which appears to be possible in this Unity Asset Pack: See-Through System). However, this package doesn’t work with the Universal Rendering Pipeline (which I’d like to use to launch on mobile).

    I believe I’ve done quite a rigorous search to try and find a solution, but I’ve not quite found what I need. I would be very appreciative of an experienced perspective and critique on this approach. Am I trying to do too much? Would a solution be too intensive for mobile? Should I simplify the problem and use a silhouette style approach described in this Brackeys tutorial [link]?

    Any hints at all would be extremely useful.

    Thanks in advance!

    Rich.
     
  2. toorican

    toorican

    Joined:
    May 25, 2018
    Posts:
    16
    Last edited: Nov 2, 2021