Regression (v7.35.1 → v7.35.2): `LineSystem` and `PointsCloudSystem` not consistently rendering

Please see the videos linked below:

Link to commits between v7.35.1 and v7.35.2

Link to diff between v7.35.1 and v7.35.2

The code looks something like:

Code
engine.runRenderLoop(async () => {
	/* Points Cloud System */
	if (this.#pointsCloudSystem !== undefined) {
		this.#pointsCloudSystem.dispose();
	}

	this.#pointsCloudSystem = new BABYLON.PointsCloudSystem('', 5, SCENE);
	this.#pointsCloudSystem.addPoints(
		//
		this.#points.length,
		(p: BABYLON.CloudPoint, i: number, s: number) => {
			p.color = this.#pointColors[i]!;
			p.position = this.#points[i]!;
		},
	);
	const mesh = await this.#pointsCloudSystem.buildMeshAsync();

	if (this.#lineSystem !== undefined) {
		this.#lineSystem.dispose();
	}

	/* Line System */
	this.#lineSystem = BABYLON.MeshBuilder.CreateLineSystem('', {
		lines: this.#lines,

		colors: this.#lineColors,
	});
});

It definitely has to do with running .dispose() and recreating both the Line System and Points Cloud System every frame.

Would anyone know what could have caused this? Thank you for your help :slight_smile:

What about 8.0 ?

A repro in the PG would be lovely to investigate

1 Like

The issue also repros in all versions of v8+

Let me try to port some of this code to a PG

In your case setting Effect.PersistentMode = true as soon as the engine is created should be the way to go.

2 Likes

Effect.PersistentMode = true works great! Thank you so much, @sebavan ! :smiley:

Nice catch buddy! I did not think about that one :smiley:

2 Likes