1
\$\begingroup\$

I simply would like to apply the Global Volume only on specific layers but I probably misunderstood how it works.

Environment & Inspectors

  • GameObject\ Main Camera - Volume mask\ Background

Main Camera

  • GameObject\ Global Volume - layer\ Background

GlobalVolume GameObject

  • GameObject\ Background_terrain - layer\ Background

enter image description here

  • GameObjects\ [All other game objects] - layer\ Default

This is the result: The cloud and the platforms outlined in red are Default layers while the rest is the Background.

enter image description here

Since the guide says that some effects are applied to the entire camera anyway, I tried about ten but they all apply to the entire camera render. I left only the DOF because it is the clearest to show you the result.

What am I doing wrong ?

Thank you !

\$\endgroup\$

3 Answers 3

3
+50
\$\begingroup\$

This is not what volume masks are for. The volume mask decides which post-processing volumes affect the camera while the camera game object itself is in it. This is actually a common misconception about how post-processing volumes work. They don't affect the objects that are in the post-processing volume. They affect the cameras that are in the volume, and thus everything the camera renders right now.

Why? Because it's post-processing. Post-processing happens when the whole scene is already rendered. The input of the post-processing shader is already a 2d representation of the scene (RGB color + depth). At that stage the information of which pixel belonged to which object is already lost.

If you want to apply a certain effect only to specific objects, then there are two options:

  1. Do the effect in the shaders of the materials of those objects.
  2. Use camera stacking. Create multiple cameras with different culling masks and post-processing effects, and then have them render one over another. Problem: You lose the occlusion information. The objects of the second camera will always be drawn over those of the first. But in a scenario where you specifically want the background to be post-processed differently, that might be a non-issue.
\$\endgroup\$
1
  • \$\begingroup\$ It was exactly what I imagined. Thanks. \$\endgroup\$
    – Baro
    Commented May 17 at 16:20
0
\$\begingroup\$

The idea of volume masks is about what volume layers would affect the camera rather than the objects in the scene. (Got it wrong myself when I started).

From your response above, I believe you might need to look at custom shaders to achieve what you are looking for rather than camera stacking as you mentioned that the depth information of objects is necessary for you. In that regard, a bit more clarity on what effect are you trying to achieve would help more if you can mention that.

\$\endgroup\$
-1
\$\begingroup\$

have you tried changing the focal length

\$\endgroup\$
1
  • 2
    \$\begingroup\$ The problem is not the single effect, which in any case would not be possible because it is not the only effect I want to use and the depth of the background mesh overlaps with the depth of the objects not to be blurred. I would like to know how the PP Volume should be used with the Volume Mask, I'm not looking for a workaround for the end goal. Thanks anyway \$\endgroup\$
    – Baro
    Commented May 17 at 8:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .