I'm using this terrain shader: https://github.com/puchik/godot-extras/blob/master/visual/terrain-vertex-shader/terrain_mesh.shader
Which is awesome, but the meshes have incorrect AABB's, as I understand it because at certain camera angles, the mesh disappears. I learned this is due to frustum culling, and since I'm displacing the vertices pretty far in the Y axis, the AABB is very off.
I tried overriding the AABBs but it doesn't seem to help.
I was wondering whether the shader was doing something, but it doesn't look like it does, to me anyway.
Here's basically what I'm doing:
var resolution = 64
var size = 64
mesh.subdivide_depth = resolution
mesh.subdivide_width = resolution
mesh.size.x = size
mesh.size.y = size
mesh.center_offset.x = size/ 2
mesh.center_offset.z = size / 2
Then, I set the custom_aabb like so:
var aabb = AABB(Vector3(0, 0, 0), Vector3(mesh.size.x, height_range, mesh.size.y * 2))
mesh.custom_aabb = aabb
setting the custom_aabb doesn't seem to affect it much at all in fact.
Thanks in advance!