Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Creating a fog of war aperture mask in shader graph

Discussion in 'Shader Graph' started by Lethn, Sep 13, 2019.

  1. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    So I'm having a look at the tutorial here on fog of war and plan on implementing a version of it in my game using the masking method to blend my circles/spheres.



    Does anyone have any resources on how to do this in Unity shader graph? I'd love to be able to get all the nodes put together for this camera trick and then that way I can add even fancier effects on without having to learn tons of unnecessary shader code.

    I've tried searching for tutorials on this a bit but this so far is the only reliable bit of information I can find.

    https://answers.unity.com/questions/1560820/how-to-pass-depth-texture-to-shader-graph-hdrp.html

    Kind of found an almost answer here but it would be nice if somebody could go into detail bout how I'd achieve all of this. I don't for example know what any of these nodes actually do to create the effect I want.
     
  2. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
  3. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    Oh I can't believe this, I found the answer here, so it turns out that Unity has a built in effect for what I wanted all along with the shader graph and this is something I spent weeks researching tons of options on.



    Okay I went through this little section where he explains the spherical mask but he doesn't explain properly how to apply it in an example, would somebody mind going through that with me?
     
    Last edited: Sep 13, 2019
  4. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    I somehow managed to get the exact effect that I wanted using a position node and attaching it to the centre property of the sphere mask node and then to the albedo mode the only problem is for obvious reasons this isn't ideal as I can't use any custom textures or change the colour with this method? I thought I could use colour properties and so on to let me change things but that isn't working, does anyone have any ideas?
     
    MoonbladeStudios likes this.
  5. Nurallaerel

    Nurallaerel

    Joined:
    May 6, 2015
    Posts:
    13
    Since the video you posted not available anymore, could you lead me to the right direction?
     
  6. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    Thanks, hadn't noticed this was an issue, I think that shader tutorial was very old.



    I did manage to find this, it's 2D but it might well be possible to set things up in 3D.