# Lookiing for an x3d viewer

**URL:** https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561
**Category:** Development
**Created:** [August 12, 2019, 5:38pm UTC](https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561 "2019-08-12T17:38:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [August 12, 2019, 5:38pm UTC](https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561/1 "2019-08-12T17:38:42Z")

</div>

Folks,

I’m fixing a bug in vtkX3DExporter. I can’t find an x3d viewer for MAC OS or Ubuntu. Can someone point me to a viewer that they have used? I’ve tried the x3d viewer plugin for chrome on both systems, but neither of display x3d files properly. They just show a plane and axes, but no model.

Bill

---

<div class="post-metadata">

### Author: ![JPouderoux](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jpouderoux/32/316_2.png) [@JPouderoux](https://discourse.vtk.org/u/JPouderoux)
#### Post date: [August 12, 2019, 10:20pm UTC](https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561/2 "2019-08-12T22:20:44Z")

</div>

Hi Bill,

I would suggest to pick one in the “official” list here: [https://www.web3d.org/x3d/content/examples/X3dResources.html#Applications](https://www.web3d.org/x3d/content/examples/X3dResources.html#Applications)  
I guess [instantreality.org](http://instantreality.org) is a good candidate.

Best,  
Joachim

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [August 12, 2019, 11:14pm UTC](https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561/3 "2019-08-12T23:14:50Z")

</div>

@JPouderoux, thanks. I tried several on that page but not Instant Reality. Just what I need!

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [August 13, 2019, 5:34pm UTC](https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561/4 "2019-08-13T17:34:07Z")

</div>

@lorensen, I have a working script to use VTK’s vtkX3DExporter that can send VTK render widows to X3D HTML which can be displayed in Jupyter notebooks or any web browser over in this (somewhat stale) pull request for PyVista: [https://github.com/pyvista/pyvista/pull/300](https://github.com/pyvista/pyvista/pull/300)

Here is a script to make HTML of a `vtkRenderWindow`:

```python
import vtk
 
X3D_JAVASCRIPT = '''
 <?xml version="1.0" encoding ="UTF-8"?>
 <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN"
 "http://www.web3d.org/specifications/x3d-3.3.dtd">
 <head>
 <script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'> </script>
 <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>
 </head>
 <body>
 {}
 </body>
 '''

def export_x3d(ren_win, binary=True, speed=4.0):
     """Exports the scene to an X3D (XML-based format) for
     representation 3D scenes (similar to VRML). Check out
     http://www.web3d.org/x3d/ for more details.
     """
     exporter = vtk.vtkX3DExporter()
     exporter.SetInput(ren_win)
     exporter.FastestOff()
     if speed:
         exporter.SetSpeed(speed)
     exporter.SetWriteToOutputString(True)
     exporter.Update()
     exporter.Write()
     return X3D_JAVASCRIPT.format(exporter.GetOutputString())

```

Then you could display that output in Python using:

```python
from IPython.core.display import display, HTML
display(HTML(the_output))

```

or you could save that HTML to a file and open it with any web browser

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [August 14, 2019, 8:37pm UTC](https://discourse.vtk.org/t/lookiing-for-an-x3d-viewer/1561/5 "2019-08-14T20:37:21Z")

</div>

@banesullivan thanks, but the instantreality viewer is all I need,
