From 815d39c4712ca7a9e67f93537696a00e5dc69387 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 27 Apr 2026 16:08:03 +0200 Subject: [PATCH] Improve model instance synchronization by adding render groups for visible displayed models and applying shadow state. --- src/viewport-three/viewport-host.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index ee6429a2..177c27fd 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -5983,18 +5983,42 @@ export class ViewportHost { private syncSimulationModelInstances( runtimeScene: RuntimeSceneDefinition ): boolean { + let addedRenderGroup = false; + for (const modelInstance of runtimeScene.modelInstances) { const renderGroup = this.modelRenderObjects.get( modelInstance.instanceId ); if (renderGroup === undefined) { - return false; + const displayedModelInstance = this.getDisplayedModelInstanceById( + modelInstance.instanceId + ); + + if ( + displayedModelInstance !== null && + displayedModelInstance.enabled && + displayedModelInstance.visible + ) { + this.addModelInstanceRenderGroup( + displayedModelInstance, + isModelInstanceSelected( + this.currentSelection, + displayedModelInstance.id + ) + ); + addedRenderGroup = true; + } + continue; } renderGroup.visible = modelInstance.visible; } + if (addedRenderGroup) { + this.applyShadowState(); + } + return true; }