Re: [sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, So it seems there are 3 ways to go presently which are all somewhat complementary: 1. Hershey font (probably the easiest for me to implement in the short term) 2. Have SAGE generate bitmaps containing text, which are either: a) applied to 3-D objects in Tachyon via texture mapping b) composited with the Tachyon output image, by computing the 3-D to 2-D point projection, and inserting the bitmap wherever it falls in the image generated by Tachyon, replacing the existing pixels Regarding 2b): there isn't a 3-D to 2-D projection API currently. That's rather more similar to how a rasterizer (e.g. OpenGL) does things, sort of the inverse of how a ray tracer does it (generates a 3-D ray from a 2-D pixel location and does intersection tests to see what it "hit"). To add such an API I'd need to build in a bunch of new code to compute the projection matrix and compute the necessary transformation. The main drawback with this approach is that it won't work for any of the unusual camera models that don't assume planar/rectilinear image (e.g. fisheye, cylindrical, spherical, dome, etc). It could be made to work just fine for traditional orthographic and perspective projections however. If I implemented the full set of Hershey vector fonts in Tachyon, you would get a decent number of symbol glyphs, but you definitely wouldn't get the range of capabilities you've got now with generating bitmaps from latex. I can see that having one of the bitmap solutions would have high value and should be pursued regardless of the Hershey font feature. I think 1) and 2a) are not too hard to implement so we should try those first. Let me get back to you on this in a bit. Cheers, John On Fri, Feb 11, 2011 at 4:41 AM, Volker Braun wrote: > On Friday, February 11, 2011 4:52:09 AM UTC, robertwb wrote: >> >> If there was a simple API to map from a 3D point to a 2D point the >> rendered output, then it would be much easier to superimpose text >> ourselves. > > +1 > More importantly, for scientific publications people will invariably want to > use greek letters, exponents, fractions, ... as axes labels. > The only alternative to superimposing labels after the raytracing step on > would be billboard-style labels; Sage has already support for rendering > latex into bitmaps, so we could feed them easily as textures to tachyon. > > -- 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
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
I've posted the latest test version of Tachyon here, for those that want to give it a spin. I'm still working on updating the docs, but I expect to have that done in the next two weeks. http://www.photonlimited.com/~johns/tachyon/files/alpha/ Cheers, John Stone On Feb 10, 10:30 pm, John Stone wrote: > Hi, > > On Feb 6, 6:29 am, David Joyner wrote: > Hi, > > > > I was also curious what portions of the Tachyon APIs are > > > exposed in SAGE now, and whether it might be time to > > > Seehttp://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html > > Thanks. Can someone change the email address listed for me > from > the old one (jo...@megapixel.com) to the current one > (john.st...@gmail.com)? > > > > update SAGE to be able to take advantage of various new > > > Tachyon features such as ambient occlusion lighting and > > > other improvements that may not be exposed in the > > > current versions SAGE. > > > This would be great. One reason when the Sage documentation is > > vague (see for example > > texfunchttp://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html#s...) > > is that the tachyon documentation is incomplete. > > More examples would be very useful. > > I'm working on that currently. I will try and prepare a more > complete > group of example scene files and supporting text in the > docs > for the next release. > > > It would be cool to be able to map and image (eg, a file > > image of a Sage logo) onto an object (eg, a sphere) > > and put that over a mirrored plane. I remember trying to do that > > some time ago and getting stuck. Is that implemented? > > Yes, that's pretty easy to do. Have a look at lavablobs.dat > in > the tachyon/scenes directory for an old example of putting > an > image on a sphere in the Tachyon ASCII scene file > format. > Presumably SAGE can emit the necessary texturing parameters > to > do this as well. > > > I would also like it to be easier to create animations > > and other surfaces, such as hyperbolic paraboloids, in > > tachyon. I know tachyon can be used as a viewer for > > hyperbolic paraboloids, eg > > sage: x,y,z = var("x,y,z") > > sage: p = implicit_plot3d(x^2-y^2-z,(x,-2,2),(y,-2,2),(z,-2,2), > > plot_points = 75) > > sage: p.show(viewer="tachyon") > > but can one add, for example shading and textures, to this > > as a tachyon object? > > It is definitely possible to shade and texture any geometry > that > you provide to Tachyon. I'm not familiar enough with SAGE to > know > what parts of the Tachyon API are exposed or not, but I'll > begin > looking at the docs and see what I learn. > > > > I would also be happy to have a look at your existing > > > Tachyon code and see if I notice anything that might be added > > > or improved if you can tell me where to look for it. > > > Online, it is > > here:http://hg.sagemath.org/sage-main/file/f24ce048fa66/sage/plot/plot3d/t... > > In the Sage root directory, it is in devel/sage/sage/plot/plot3d/tachyon.py > > > Hopefully Tom Boothby and Marshall Hampton will weigh in as well > > with suggestions. > > Thanks, I will start looking at the Python code there and see what I > can learn. > > I am happy to provide interested parties with a copy of the bleeding > edge > version of the code if people want to give it a > spin. > > Cheers, > John -- 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
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, On Feb 6, 6:29 am, David Joyner wrote: Hi, > > I was also curious what portions of the Tachyon APIs are > > exposed in SAGE now, and whether it might be time to > > See http://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html Thanks. Can someone change the email address listed for me from the old one (jo...@megapixel.com) to the current one (john.st...@gmail.com)? > > update SAGE to be able to take advantage of various new > > Tachyon features such as ambient occlusion lighting and > > other improvements that may not be exposed in the > > current versions SAGE. > > This would be great. One reason when the Sage documentation is > vague (see for example > texfunchttp://www.sagemath.org/doc/reference/sage/plot/plot3d/tachyon.html#s...) > is that the tachyon documentation is incomplete. > More examples would be very useful. I'm working on that currently. I will try and prepare a more complete group of example scene files and supporting text in the docs for the next release. > It would be cool to be able to map and image (eg, a file > image of a Sage logo) onto an object (eg, a sphere) > and put that over a mirrored plane. I remember trying to do that > some time ago and getting stuck. Is that implemented? Yes, that's pretty easy to do. Have a look at lavablobs.dat in the tachyon/scenes directory for an old example of putting an image on a sphere in the Tachyon ASCII scene file format. Presumably SAGE can emit the necessary texturing parameters to do this as well. > I would also like it to be easier to create animations > and other surfaces, such as hyperbolic paraboloids, in > tachyon. I know tachyon can be used as a viewer for > hyperbolic paraboloids, eg > sage: x,y,z = var("x,y,z") > sage: p = implicit_plot3d(x^2-y^2-z,(x,-2,2),(y,-2,2),(z,-2,2), > plot_points = 75) > sage: p.show(viewer="tachyon") > but can one add, for example shading and textures, to this > as a tachyon object? It is definitely possible to shade and texture any geometry that you provide to Tachyon. I'm not familiar enough with SAGE to know what parts of the Tachyon API are exposed or not, but I'll begin looking at the docs and see what I learn. > > I would also be happy to have a look at your existing > > Tachyon code and see if I notice anything that might be added > > or improved if you can tell me where to look for it. > > Online, it is > here:http://hg.sagemath.org/sage-main/file/f24ce048fa66/sage/plot/plot3d/t... > In the Sage root directory, it is in devel/sage/sage/plot/plot3d/tachyon.py > > Hopefully Tom Boothby and Marshall Hampton will weigh in as well > with suggestions. Thanks, I will start looking at the Python code there and see what I can learn. I am happy to provide interested parties with a copy of the bleeding edge version of the code if people want to give it a spin. Cheers, John -- 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
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, On Feb 6, 3:31 am, "Dr. David Kirkby" wrote: > On 02/ 6/11 07:38 AM, Volker Braun wrote: > > Dear John& sage-devel, [trimmed...] > > 1) Use autotools/libtools to build a shared libtachyon in a portable manner. > > Like you, I quite like the autoconf/automake/libool approach. But I was quite > impressed with the number of targets that there was for Tachyon to build on > different systems. > > Tacyhon built easily on both AIX and HP-UX as soon as I'd added the relevant > bits in Sage's spkg-install to handle those operating systems. [...] > However, there was nothing suitable for a 64-bit build on Solaris, so I had to > add a target for that. I guess I should contact the author and let him know of > this. I'm puzzled by this, there are actually a very large number of (something like 10) 64-bit Solaris targets in the regular Tachyon Make- arch file. Have you looked within the Make-arch file? I would be curious to know what you needed that wasn't there. I'm happy to share my pre-release sources for the next Tachyon so people can give me feedback and I can address any issues that linger here. Cheers, John > I've no idea of what functionality of Tachyon is exposed in Sage. I've not > used > the program, but the web site has some pretty impressive looking demos. > > Dave > -- > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > A: Top-posting. > Q: What is the most annoying thing in e-mail? > > Dave -- 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
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
I've pondered adding text rendering as a built-in feature of Tachyon, but up to this point I have resisted due to the complexity involved. (whatever font set I would choose would undoubtably not be exactly the right thing for any particular usage). The best way to do this is usually to build the font code into the calling application, as it can be used with multiple renderers and the rendered images can be made to look exactly the same whether OpenGL, Tachyon, Renderman, POV-Ray, etc. This is what I've done in VMD, the molecular visualization tool I develop in my day job. In VMD, I use one of the public domain Hershey vector font sets, with two simple APIs, one generates OpenGL rendering commands, and the other is setup to be called to generate the vector font strokes on-the-fly by any rendering API one would want. Using this scheme, VMD generates line-based renderings within OpenGL, and uses sequences of connected cylinders and spheres in ray tracers or other renderers that don't have an exact equivalent of a "line". Here are relevant VMD source files as examples: Hershey.h: http://www.ks.uiuc.edu/Research/vmd/doxygen/Hershey_8h-source.html Hershey.C: http://www.ks.uiuc.edu/Research/vmd/doxygen/Hershey_8C-source.html TachyonDisplayDevice.C (see the ::text method therein): http://www.ks.uiuc.edu/Research/vmd/doxygen/TachyonDisplayDevice_8C-source.html#l00153 I could add the Hershey Roman font I use in VMD into Tachyon pretty easily, but it might be an even better idea to build this into SAGE itself. What do others think? Cheers, John Stone john.st...@gmail.com On Feb 6, 3:11 am, Robert Bradshaw wrote: > IIRC, the ability to easily do text labels is something that is > missing right now. It would be great to be able to attach some text to > a point (we don't need shadows or anything fancy). We could probably > even do this ourselves if there was an easy API to go from 3D point to > 2D point in the output. > > - Robert > > On Sat, Feb 5, 2011 at 10:40 PM, William Stein wrote: > > Hi, > > > I have permission from the author of Tachyon to forward his message > > below to the Sage list. He's basically interested in whether there is > > _anything_ he could do to make Tachyon more useful for Sage. See > > below. > > > -- Forwarded message -- > > From: John Stone > > Date: Tue, Feb 1, 2011 at 10:56 PM > > Subject: Feedback on Tachyon APIs used by SAGE, etc.. > > To: William Stein > > > Hi William, > > I'm in the process of doing a bunch of updating of the > > Tachyon header files and documentation and thought I'd send a > > quick ping. I was wondering if the SAGE project wants or needs > > anything changed or improved in the Tachyon APIs, since I'm already > > doing some significant improvements for other projects. > > > I was also curious what portions of the Tachyon APIs are > > exposed in SAGE now, and whether it might be time to > > update SAGE to be able to take advantage of various new > > Tachyon features such as ambient occlusion lighting and > > other improvements that may not be exposed in the > > current versions SAGE. > > > I would also be happy to have a look at your existing > > Tachyon code and see if I notice anything that might be added > > or improved if you can tell me where to look for it. > > > Cheers, > > John Stone > > > -- > > NIH Resource for Macromolecular Modeling and Bioinformatics > > Beckman Institute for Advanced Science and Technology > > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 > > Email: jo...@ks.uiuc.edu Phone: 217-244-3349 > > WWW:http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078 > > > -- > > William Stein > > Professor of Mathematics > > University of Washington > >http://wstein.org > > > -- > > 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 > > athttp://groups.google.com/group/sage-devel > > URL:http://www.sagemath.org -- 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
[sage-devel] Re: Fwd: Feedback on Tachyon APIs used by SAGE, etc..
Hi, I sent this to Volker off-list already, but now that I can post, here it is for others to read: Volker, Thanks for the suggestions. The shared libtachyon via autotools is probably a good idea, though it would only be usable for the non-MPI builds. MPI programs must always be compiled from source unless one uses something like "MorphMPI" that simulates an ABI to abstract the native implementation. I will see about doing this later this spring after I'm done with the rest of the heavy lifting I'm doing getting the new version of Tachyon ready and releasing it concurrently with the new version of VMD... Rendering to a memory buffer is trivial, and no, you don't need any OpenGL headers or anything like that, the core Tachyon library is independent of the supplied standalone driver program and OpenGL demo programs in the "demosrc" directory. To render to a memory buffer you would want to use one of these two APIs: / ** * Request Tachyon to save the output image in the specified * memory buffer, in raw 24-bit, packed, pixel interleaved, unsigned char * RGB bytes. The caller is responsible for making sure that there * is enough space in the memory area for the entire image. */ void rt_rawimage_rgb24(SceneHandle, unsigned char *rawimage); / ** * Request Tachyon to save the output image in the specified * memory buffer, in raw 96-bit, packed, pixel interleaved, 32-bit float * RGB bytes. The caller is responsible for making sure that there * is enough space in the memory area for the entire image. */ void rt_rawimage_rgb96f(SceneHandle, float *rawimage); So, for a 24-bit RGB image, Tachyon expects you to send in a pointer to a packed 24-bit RGB image buffer. You'd allocate the buffer and pass it to Tachyon in a code sequence like this: rt_resolution(scene, width, height); unsigned char *rgb24 = (unsigned char*) malloc(width*height*3); rt_rawimage_rgb24(scene, rgb24); The aperture option/API is going to change, so I will probably not document it quite yet, but if you want to fool around with that I would be happy to help you play with the existing code until I'm happy with how it works. I am in the process of massively updating the Tachyon docs and header files to make this all easier to follow. If you want, I can send you and any other interested parties a current snapshot for you to play with. Cheers, John Stone john.st...@gmail.com On Feb 6, 1:38 am, Volker Braun wrote: > Dear John & sage-devel, > > I looked into libtachyon on Sage a while ago. Right now, we don't > build the library because tachyon already isn't that easy to build > without manual intervention. Sage only drives tachyon through > temporary files at the moment. Clearly, that is not ideal. My wishlist > would be > > 1) Use autotools/libtools to build a shared libtachyon in a portable manner. > > 2) I know that there is a way to render into a memory buffer, but I > haven't understood it 100%. I'm not sure if building it currently > needs OpenGL headers; If possible, we would like to avoid that > dependency. > > 3) Documentation would be nice ;-) For example we haven't quite been > able to figure out the aperture option, > seehttp://trac.sagemath.org/sage_trac/ticket/9855 > > Best wishes, > Volker -- 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