There is a landscape in my game, it consists of several layers(each is a separate mesh), now i want to do mesh simplification to the whole layers, but I found there is many intersections between different layers after apply simplification in the game engine, so is there a simplification algorithm to avoid intersections(or reduce the nums) or how can I avoid the intersection after simplification(any open source code repo or library will be appreciated)?
1 Answers
If I have understood well, the problem is produced because you are decimating each layer independently, and each decimation process has no idea of information about the others.
One idea you can try is to quantize the coordinates of your vertex after each decimation, so you don't let the coordinates to take free values, but you force to be multiple of a given value using rounding and truncation operations. This will enforce the probability of vertex of two different layers to take same values. Depending of your layers, it may be enough to quantize only one of your coordinates to avoid the sensation of overlapping between layers.
Other idea is to use a simplification algorithm based on "vertex clustering decimation", which will produce a similar effect to quantification. In this case, you can do the vertex clustering of a cloud of points with the vertex of every layer to appear together, so you ensure the vertex representator for each cluster is shared between every layer.