- Home /
Why does my mesh not render at certain angles?
I have a humanoid character with an animator controller and a camera attached to the neck bone, with an IK script making the hand and neck look towards another game object.
The camera is close in front of the character's face, with minimal clipping plain of 0.01 (lowest possible), However at certain angles the character disappears from the camera.
http://i.imgur.com/JoAnxV2.gifv
The gif video above is how the problem looks, note that the mesh does not disappear in the inspector nor would it disappear if I push my camera far back to "always see the whole character".
I have no idea what is the issue, I've confirmed clipping plain editing would only make certain bones disappear, however the entire object turns invisible at the mentioned angles.
Any help on getting the hand to never disappear would be highly appreciated.
To my knowledge, any time you see "your" limbs in an first-person perspective, these are models rigged and animated specifically for that type of perspective.
So I'm thinking even if you can solve this issue, you shouldn't be using the same animation set for first-person anyway.
Sorry but I'm not personally certain what conditions can cause skinned mesh renderers to stop drawing. I'm sure at least some of their AABB needs to be visible to the camera; perhaps it is not at certain thresholds in this dynamic process.
$$anonymous$$aybe someone with that experience can assist. Have a look at their documentation in the mean time.
It seems this might be caused by occlusion culling, Does this issue occur if you turn it off by going to the camera in the inspector and unchecking the occlusion culling checkbox?
I've tried that and it bore no fruit, after some more reading online so far I'm convinced this is related to the shaders used rather than the camera, as using the standard assets "Ethan" character does not produce this bug.
Answer by Yoraiz0r · May 03, 2015 at 12:33 PM
Answering my own question in case anyone takes a look at it in the future. Apparently the camera can mark certain game objects as 'behind it' and when that happens they will not render on it at all, the solution however is pretty simple!
Simply go to the meshrenderer of your game object and check the 'Update when offscreen' box, and the object should no longer randomly disappear from the camera.
For anyone else looking here. Only skinned mesh renderers have this option. If you are using a straight $$anonymous$$esh Renderer and it is disappearing when it shouldn't be you are most likely generating the mesh yourself and should be sure to call RecalculateBounds after any manipulation of the mesh.
Thanks for this, because I have this exact problem, and I am generating the mesh myself. After each manipulation I was calling RecalculateNormals, so I also tried, RecalculateBounds, but i'm still having this problem. Any ideas?
Just now seeing this. Depending on your use case you may need to calculate your own bounding box for a mesh like monotoan mentions in an answer below.
I had this problem too, and while Update when offscreen fixes it, you might want to check where the bounding boxes of your character's skinned meshes are. $$anonymous$$y skinned meshes were still referring to the prefab's root bone's transform, which was at 0,0,0. So if the camera looked away from 0,0,0, the meshes would disappear even though the game object was in view. Fixed this by setting the right transform to the meshanimator.
For just a regular mesh, when I encountered this issue I found that;
mesh.RecalculateBounds();
worked to let the camera know where the mesh was.
This is a principle created by one of the culling part of the rendering process of the engine. Since offscreen skinned mesh are pretty much a pure waste of rendering memory, the engine is, by default, turning off the mesh if the camera doesn't detect its point of origin.
The offscreen culling is done by an internal series of raycast from the camera toward all objects (or culling groups) with an active rendering in the scene. In the case of skinned mesh, there are no culling groups, so it's done on a per-object basic. When the option "Update when offscreen" is turned off, the camera cast a raycast toward the point of origin of the skinned mesh renderer model and, if returns true, render the skinned model. When the option is turned on, the camera create 8 raycast call toward the 8 corners of the bounding box of the skinned mesh renderer and if any returns true, the model is rendered.
This might sound extreme, but that's exactly why the camera Far clipping planes should be set to the $$anonymous$$imum of the best result and not just to an insane high number. The distance of each raycast cast from the camera is based on that value.
Culling group (for regular mesh renderer) allow the camera to cast toward 8 corners for multiple mesh renderers at once (and ignore the mesh renderers themselves). As such, a culling group of 7 or less mesh doesn't require a group while 8 or more allows to save quite a bit of CPU processing the rendering.
Answer by monotoan · Oct 04, 2017 at 02:50 PM
Adjusting the bounds of your mesh can be helpful for solving this problem.
The bounds dictate the area in which the mesh will render, and if you're doing any kind of deformations on the vertices/geometry of the mesh, that may move part or all of it outside of those bounds.
To test this, use something like the following code to set the bounds very high, and see if it fixes the issue:
private void Start()
{
Mesh m = GetComponent<MeshFilter>().mesh;
mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 2000);
//mesh.bounds is in local/object space, so
//setting a center of zero and extents of 2000 will
//expand the bounds into a box 2000 units wide around
//the center of the object
}
Thank you so much. It helped me a lot. By the way there is bug. Should be "m.bounds" :-)
Answer by retrobullet · Nov 26, 2018 at 07:05 PM
look of OCCLUSION IS OFFFF and test with different settings when putting back on again
Answer by holdingjupiter · Jun 18, 2016 at 05:36 AM
I'm having a similar problem witch some blend shape created automatic doors. If I look at it from around a 45 degree angle or more, the door disappears. The doors look good other than that so I might solve it in some banal copy way. Any thoughts on that problem other than the solutions listed here?
Answer by Salvation-Au · Sep 29, 2017 at 04:20 PM
I had a very similar problem of meshes not rendering at certain angles or being able to see through to other parts of the mesh. I switched from the Unity standard shader to a custom shader and the issue went away.
May not be a solution but may help others troubleshoot their own issues.
Your answer
![](https://koobas.hobune.stream/wayback/20220613194052im_/https://answers.unity.com/themes/thub/images/avi.jpg)