Tachyon3d is a raytracing program that has served Sage very very well
for easy-to-produce
standalone fast simple 3d raytracing. It was written by a chemist for
visualizing molecules, etc.
I found a page (http://www.openscience.org/blog/) that recommends Sage,
and when scrolling down it noticed that it had a very
solid no-install-needed lightweight but extremely high quality and
tasty molecule of
caffeine embedded in it. Following the link I found
which is a totally frickin' awesome 3d Java chemistry visualization toolkit.
If you've been following the large amount of brainstorming about 3d graphics and
Sage over the last few weeks, definitely check out that above link,
and links like this:
http://jmol.sourceforge.net/#What%20the%20critics%20are%20saying
Definitely try this out:
http://jmol.sourceforge.net/demo/
it is very very impressive.
Yes, it appears to be aimed at chemistry, but if you look at the
examples, and at the API
documentation, you'll see that it's somewhat similar to tachyon, and
has things like:
---------------
pmesh meshID [option] "filename.pmesh"
With the pmesh command you can add one or more surfaces to a model.
The pmesh command is
similar to the isosurface command in terms of options. The pmesh
command takes the overall format...
---------------
So, just as with Tachyon, it's conceivable that jmol could be just the
right tool for the job, finally.
We shall see.
By the way, a large amount of the work that Robert Bradshaw put into
3d graphics and Java3d
last summer was really in writing fast Cython code for generating 3d
models from scene
descriptions (building on work of Tom Boothby and Josh Kantor). That
same work would carry
over to jmol.
-- William
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
- Robert
There is an amazing amount of mathematics, especially combinatorial
structures, etc., for which those sorts of things might be quite
good for us.
By the way, I just got it to work in Sage via the following nutty sequence
of hacks (see attached screen shot):
(1) download the jmol binary
(2) start sage and a worksheet that for me happens to have files here:
/Users/was/.sage/sage_notebook/worksheets/admin/20
(3) Put a symlink from the jmol binary directory to
/Users/was/.sage/sage_notebook/worksheets/admin/20/data/jmol
(4) Put some sample data files in
/Users/was/.sage/sage_notebook/worksheets/admin/20/data/
(5) Put the javascript file in there:
/Users/was/.sage/sage_notebook/worksheets/admin/20/data/Jmol.js
(6) Put this html in a worksheet (via edit):
<script src="data/Jmol.js"></script>
<script>
jmolInitialize("data/jmol");
jmolCheckBrowser("popup", "../../browsercheck", "onClick");
</script>
<center>
<script>
jmolApplet(500, "load data/plot2.xyz");
</script>
</center>
(7) Switch back to Use mode and write data out to plot2.xyz, see the
screen shot or use this script or write your own:
z = ['H %s %s %s'%(i,j,cos(i)*sin(j)*4) for i,j in
cartesian_product_iterator([[1,1.5,..10], [1,1.5,..10]])]
s = """%s
Random
"""%(len(z))
s += '\n'.join(z)
open('../../data/plot2.xyz','w').write(s)
(8) Press refresh on the browser.
Anyway, you might want to try something crazy hackish like
above first, since it doesn't take long, before trying to do things
right.
Yes, jmol is good, I wrote some parsing of cif crystal formats in
jython into it (3 years ago) and the source code is quite
understandable. But I hate java, that's why I used jython, but jython
was quite slow to load at that time.
Something like jmol is the way to go imho.
Ondrej
> On Dec 14, 2007 3:14 AM, Robert Bradshaw
> <robe...@math.washington.edu> wrote:
>>
>> I am extremely impressed! It seems to be specifically optimized for
>> rendering molecules, but I'm going to write an exporter for our 3d
>> shapes as meshes and see how well it does.
>
> There is an amazing amount of mathematics, especially combinatorial
> structures, etc., for which those sorts of things might be quite
> good for us.
Yes, for sure. The fact that it natively handles spheres (and
cylinders) is a big plus.
> By the way, I just got it to work in Sage via the following nutty
> sequence
> of hacks (see attached screen shot):
It was pretty easy to add pmesh output to IndexFaceSet (which
underlies all triangulated shapes). I haven't gotten much further
than that, but one drawback is that it seems we might need a bunch of
separate files to represent a single object. (Of course, it is open
source, so we could define our own conglomerate format. Also, perhaps
we could pass them around as a single zipped file (both python and
java have pretty good support, and it would compress the highly-
redundant format as well).
It starts to get sluggish at 20 tori (<1K polygons each), wheras the
OpenGL stuff doesn't break a sweat until the much, much higher. I
don't see any options for controlling lighting, and the camera seems
much more limited too.
Being pure java is a huge plus though, as is it being maintained,
used, and developed by a larger audience. And it's pretty Got to hand
it to those chemists!
- Robert
Wow. This is *really* neat. It's even got an option so you can look at the model through 3d glasses! (search for stereo in the docs)
This could kick butt for the AMS meeting if we can get it to display
mathematical images.
- William
That is certainly my plan.
- Robert
Damn it, I can't wait to try this out!!
:-)
> > <capeman.png>
> >
> > and in stereo (we really should order some red/blue glasses for
> > demos).
> >
> >
> > <capeman-stereo.png>
- Robert
Have you ordered any 3d glasses yet? If not, I'd be happy to do so
(I'm assuming I could get reimbursed, but they're not very expensive,
like $20 for a pack of 40.)
- Robert
I have ordered any yet. Robert -- definitely go ahead and order them.
This will *rock* for the AMS meeting.
William