How to render a mesh out of the camera frustrum ?


I am working on a shader which moves the vertex of a chunk of procedural planes.

I noticed that when my camera is located at a specific height (image below for example) the planes situated under the camera are not rendered anymore.


It creates the dark area you can see on the bottom of the image below.


When moving the camera along the Y axis, most of the time the planes under the camera are rendered but the problem arises several times within tiny range of Y values. The problem is related to the shader as it occurs only when the vertex are moving.

Any Ideas how to force the below planes to be rendered by the Camera ?
Thank you

Every Renderer has a world space “bounds” value which is used to perform frustum culling of the object. If that bounds is outside of the camera’s frustum it won’t be rendered. The world space bounds of the renderer is calculated based on the local space bounds of the mesh. The bounds of the mesh should “enclose” the whole mesh so it’s guaranteed that the object is not culled even a part of it would be visible.

When you apply a “procedural” offset to the vertices of the mesh you may move the vertices into the view of the camere, even though the actual source object is completely off-screen. As soon as unchanged object is off-screen it won’t be rendered anymore.

Mesh.RecalculateBounds will update the local bounds of the mesh based on all vertex positions. However that of course does not take any modifications into account that you apply in a shader.

One solution is to manually set a larger local bounds of your mesh to ensure the bounds still enclose all vertices after your shader applied the changes.

Have you tried reducing your clipping distance? Might be you are too close to the ground and the camera is clipping the plane.

I think I got where the problem comes from. It occurs when the original plane is not seen by the camera but because I move the vertex up it should be. So the problem is to force those plane to render even if their original position are out of the camera frustum.