Announcement

Collapse
No announcement yet.

Masking occluders in a top-down game

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Masking occluders in a top-down game

    Hi all,

    My question is about masking occluding objects in a top down game. Obvious examples are the roofs to buildings or tree canopies, and my intent is to have a circle "vision" where the camera sees through objects to reveal the player behind. A good example would be the game Divinity: Original Sin 2. There are various potential approaches to this, but I have been struggling.

    One approach I have taken so far has given mixed results. I am raytracing from the camera to the character to identify occluding objects. If I hit one, I manipulate the material to make a circular mask at the location of the ray hit to give that area opacity, allowing it to be seen through. This technically works - but I do not think having all my potential occluders materials be masked transparent ones is very efficient, it makes the shadows look bad, and it doesn't appear to work with the foliage system - which is crucial!

    A though I had was to "tag" various objects as occluders, and have another camera render the scene without these objects being visible. When the player becomes occluded, I could switch to render the output of that camera in a circle at the middle of the viewport. This has obvious problems - it would make all occluders invisible, not just the ones in the way, and I'm not even strictly sure it is possible as I describe.

    What approaches have people taken to fix this and have it work even with foliage?

    #2
    https://gyazo.com/f2eced66f86e9944bd9d13b9cea1cd8d




    Here's a demonstration of the effect I had in mind

    Comment

    Working...
    X