The Personal Web Pages of Chris X. Edwardsvmaster - 3d Vector View Master |
Some example output:
vmaster is a sophisticated 3d to 2d vector filter written entirely in C++.
The first thing I had to decide is how would the model be defined. The primary purpose of vmaster is to create views. This is a different task from being a CAD system or other engineering software with a higher purpose. I only really wanted to concentrate on 3d model elements that had a bearing on a view. For example, a cylinder may be modelled as a cylinder in some kind of engineering software, but when it's time for viewing the cylinder, the software must decompose the cylinder into simpler elements before passing them to vmaster.
The elements I chose to use were basically the element that is visible, lines, and the element which creates opaque barriers to visibility, triangular faces. As far as I can tell, all vector model scenes can be defined with these two things. The vmaster input allows for lines, trifaces, and the points that define them. Note that the points have no validity as stand alone entities. They can't be output as dots.
The data input is very flexible. It basically consists of one or more text streams that have one element per line. Each line consists of a delimited group of numbers. The number of numbers controls which element is being specified. For example, if there are two numbers, then the it is interpreted as two endpoints of a line.
One of the keys to the flexibility is the parsing routine. The general strategy is that characters that aren't relevant get replaced with spaces and spaces are the delimiters. This means that whatever crazy syntax your input may have, there probably isn't a lot that needs to be done with it to make it work out. Certainly a quick visit to the sed command should be able to cure any problems.
Data can be specified as files on the command line or piped in using the finest Unix traditions. Output is fairly generic and can be used as you see fit, but it is designed to work well with my program gradu (graphics dump).
One nice feature is that redundant entities are handled well. If you send in a line that goes from point A to point B and another from B to C, B is only stored once. This insures that rounding nonsense doesn't walk the two points away from each other. It also allows (in theory) for a quick transformation of the entire model which is a primary element of what this program is all about.
vmaster features two very nice hidden line removal strategies. The first is where a triangular face (opaque) obscures a line or part of a line. This is a standard HLR system. I even added a nice system to properly handle lines that pierce the middle of triangular faces. The second HLR idea is what I call the shallow angle cull (there must be a real technical name for it). This is eligible when exactly two triangle faces share 2 points in common and the same 2 points also define a line. If this is the case and the angle between the two faces is below a supplied threshold, the line between the common points is not considered. The exception to this rule (and therefore the only reason to supply such data) is if the line in question makes a defining edge. This means that cylinders which are aproximated as extruded polygons come out looking like cylinders, not Greek columns.
I think that there are some times where the HLR doesn't work, but I've been getting really good results with some pretty complex things, so I'm feeling pretty good about it. Still it needs more testing and fixing. I think it's especially vulnerable on the boring views anyway. This means that orthogonal head on shots (gulp! the default!) are possibly going to be ugly.
It is only 31kB. It doesn't include any samples right now, but I'm working on that.
Also, you can check out the capabilities of vmaster by looking at the html man page for vmaster.
Return to Main Page *** Return to Program Page |
This page was created with only free, open-source, publicly licensed software.
This page was designed to be viewed with any browser on any system. |
Chris X. Edwards ~ May 2002 |