VRender Library
Presentation
The VRender library is a simple tool to render the content of an OpenGL window
to a vectorial device such as Postscript, XFig, and soon SVG. The main usage of
such a library is to make clean vectorial drawings for publications, books, etc.
In practice, VRender replaces the z-buffer based hidden surface removal of OpenGL
by sorting the geometric primitives
so that they can be rendered in a back-to-front order, possibly cutting them into pieces to
solve cycles.
VRender is also responsible for the vectorial snapshot feature of the QGLViewer
library.
Main features
- use is made easy by just passing the drawing function to the library
- a clean ε-calculus is used to correctly position and cut primitives so as
to avoid unnecessary precedence relationships between primitives, as well as properly
sort edges included into polygons.
- usually produces postscript files of size 10 times smaller than what
usual vectorial rendering libs produce by using a simple BSP.
- supports some optimizations such as true hidden surface removal.
- multiple sorting algorithms are implemented, from no sorting at all to a
clever topological sort which only cuts the necessary primitives.
- thanks to its modularity, extending the library with additional
vectorial formats is a piece of cake.
Important note
The VRender library is entirely available as a part of the QGLViewer library. For most uses,
you will have better use QGLViewer directly. Otherwise, you still can get VRender separately. Note that
QGLViewer compiles under windows, mac and linux, which is not necessarily the
case for the distribution of VRender I give here. However, the most recent version of the sources are
here, so linux users will still take advantage to it.
Compiled library
Here is a compiled version of the library for Fedora Core 2:
Source code
The source code can be obtained there. It should compile easily under any linux provided that you have qmake:
Compilation instructions:
|
Get the sources, un-targz, type qmake and make. If you don't have qmake, try using the existing makefile. |
Output examples
Click on the examples below to get and see some postscript files generated by VRender.
Please read the note about postscript display to avoid seeing bugs were there is
not (I would not show the images otherwise). For windows users, eps files have been converted to pdf format
using acrobat distiller.
|
|
|
|
50 random triangles with edges (Deadly test for BSP) |
Classical teapot with Gouraud shading. Note that line/polygon sorting is robust, and
that hidden faces/lines have been carefully removed. |
Illustration in a paper of my own. The characters where added to the postscript in a second pass using XFig. |
Rendering of a model which does not require polygon splitting. In this case, the
topological sort algorithm works nice. |
Limitations
- the free version is limited to render only 10 triangles at most. Noooo!! I am joking. You
can render millions and everything is free.
- sometimes, but not often, I got crashes with the advance topological
sort method on big scenes.
In any case, using the BSP sort method works, so it can be used in replacement, although it produces a
significantly larger output file.
- I did not include PASS_THROUGH tokens, so one can not change point and
line size in the middle of a drawing. This is part of the philosophy not to
require the user to modify his rendering algorithm when he wants to output to
postscript. The side effect is that textures, and point/line width are not accounted for.
Acknowledgements
Many thanks to Fédéric Delhoume for providing the postscript
gouraud-shading triangle code, and to Alan Murta for the
general
polygon clipping library.
Remarks/questions/improvements are welcome and can be
sent to the adress at top of this page.
Latest news
June 23, 2005 |
Birth of the web site. |
|
Last modified on Thursday, March 3, 2005.