Search Unity

How should I show the player and some area around them when behind an object obstructing view?

Discussion in 'Scripting' started by Grievemourne, Feb 5, 2016.

  1. Grievemourne

    Grievemourne

    Joined:
    Oct 19, 2012
    Posts:
    15
    Alt title was way more obtuse, if you can believe it: Localized transparency based on mask/map information and rendering priority?

    Basically, I want the player to always be shown even when behind an object, and even better if I can show some of the area around them. It had me thinking of how I could change the rendering priorities of objects, to force the player to always be rendered no matter what, but I don't know how to do the same to the area around them.
    I'm hoping to have the effect be a circle with a faded edge around the player, but uncertain how to achieve that.

    I was wanting to have some texture or map information be place on the player (or camera) with the faded circle around them and use it as a mask to somehow blend rendering priorities on a per pixel basis between foreground object and background object - or what's hit by a raycast between camera and player. I'm going to make an image of what I mean soon, maybe tomorrow, but hoped to maybe get a response in the morning, so made this now. I hope it's not completely incoherent. Example.jpg

    Blue is the player, red is the background, yellow is the foreground object. When The player goes behind the yellow object, I want the object to become transparent around the player - but not the entire object. Represented by the bottom right image.
     
    Last edited: Feb 6, 2016
    bear1998 likes this.
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
  3. Grievemourne

    Grievemourne

    Joined:
    Oct 19, 2012
    Posts:
    15
    It's not exactly what I need, but it's hard for me to say that it's completely unrelated when I'm trying to find out what I have available to me as likely avenues to achieve this. Updated the original post with an image for a better explanation, if you could have a look.
     
  4. bear1998

    bear1998

    Joined:
    Oct 1, 2018
    Posts:
    2
    anyone got any idea of how this is done I need to do it aswell for my top down game. I cant figure out how to an area of influence around the player to achieve the transparent effect when they are near to walls