Render 3-D Wireframe to Postscript?
W88 writes "I am very familiar with the 3-D rendering packages available including Blender and POVRay, but I am looking for something a little different. I am writing a paper that could benefit significantly from some three dimensional projected views of a fairly complex apparatus. I can easily model the apparatus, but do not want rendered bitmaps in the paper (I am using pdflatex). I would prefer edges with hidden lines removed rendered to a vector format like EPS or PDF (or even FIG). Has anyone seen anything like that? A web search turned up something called hlp that appears to be public domain from NASA but it is only available on a $300US CDROM from Public Domain Aeronautical Software." Note that any software created by the U.S. Government can be obtained with a Freedom of Information Act request, probably for less than the PDAS guys are charging.
Starting point in "rendereps.c" part of the stock GLUT examples from Mark J. Kilgard.
Try converting your models to Gnuplot format and converting to PS with that. It probably won't handle perspective, but it does orthographic and isometric projections just fine.
sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
http://reality.sgi.com/opengl/tips/Feedback.html
http://www.easysw.com/~mike/opengl/
Adobe Dimensions (wireframe and other 3D to postscript)
An SGI Article on how to render OpenGL to postscript (with examples and source)
GLP (another OpenGL to PostScript app w/ source)
Adobe Dimensions is probably your best bet. Hope one of them works for you.
--
He had come like a thief in the night,
Si hoc legere scis nimium eruditionis habes
With a little inginueity, and a copy of the book "thinking postscipt" (now a free download off the web), you can easily write own own 3D renderer in Postscript in an hour or so. Just think of drawing your figures as a series of planes. Then, each plane going away from the viewer gets scaled downwards. For transformations, all you need is a little algebra and trig. In some ways, this is a particularly elegent way of doing 3D wireframe because your are letting the printer do the work. With the OpenGL to PS solutions other recommend, the printouts are sent to the printer as a bitmap.
If you want hidden surface removal, then you might as well use the GL to PS solutions that others suggest.
I'm a loser baby, so why don't you kill me.
It may or may not be what you need, but Rhinoceros has a feature like the one you describe. There is a 'draw2d' function that takes the current view, and makes an isometric-style line removed flat 2-d drawing. This can be easily converted to dxf, and a host of other formats. I'm unsure of the ability to output to ps, or whether or not it can do this with a wire-mesh (triangulated-non-NURBS model). I have used it on engineering projects, and the complexity that can be easily acheived left some stunned.
www.rhino3d.com
Constitutional rights may be respected, repealed, or modified; but they must never be ignored.
It is not clear exactly how much control you have of the system and where you want this software to take over.
However, the fig2dev program is able to translate fig files (generated by xfig) to any number of formats -- eps among them. The fig file format is pretty straight forward vector graphics, so all you need to do is decimate all the surfaces to triangles, rotate the figure, sort the surfaces in z-depth order, and dump it to fig format.
fig2dev makes an eps file, and then you let the printer take care of it. Filled polygons is something a postscript printer can draw in its sleep; hidden surface removal becomes moot.
Someone already suggested the OpenGl -> PS library, but my suggestion has the benefit of requiring almost no APIs at all; just rotate, decimate, sort, and dump to file.
Johan
Unfortunately, I don't think it can do hidden lines. Also, it costs money. However, it is easy to use.
GMT, the Generic Mapping Tool perhaps. The page does mention quite an assortment of processing possibilities, including 3-D coordinates and surface rendering.
- My example will be a wireframe of a sphere, with North pointing in the positive up (Y) direction.
- You are storing points along the lines which, when drawn, form a latitude ring (NtoS).
- Then, after bisecting the sphere into horizontal slices, you draw longitudinal rings (EtoW).
- You already know how to do the world-space to viewport transformation of all your data points. (ie orthoganal correction, etc)
I assume this since that's probably how you get the lines to connect in a meaningful format. To solve the problem, we will borrow some of the techniques from OpenGL without having to use OpenGL.struct lat_ring {
struct lon_ring {
struct vertices {
double x; double y;
lon_ring *lonr;
lat_ring *latr;
};
These techniques, while hinted at by others and only briefly outlined by me all take a lot of work for something so small. If you don't have the time, I hope you have the money. If you have neither, I hope you like your bitmaps.
One little beast which may rear it's ugly head on you is the case of intersecting polygons. In short, the only way to handle this in the vector sense is to bisect the two polygons into extra pieces (usually four, but sometimes three, when rendering with triangles or rectangles). This sounds easy in concept until you realize that every polygon has to be tested against every other polygon for intersection. The check, however simplified is complex and computationally expensive. Try and find a way to avoid having bisected polygons and you can ignore this problem.
Hope this helps. Also, recommend you check out the Computer Graphics Gems book series.