Exclude object from camera clipping

he … i have a webXR scene that has a pretty enormous scale. at some areas i have faces that are close to each other and thereby start z-fighting. of cause i can adjust the near clipping value of the camera which doesn not help in my case since i have also objects in close proximity (vr controllers). so my question is - is there any way to exclude objects from camera clipping?

Hi @rtz23,

I think that’s not possible, the camera has a single frustum that targets an area of the world. A possible solution would be using a second camera with different near/far planes that is assigned to render those objects on a separate layer, on top of the base layer composition.

he … thnx for the answer… sounds as if it might work. not sure how to render second camera on top though. just need a hint. will be able to figure it out …


so i further investigated it. i wasn’t aware that you can just stack cameras like that which is pretty cool (was afraid of rtt to be honest). what was confusing though is that the cams need to share the same set of layers. i intuitivly assumed it’s possible to give each cam a dedicated layer for fore-/background. i set up two cameras now where one is clipping everything behind the xrcontrollers. and the other is clipping the controllers themselves. i stumbled into a new problem now. it seems that the render order of the cameras is going wrong. doesn’t matter if i switch priority or gave each object a distinct layer. what am i doing wrong here? here’s a simplification of the problem:


That looks like you are clearing the depth buffer on the second camera that’s rendering the blue cube (on mobile so I can’t check the project yet)

I’m not 100% sure how stacking cameras works in VR, so that would be worth testing early.


awesome … that did the trick… of cause vr kinda is the bottleneck. considering that i dont really know what changes with the camera when an xr sessions starts. for stereo view i suppose that there’s at least another camera in play then. no idea how to stack upon those. but for novr the depth buffer clearing checkbox definitly was the solution.