<div id="{{CONTAINER_ID}}" style="width:600px;height:400px;border:2px solid #333;"></div>
<script>
(function() {
  setTimeout(function() {
    try {
      const container = document.getElementById('{{CONTAINER_ID}}');

      // Use the simpler FullScreenRenderWindow helper
      const fullScreenRenderer = vtk.Rendering.Misc.vtkFullScreenRenderWindow.newInstance({
        container: container,
        background: [{{BACKGROUND_R}}, {{BACKGROUND_G}}, {{BACKGROUND_B}}]
      });

      const renderer = fullScreenRenderer.getRenderer();
      const renderWindow = fullScreenRenderer.getRenderWindow();

      // Add an angled directional light so specular highlights are visible
      const light = vtk.Rendering.Core.vtkLight.newInstance();
      light.setLightTypeToSceneLight();
      light.setPositional(false);
      light.setIntensity(1.0);
      light.setPosition(1, 1, 1);
      light.setFocalPoint(0, 0, 0);
      renderer.addLight(light);

{{ACTORS_CODE}}

{{ENVIRONMENT_CODE}}

      // Reset camera and render
      renderer.resetCamera();
{{CAMERA_CODE}}
      renderWindow.render();

    } catch(e) {
      console.error('Error rendering vtk.js scene:', e);
    }
  }, 300);
})();
</script>
