Flat plane meshes disappear at specific y positions
Created by: sheepandshepherd
I'm having a strange problem with flat MeshInstances not rendering if their global y position is exactly -1, or other specific values like -5 or +3 (every 4 units apart). I uploaded a test project to try figuring out what the issue is, and to make sure it isn't specific to my game.
As many details as I could get from the test project:
- Non-flat meshes are fine.
- The disappearances only happen at those specific, consistent values. Moving the tiles up or down by even 0.001 causes them to appear normally.
- Whether the MeshInstance is saved in the scene or created at runtime makes no difference.
- I added TestCubes as children of all the tiles. The TestCubes that are children of the "invisible" tiles are rendered normally, and in their correct positions.
- The mesh used doesn't seem to matter; I originally had the problem with a simple quad exported from Blender, and the same thing happens with a simple plane created with SurfaceTool.
- I don't know if it has anything to do with culling, but rotating the camera around to any angle has no effect on which tiles are visible.
- The "invisible" tiles are also invisible in the editor.
- In the editor, moving an "invisible" tile to a different y position does not make it visible again until the scene is saved and reloaded.
Screenshot from the test project showing the quads being rendered in most of the MeshInstances, but those at y = -5/-1/+3/etc. are invisible:
Issue #3253 (closed) might be the same, although these MeshInstances are invisible at runtime as well as in the editor.
Finally, I noticed an octree error that might be related while I was testing. As mentioned above, moving the problematic MeshInstances up/down by 0.001 makes them visible again (they only disappear at specific integer values); however, if I do this in a function while the game is running, instead of the tiles becoming visible again, I get this error message once for each "invisible" MeshInstance in the scene (but not for the properly rendered MeshInstances). Issue #3325 (closed) mentions this error as well, but in different circumstances.
Not sure how Godot's octree works, but because the "disappearing points" repeat consistently every 4 units, I wonder if completely flat meshes at the exact border between octree nodes are somehow not getting sorted into any node, and so not rendered at all. The octree error when moving "invisible" MeshInstances: ERR_FAIL_COND( e.octant_owners.front()==NULL );
, from here.