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):
player
enemy
friendly
dead
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
Player
andEnemy
respectively. 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 view
and set it above the player and enemy. Make sure the face of the plane is facing the camera. This object would reveal or hide thePlayer
and theEnemy
layer. If this is on top of theFogOfWar
, the area that theFieldOfView
is 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
Player
,Enemy
, andFieldOfView
. Set this toFogOfWar
- Create a button, and set it to
UI
layer - 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
Behind Masks contain 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.
Field of view
in the photo was edited. it should beFieldOfView
. other than that, it's the same setup \$\endgroup\$Camera stacking
feature. This is my first time fiddling around with the URP. I'll get back if I get my desired result \$\endgroup\$Transparent Layer Mask
. However, this doesn't obscure anything from the field of vision. There's practically no change. It's as if I'm not using the Universal Rendering Pipeline if I do so. \$\endgroup\$