- Home /
Plane is not rendered when look up
Hi, I use Unity 2018.2.7f1. I've created a plane and edit his mesh (vertices). Additionally I added the FPSController from the Standard Assets Pack. It rendered very well, but if I look up a bit, the plane is not shown althougt it must be there. How can I fix this? Thank you for your help
I want to use the advantages of an plane, like the 11*11 vertices. It's faster than cubes.
Answer by Namey5 · Feb 28, 2020 at 10:43 AM
It's hard to tell exactly what is happening without further description, but I see two ways of reading this;
The plane is invisible from underneath - this is caused by backface culling and you will either need to manually add the backfaces as their own triangles with flipped normals, or use a double sided shader.
The plane disappears when not looking directly at it, but it should still be visible (which is what I would assume this is about). As an optimisation to the rendering process, on top of culling offscreen vertices in the shader, Unity will also cull entire objects based on their pre-determined 'bounds' (a box in which the entirety of the mesh will fit). This works great, but if you edit the mesh manually without adjusting the bounds, the object can be culled prematurely.
Luckily, this is fairly simple to fix; if you know what the bounds of the mesh should be, you can set them directly, i.e.
Bounds bounds = new Bounds (...);
mesh.bounds = bounds;
However, if you don't already know the bounds there's no need to calculate them yourself - the mesh class has a built-in function to do just that;
mesh.RecalculateBounds ();
https://docs.unity3d.com/ScriptReference/Mesh.RecalculateBounds.html
-.- I had already an answer written similar to yours but I got interrupted before I submitted it :). Anyways I didn't even mention the single-side-ness of a mesh so your answer is even more "complete".
+1
I have a habit of opening a bunch of questions at once and answering them over time without refreshing the page, so I know how you feel.
I just recently closed "some" old Unity answers tabs. Specifically about 2100 of them ^^.