I've been watching this video about Field of View (Player) by CodeMonkey which explains on how to set up a scriptable rendering pipeline for the layer unmasking/masking of objects. However, the interface changed with the latest updates. There's an
Opaque Layer Mask and there's a
Transparent Layer Mask. I've followed the Render Features as described in the video but I wasn't able to get the masking done correctly as there's these two options that I can't seem to figure out what it does. I tried toggling to and from layers to see which one is meant to be in the other one but this is the best I could get:
For simplicity's sake, these are the layers that I am using: Characters (things I want to see when the Field of View mask is over them):
Field of view (the unmasking layer)
Fog of war (the thing that makes everything have a black transparent fog)
UI (the layer that I want to see regardless of the where the Field of view mask is)
As of right now, I could see the Field of View and the UI. Everything else is missing. I have asked in their own community; however, no one reached out to me. Let me know in the comments if you need more info.
edit 1: to reproduce:
- create the following layers (Player, Enemy, FogOfWar, FieldOfView, Wall, UI)
- Set a game object with sprite component to player, enemy. Set them to the
Enemyrespectively. This one, we want to see if the field of view layer is on top of it. They will be invisible if the field of view is not on top of it.
- Place a Sprite Renderer (a square) and set it to the
Wall. This one, we want to see regardless if it's masked or not. If the field of view layer is not on top of it, this should be darkened by the fog of war.
- Set a Mesh Renderer (A simple plane would do) to
Field of viewand set it above the player and enemy. Make sure the face of the plane is facing the camera. This object would reveal or hide the
Enemylayer. If this is on top of the
FogOfWar, the area that the
FieldOfViewis upon will be invisible. That way, the sprites underneath it is not darkened.
- Have a sprite renderer (A square) and set it to black with 50% opacity and make it cover the the
FieldOfView. Set this to
- Create a button, and set it to
- Create a universal rendering pipeline. head over to the options and add the settings (keep in mind, I don't know what to set here. The Opaque and Transparent Layer Mask are my problem.):
a. Opaque Layer Mask - Wall, FogOfWar, FieldOfView
b. Transparent Layer Mask - Player, Enemy
edit 2: I forgot. I have three cameras. All orthographic. They only render a specific layer.
- Main Camera - Culling Mask is Wall
- Character Camera - Culling Masks are Player and Enemy
- UI Camera - Culling Masks is UI
Character and UI camera have a depth. UI Camera's depth is 0. Character Camera's depth is 1. I want to render the UI below the characters. Hence, I separated them into their own camera.