Hi, Thanks to the pointer to Pre3d it is now possible to do shaded surfaces (and lines and curves) on canvas in JavaScript. The performance is not quite like jmol, but it is far better than I would have expected (especially with Chrome), and it has the advantage of working on the iPhone (and perhaps Android -- can someone with an Android phone please check?). The surfaces display in IE, but mouse- tracking is erratic at the moment. Texture mapping is also possible, but not yet exposed to Sage.
See http://math.chapman.edu/~jipsen/canvas/pre3d/demos/sage2pre3d.html for a standalone html version, or http://sage.chapman.edu:8001/home/pub/5/ for (lots of) surfaces produced by Sage (try putting that many jmol applets on one html page :-) I have modified the Pre3d .js files to be a drop-in replacement of canvas3d_lib.js. Basically this meant combining them into a single file called canvas3d_lib.js, adding code to parse Sage json files, extending Sage and Pre3d to handle lines, opacity, and tweaking Pre3d to shade both sides of the surface etc. In order to be efficient, Pre3d takes some shortcuts that imply certain limitations. E.g. intersecting faces do not get split automatically into subfaces, so intersections of surfaces are jagged. Also lines are drawn on top of surfaces (so no hidden line removal). There are two patches that need to be applied to Sage-4.1.2.rc0 to make this viewer="canvas3d" option work: http://math.chapman.edu/~jipsen/canvas/pre3d/demos/canvas3dmods.patch and http://math.chapman.edu/~jipsen/canvas/pre3d/demos/canvas3d_libmods1.patch The changes to files in sage/plot/plot3d are just a couple of lines and should be easy to review (if this is to be put on some trac ticket). Any feedback is appreciated. I'm interested in a good format for adding translational and rotational velocities to 3d shapes so that the .js renderer can do animations. -- Peter --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---