I’d love to know what approaches people are taking to mask occluding objects in a top down game. Basically, anything that hides the character should be made see-through at the point it occludes them, allowing the player to see their character at all times.
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!
If anyone has an approach that works with the foliage system, or anyone has taken an alternative approach to this sort of problem, I’d love to hear it.
Looking around on youtube, there’s a decent example of the sort of thing i’m trying to replicate:
It should be a case of raycasting to a point and inserting circular masks on materials that intersect the ray, but I’ve not had this work to an acceptable degree