0
\$\begingroup\$

I am Lerping the Near value of my camera, from 0 to 38, and it gives this result: change near clip plane effect

As you see, it gives a nice effect. But now I would like the effect to occur only for one specific layer. How can I do that?

\$\endgroup\$
1
  • \$\begingroup\$ You can't change the near plane value per layer. But if using the old non-scriptable render pipeline you could stack two cameras with different near plane values that each draw different layers. Or you could incorporate the cutting plane into the shader for the objects you want to cut this way. \$\endgroup\$
    – DMGregory
    Commented Oct 19, 2019 at 12:29

2 Answers 2

1
\$\begingroup\$

Playing with Near/Far clip values by layers would basically mean to render every object using a different camera. Which would probably be overkill. I think what you're looking for is a custom shader on specific objects or group of objects that would "cut" them in given depth.

Please look at this very cool tutorial on how to achieve such an effect.

\$\endgroup\$
0
\$\begingroup\$

You can use Camera.layerCullDistances (https://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html) to control per layer farclip plane

\$\endgroup\$
1
  • \$\begingroup\$ This does not move the clipping plane (which can cut a polygon and render only part of it), but rather changes which objects get culled (skipped entirely). It also doesn't affect the near plane, which is what the question asks about. It's a cool trick, but I don't think it's applicable for achieving the effect OP asks for. \$\endgroup\$
    – DMGregory
    Commented May 20, 2022 at 14:40

You must log in to answer this question.

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