Godot Version
Godot 4.3
Question
I’m making a tile-based strategy game where every vertex is saved as a height value, so for overlapping areas I would use another layer for part of the terrain. But of course, there needs to be a way to have some layers only cover parts of the world.
The way I had originally handled this is by deleting vertices from the ArrayMesh but erasing terrain this way in the map editor caused huge lag spikes.
So I wondered whether there was some way to disable individual vertices in the vertex of fragment shader.
I tried just using
shader_type spatial;
varying vec3 world_pos;
void vertex() {
world_pos = VERTEX + NODE_POSITION_WORLD;
}
void fragment() {
if (world_pos.y < 0.0)
discard;
}
but (I think because of fragment interpolation) that only gets rid of the parts of the mesh whose y-position is below 0, not entire faces.
So my question is, is there a way to hide individual faces in a mesh without altering the mesh data itself?