External Renderers using vtk.js

1475
3
09-26-2019 12:02 PM
GuillermoVargas
New Contributor

I am trying to assess if it is possible to load a VTK.js rendering in a SceneView through the ExternalRenderer. Does anyone have guidance on how this might be done? Or has seen a project involving this?

0 Kudos
3 Replies
MatthiasThoeny
New Contributor

Hi Guillermo, can you try to shortly describe what part of VTK rendering you want to use? It will not be possible to use VTK's rendering api out of the box for several technical reasons. Integrating a part of the VTK.js functionality will be a low level effort similar to the example you can find using three.js (Use three.js from an external renderer | ArcGIS API for JavaScript 4.12). 

0 Kudos
GuillermoVargas
New Contributor

Hi Matthias,

Thank you for your response, I would like to use this specifically:

https://kitware.github.io/vtk-js/examples/VolumeMapper.html

I would like to be able to grab the output of the WebGL context from vtkjs and then draw it on the webgl context on a MapScene.

Do you have any experience with this?

I do thank you for the example you gave me, and I have been trying to follow those steps. The main issue is that I am somewhat unfamiliar with WebGL and do not know where in vtkjs should I grab the outputs and then send them to ArcGIS API.

Any help would be greatly appreciated.

0 Kudos
MatthiasThoeny
New Contributor

Hi Guillermo,

As far as I see this, there are two ways you could try this:

1.) Obviously, the first one is to use VTK as input source and implement the Volume Rendering by yourself. Guessing from your response this is the solution you wanted to avoid. However, there is a simple working volume rendering example in case you consider it:

https://esri.github.io/devsummit-2019-3D-jsapi/Advanced-WebGL-in-3D-SceneViews/External-Volume-Rende...

and the source code for this here:

https://github.com/Esri/devsummit-2019-3D-jsapi/tree/master/Advanced-WebGL-in-3D-SceneViews/External...

2.) If you can manage that VTK uses a externally provided render context for rendering it's images you might be able to use the VTK volume rendering. In this case, you could try to do everything in the same WebGL context provided by the external renderer, This would require you to:

  • ensure that all VTK ressources are loaded with the correct WebGL context (also framebuffers):
  • sync the scene state (e.g. give camera position to VTK)
  • call VTK render functions within our WebGL context 
  • use the framebuffer/texture for further processing

There is no ArcGIS API example for this implementation and from a quick browse over the VTK documentation it seems that it's not intended to be used this way. Best is to ask VTK support for more details about if and how that's possible at all.

All the best

0 Kudos