0

How can I embed a 3D file into HTML for it's rendering on the web browser?

I want to do something like this

<!doctype html>

<html lang="en">
<head>
  <!-- stuff -->
</head>

<body>
  <!-- stuff -->
  <canvas>
    <X3D profile="Interchange" version="3.2"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
     xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.2.xsd">
      <Scene>
        <Shape>
          <IndexedFaceSet coordIndex="0 1 2">
            <Coordinate point="0 0 0 1 0 0 0.5 1 0"/>
          </IndexedFaceSet>
        </Shape>
      </Scene>
    </X3D>
  </canvas>
  <!-- stuff -->
  <script src="js/scripts.js"></script>
</body>
</html>

I have a script that manipulates 3D models and then generates web reports. These reports are always seen offline.

I know there are javascript libraries that allow you to do this. The problem is that neither the reports nor the models are hosted in a web server and you can not have access to local-files from javascript (I'm not changing chrome's file access permissions ;) ).

I want to be able to distribute the html files for people to see them offline without having a web-server available. I can generate the 3D models in any format I want (X3D in the above example) as long as it gets rendered in the browser.

It would be preferred if the model was embedded in a declarative way using markup-only, but also javascript is acceptable.

Community
  • 1
  • 1
ButterDog
  • 5,115
  • 6
  • 43
  • 61
  • maybe I'm missing the point. Here is an example of embedding 3d objects (WRL in this case) in HTML pages: http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0009.htm – Traian Jul 15 '14 at 05:10
  • Doesn't seem to work on chrome (it just downloads the `.wrl` file) – ButterDog Jul 15 '14 at 08:08
  • it means that you don't have any chrome plugin able to interpret .wrl files. As a result, the browser downloads the file.. – Traian Jul 17 '14 at 11:20
  • That makes sense, it could work, I just want to avoid asking users to install plug-ins. Thanks! – ButterDog Jul 17 '14 at 11:40
  • Oh well, of course you want to avoid this! But as long as the Browser does not come with the required plugin by default, that is the only way to have it working. Think about the flash plugin, long ago the browser would have asked you whether you want to install the plugin when you were about to access a page where flash content was available. – Traian Jul 18 '14 at 09:31

0 Answers0