-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Expected Behavior:
When SplatMesh has its position modified (y += 1, for example), and a camera pointing at the SplatMesh is modified accordingly (position.y += 1, then calling lookAt on the new mesh position), the rendered footage should have the SplatMesh appear unmoving while the scene around it moves.
Current Behavior:
The rendered splats appear to stutter behind the camera movement, staying in its previous position for a split second before updating to the proper position. In rare cases, the splats fail to move at all with no discerning causes.
Attempting to await SparkViewpoint.prepare() in the render loop results in no noticeable differences; additionally, if the argument provided to prepare() does not include update: false, the function very quickly stalls with no error thrown.
Environment:
three 0.180.0
@sparkjsdev/spark 0.1.10
Code Example:
moveSplatAndCamera(delta: number) {
if (!this.object || !(this.object instanceof Spark.SplatMesh)) return;
this.object.position.y += delta;
this.camera.position.y += delta;
this.camera.lookAt(this.object.position);
}
preparingRender: boolean = false;
async render() {
if (this.preparingRender) return;
this.preparingRender = true;
try {
await this.sparkRenderer.defaultView.prepare({
scene: this.scene,
camera: this.camera,
});
this.renderer.clear();
this.renderer.render(this.scene, this.camera);
} catch (error) {
console.error(error);
} finally {
this.preparingRender = false;
}
}
animate() {
requestAnimationFrame(this.animate.bind(this));
this.render();
}