0
\$\begingroup\$

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:

enter image description here

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):

  1. player

  2. enemy

  3. friendly

  4. 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:

  1. create the following layers (Player, Enemy, FogOfWar, FieldOfView, Wall, UI)
  2. Set a game object with sprite component to player, enemy. Set them to the Player and Enemy 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.
  3. 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.
  4. 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 the Player and the Enemy layer. If this is on top of the FogOfWar, the area that the FieldOfView is upon will be invisible. That way, the sprites underneath it is not darkened.
  5. Have a sprite renderer (A square) and set it to black with 50% opacity and make it cover the the Player, Enemy, and FieldOfView. Set this to FogOfWar
  6. Create a button, and set it to UI layer
  7. 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

  1. For the render features, add these three: enter image description here

Behind Masks contain Player & Enemy enter image description here enter image description here


edit 2: I forgot. I have three cameras. All orthographic. They only render a specific layer.

  1. Main Camera - Culling Mask is Wall
  2. Character Camera - Culling Masks are Player and Enemy
  3. 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.

\$\endgroup\$
4
  • \$\begingroup\$ Please walk us through the steps to reproduce this problem. If folks have to watch a video to understand your situation, they'll more often just click on to the next question instead. \$\endgroup\$
    – DMGregory
    Jun 16, 2020 at 6:57
  • \$\begingroup\$ updated. let me know if you still need more info. the Field of view in the photo was edited. it should be FieldOfView. other than that, it's the same setup \$\endgroup\$ Jun 17, 2020 at 1:30
  • \$\begingroup\$ I think I should be utilizing the Camera stacking feature. This is my first time fiddling around with the URP. I'll get back if I get my desired result \$\endgroup\$ Jun 17, 2020 at 4:40
  • \$\begingroup\$ At this point, the only way I could see any object is to set all of them into the 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\$ Jun 17, 2020 at 6:49

0

You must log in to answer this question.

Browse other questions tagged .