Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Objects disappear when i move Camera (no clipping issue)

Discussion in 'Universal Render Pipeline' started by W1zzel, Jun 21, 2020.

  1. W1zzel

    W1zzel

    Joined:
    Aug 7, 2017
    Posts:
    5
    Hi, I am using URP and have updated my Materials to Simple Unlit.

    When I now move my camera, some objects of my scene disappear. I can only make them appear if I find a sweet spot in the world for my camera or disable and enable the game object again.

    This does also apply in game mode so I would have to disable and enable my object at runtime to get it working. Its obviously no camera clipping (my settings are 0.01 near, 1500 far)

    So I suspect that's some kind of shader issue. How can I fix this?
     
    rlalancette likes this.
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,549
    If it weren't for disable/enable fixing the issue, I'd say it could be frustum culling and incorrect mesh bounds. I've had that issue before with objects disappearing while still half-visible in the camera. It might be worth trying RecalculateBounds (in particular with any custom or modified meshes), i.e. GetComponent<MeshFilter>().sharedMesh.RecalculateBounds();
     
    punchie7 likes this.
  3. W1zzel

    W1zzel

    Joined:
    Aug 7, 2017
    Posts:
    5
    Thanks but depending on my Cameraposition, I would have to call this on every Object in the Game. I have found a position where everything works and since my camera isn't really moving, I hope I am good.
     
  4. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    760
    I had this exact same problem with URP and Unlit materials. For me, it was occurring for things that I was scaling or particle effects. I think it has something to do with renderbounds not getting recalculated properly. I took me a really long time and a lot of trial and error before I figured out a solution. I found two actually.

    Solution 1) This solution ONLY works if you're not using Hybrid Renderer V2 (which doesn't support mobile shaders). Change the shader from "Universal Render Pipeline/Unlit" to "Mobile/Particles/Additive". For whatever reason, the mobile shader still works in URP projects and doesn't have the disappearing problem.

    Solution 2) On your material settings in the Inspector, change Advanced/Priority to 50. Honestly I'm still not sure why this makes a difference, but it worked.
     
    Deleted User and W1zzel like this.
  5. gneissler

    gneissler

    Joined:
    Jun 2, 2017
    Posts:
    3
    it has something to do with a wrong pivot of the mesh your trying to render, so if the "wrong pivot" of this object falls behind the camera`s renderview, then the object simply gets treated as no longer importent to be rendered.
    either you fix the objects pivot in blender or maya or "if its not a problem to render this object when the camera doesnt look at it"
    --->select the obejct select the mesh renderer and thick the box where it says "update when offscreen"
     
  6. Pagan0

    Pagan0

    Joined:
    Aug 7, 2018
    Posts:
    1
    for me problem (with problematic meshes) was solved by unchecking "Dynamic Occulusion" box
     
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Where is that tick box?
     
  8. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,549
    It's so objects behind other objects are culled. If it's unchecked you still have frustum culling (when mesh bounds are outside of the camera's view).

    Edit: never mind, I'm dumb - I thought it said "what" not "where" :rolleyes:
     
    radiantboy and Mizdotexe like this.
  9. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    For me unity was setting simple as default settings, this was triggering LODs to not appear, raising default quality stopped lods culling.
     
  10. Nicooo_

    Nicooo_

    Joined:
    Aug 4, 2019
    Posts:
    2
    Thank you soooooo much, I've been struggling for hours with a first person view disappearing every time i played a run animation. Updating when offscreen fixed it and it now works perfectly fine. Thank you!
     
    prakyath_unity likes this.
  11. rlalancette

    rlalancette

    Joined:
    Sep 20, 2014
    Posts:
    18
    Facing same issue here. Object disappear when I look at them, and reappear when I look away...
     
  12. Wamoga

    Wamoga

    Joined:
    Oct 23, 2021
    Posts:
    1
    I think i got the same issue and found the problem origin and the solution, but the original question is not quite precise to be sure that's the same problem, so i gona explain a bit.

    if you'r using a skinnedmesh renderer, so that Unity does not have to calculate if the object (with mesh animation, or in my case bones modifications) is in the camera view, he use a boundary box that should contain entirely the mesh and all animations, no any point should be out of this during all animations of this object. Then unity calculate if the bundary box is in view instead of entire mesh.

    i think this box is preacalculated on standrads meshes and scale with objs if needed.

    you can find, in the SkinnedMeshRenderer component the setting to modify this box, this is called Bounds.
    you can check "update when offscreen" too but not optimal.
     
    Typhereus and radiantboy like this.
  13. rlalancette

    rlalancette

    Joined:
    Sep 20, 2014
    Posts:
    18
    Found the issue!
    I needed to re-bake all occlusion!
     
  14. EthemKrg

    EthemKrg

    Joined:
    Mar 7, 2020
    Posts:
    4
    I had simply fix my issue, selecting "Update When OffScreen"
    My object not seen if i look closer not depends on scene or game window Ekran görüntüsü 2023-04-30 200512.png
     
    vovahomenko2819 likes this.
  15. vovahomenko2819

    vovahomenko2819

    Joined:
    Apr 2, 2023
    Posts:
    1
    Thank You very MUCH. It's very helpful!!!!!!!