I build for Quest2 and for some reason the camera clipping distance behaves differently when viewing far objects in a build as when in editor (using the headset in both cases). In editor, I can see my mountain ranges completely with a camera clipping range of 2500, yet when the same scene is built I have to boost it up to 3500 to stop it from clipping as I move my head around.
The assets I noticed the issue on were Amplify Impostors, but I put a standard mesh at the same distance and it’s also affected which generally rules that out. I know there’s a LOD bias which would affect LODs specifically, but the assets involved don’t have any LODs.
I’m seeing a similar issue with a shader that blends vertically from sand to grass based on height. The shader reads world space heights to set its threshold, but for some reason there’s no transition at all in builds. I tried switching from World space to Absolute world in case there was some issue there. Strangely, though, a more complex version of the same shader is still working close to the camera.
Is there something that would cause distances in a build to differ from distances in editor? If so, how do I make sure they’re aligned?
This should not be different according to my understanding.
How is your VR player set up?
Is unity up to date?
Are you using default URP settings? If not, what did you change?
I managed to fix the second issue with the vertical distances not working correctly in a build, but I don’t have an exact answer for what was wrong unfortunately. My guess is that the shader wasn’t pruning out unused code branches correctly in the build, which is less relevant when running in editor. It was a “cheap” variation of a more complex shader which used a heavily branched subgraph that ought to have reduced to the more concise set of nodes which were involved. I removed the keyword based branching and hard coded it and the result works in both build and editor again.
The camera clipping distance is still present, but I can work around it by boosting the clipping distance. I assume large clipping distances will only become problematic when increasing the range by magnitudes, which I don’t have to worry about in my case since my background is carded.
I’m using Unity 2022.3.1f1 and URP. My URP settings are mainly adjusted for shadow cascades and resolution and to ensure PP is fully disabled. LOD bias is 2. All platforms should be using our Quest2 URP asset. Rendering with OpenGL because Vulkan had been giving us mystery issues during earlier development and we had no solution.
It’s been awhile since I’ve dug into our VR setup itself. We’ve got XRIT and the XR Origin rig as a base taken from that. My XR provider is set to OpenXR on Windows, and Oculus on Android, which I didn’t expect (those settings are owned by others on the team now). I’ll check in with my engineers since I clearly need a refresher…
If you update to the latest unity version vulkan should run fine (for me even with graphics jobs)
Sadly I cannot help with where the issue is exactly. Big clipping planes can add more gpu usage and maybe cause z fighting faster. If you have none of these issues, you should be fine?
Yeah, the problems are solved enough for now. Updating our Unity version is a bigger decision that I’ll leave up to others on the team. We prefer locking in for long periods of time so we’re not fighting against minor change related breaks when stability is being prioritized.
1 Like