Is GreaseLines more performant than edgeRenderer?

You already answered you question here :slight_smile:

But let’s elaborate a bit more on this question then.

So we know there is:
https://doc.babylonjs.com/typedoc/classes/BABYLON.GreasedLineTools#MeshesToLines

which accepts a second parameter called predicate which is a callback function where you can decide whether to include the lines of the face being processed or not or to return an array of points whihch will be included a used to draw a line or lines:

    public static MeshesToLines(
        meshes: AbstractMesh[],
        predicate?: (
            p1: Vector3,
            p2: Vector3,
            p3: Vector3,
            points: Vector3[][],
            indiceIndex: number,
            vertexIndex: number,
            mesh: AbstractMesh,
            meshIndex: number,
            vertices: FloatArray,
            indices: IndicesArray
        ) => Vector3[][]
    ) 

p1,p2,p3 are the positions of the face being processed. We have a ton of information available so we can do I think whatever checks we need to decide which line gets included. We can calc the dot product of two vectors and according to its value include or drop the line:

Example for a box:

EDIT: this is not a full solution, it just shows how you can deal with predicates when using MeshesToLines

2 Likes