3
\$\begingroup\$

Depending on the camera angle and the distance of the animated Objects to the camera they flicked in and out of view.

Since I have no idea what could be causing this and didn't manage to limit the problem other than moving the camera please state what valuable information I should supply.

The Model is parented to a camera which is parented to a character controller. The Animation is undisrupted during scene view. If I move the camera further away from the model, or look in a different direction the models remain visible throughout the entire animation.

I have recordet the incident: https://youtu.be/b66N80_Fg_g

As you can see the right hand, the magazine and at one point even the weapon disappears from view.

\$\endgroup\$
5
  • \$\begingroup\$ Have you checked the camera clipping planes? \$\endgroup\$
    – Nikaas
    Jun 23 '17 at 8:32
  • \$\begingroup\$ Yup. It's also the entire object that disappears at once, not just parts of it as it would be the case should parts of the object be outside the camera's range. \$\endgroup\$
    – AzulShiva
    Jun 23 '17 at 15:21
  • \$\begingroup\$ FBX file: drive.google.com/file/d/0B4AGSo-ayQGUTUpBWGdNLTFHUUE/view \$\endgroup\$
    – AzulShiva
    Jun 25 '17 at 3:22
  • 2
    \$\begingroup\$ Another idea would be to check the bounds of your mesh. If they are not set correctly, they could end up not being inside the camera frustum and disappear. I had a similar issue while working with procedural geometry. Calling mesh.RecalculateBounds() solved my problem \$\endgroup\$
    – qCring
    Jun 26 '17 at 10:45
  • 1
    \$\begingroup\$ I threw in a Script for all my mesh-containing Objects with GetComponent<SkinnedMeshRenderer>().sharedMesh.RecalculateBounds(); in void start and had to tick the box "Update When Offscreen" Screenshot of Box. Everything works fine now. Put this in an answer and the bounty is yours. *Wipes sweat off forehead \$\endgroup\$
    – AzulShiva
    Jun 27 '17 at 3:51
3
+50
\$\begingroup\$

When meshes disappear randomly from certain perspectives (or as in your case during animation), the issue might be caused by view frustum culling.

View frustum culling is a CPU optimization, where all objects outside of the volume captured by the camera are discarded and won't be rendered. To determine whether an object is located inside or outside the camera's frustum, all bounding volumes are tested against the camera's frustum volume.

If you face a situation where you expect an object to be rendered but it gets culled, check the near and far clipping planes of your camera and also the bounding volume of your meshes. For imported meshes the bounding volume might not be set up properly and you need to call mesh.RecalculateBounds () or set the bounding volume of the mesh manually using the mesh.bounds property.

If you have an animated mesh, you should set the bounds in a way that they represent the maximum bounding volume so that you can be sure that culling is performed correctly in any animation frame.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Glad I could help :) \$\endgroup\$
    – qCring
    Jun 27 '17 at 11:26
0
\$\begingroup\$

I have recently met Objects where mesh.RecalculateBounds () doesn't work anymore. Another solution: Resize the Bound Extents to something ridiculously high and the Object will always appear in the camera view.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.