Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you are interested in producing a high-quality raytraced image from sage output, you should probably use special configuration of the raytracer directly. There is definitely more configuration we should allow in sage directly (choice of camera, some basic lighting options), but for really good results there will be no substitute.

Sage just writes a scene file for the tachyon raytracer. You can take that file and edit it. Here's how you can get such a file:

sage: var('x,y')
(x, y)
sage: G=plot3d(x^2+y^2,(x,-1,1),(y,-1,1))
sage: with open("T.dat","w") as F: F.write(G.tachyon())

Your next problem would be to figure out how to call the tachyon raytracer with such a file. SOmething like this would probably work:

sage: %system tachyon T.dat -format PNG -o T.png

Now you should have an image file T.png that displays your scene.

Your next stop is to read the documentation of tachyon http://jedi.ks.uiuc.edu/~johns/raytracer/ and edit the scene file T.dat to your liking.

Alternatively, you could look at different export methods, such as G.obj() and G.x3d() and see if mainstream raytracers such as blender can read one of them.