By far the easiest way I have found to integrate 3D graphics into a web page is by using the x3d with x3dom. See reference 1.
Specifically, x3d is a well-known and well-standardized language for describing 3D shapes, closely related to the earlier VRML. The x3dom package consists of a lot of javascript plus some css that allows you to render x3d in a browser.
Getting started is as easy as it possibly could be. Start with a working “hello world” example, either a .x3d file or a .xhtml file. Then edit it by hand to add features.
You can view your .x3d results using the view3dscene program, and view your .xhtml results using a web browser.
To incorporate 3D diagrams into an existing web page requires some fussing, but the process can be automated, as discussed in section 3.
I’ve tried a lot of other approaches, but all the others were
Mouse-Drag | : | Rotate |
Ctrl-Mouse-Drag | : | Pan |
Alt-Mouse-Drag | : | Zoom |
r | : | Reset view |
To use it as a diagram on a web page, splice the x3d code into your web page and use x3dom. This is mostly straightforward, except for the fact that x3dom insists on XHTML, which is a dialect of XML, rather then straight HTML. Specifically:
You can easily deal with all those issues by reading your html into perl using HTML::TreeBuilder and writing it back out with the appropriate options. Then you can splice in the x3d code.