Subject:
|
My attempts to get a vector line drawing
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Mon, 23 May 2011 22:21:33 GMT
|
Viewed:
|
19117 times
|
| |
| |
For various reasons, Ive been attempting to extract a vector line drawing of a
large LDraw model. On the surface, this would seem simple (which is always the
case for the hardest projects). LDraw itself is a vector format. Each edge
line is defined as a start point and an end point. To put a model on a screen,
any viewer has to transform those lines (translate, rotate, and scale), then
convert them to raster format for presentation on a monitor (unless your monitor
happens to be an old version of
asteroids). So I simply want to skip that rasterization step, and also skip
all the shading steps for the surfaces and write the result to some kind of
vector format like CGM.
But alas, the fates conspire against me. Ive been using LDView for my
experiments. To be fair, LDView probably doesnt do any rasterization, that is
probably done by the video card. What follows are my exploits in getting a
decent line drawing. Ill caveat that Ive reduced the resolution of all these
images and made them JPEGs for posting here. For purposes of this example,
well use set 8480, the space shuttle.
Step 1 is simply to tell LDView to use wireframe mode. If I do that, I get the
image below. There are several problems with this. The first (apart from the
distracting artifacts that I always get from belts in submodels) is that all the
lines are different colors which reflect the colors of the parts. Although
there is an all lines black preference, this has no effect on line drawings.
If I zoom in, we can see the next problem. Each stud (and any other round part
which uses a primitive) is not just a single edge but a whole series of them.
It looks better with primitive substitution off (shown) because then there are
only ~12 edges per stud instead of 48.
If I select show edges only, then everything goes to black as it should and
the studs are drawn correctly, but now hidden line removal doesnt work.
Clearly Im going to have to think outside of the box. If I go edit the MPD
file and force every part to be black (and delete the belts), then I get this.
This is with primitive substitution off, hidden line removal on, and show edges
only off. Not terrible, but still much too busy to be a good line drawing.
Then inspiration struck. What if I start with a shaded drawing and then convert
it to wireframe in post processing? So I made the following shaded image.
Because all the parts are black, all have the same line color. I did find that
having anti-alias lines turned on means that all the lines are not quite the
same color, so I shut that off.
Now I went into an image editor and used a color selector to select all the
lines. I then inverted the selection and deleted everything that wasnt lines.
Then I inverted again and filled the lines with black. It worked reasonably
well. At least it was the best so far.
The problem now is that all the anti-aliasing has been lost (by definition since
I turned it off), so the result is rather pixelated. I tried again, this time
by forcing LDView to export at an abnormally high resolution (3200x1800). I
also had to force the line width to be thicker so they could still be seen. Now
when I follow the same steps and then reduce the size of the resulting JPEG, it
ends up anti-aliased.
It looks pretty good. The problem is, it is still a raster image so it still
cannot really be scaled and it will still look lousy if printed on commercial
equipment. Im going to all this trouble to make a vector language look good as
a line drawing which should be a vector image, but Im forced to use raster
formats to do it. Surely someone must have a solution. I havent used LeoCAD
or SR3D. Can either of these help?
I also thought of using a different CAD package. For example, I use CATIA at
work and it can easily output a CGM of any geometry on the screen in seconds.
This is exactly what I want. LDView will export a 3DS file, but I dont have 3D
Studio Max and CATIA wont read that format.
One might rightly question whether the pursuit of a vector line image is really
worth anything. After all, one of the great benefits of a vector format is tha
ability to scale curves infinitely and still have them look good. But there are
no curves in LDraw. Even if I achieve my goal, all the studs will still be 48
sided polygons. But I have to try.
Any help would be appreciated.
Eric Albrecht
|
|
Message has 1 Reply: | | Re: My attempts to get a vector line drawing
|
| (...) <snip> (...) I'm not sure I 100% understand your goal(s), but I think what you need is: All white shading with all black edges. This way the (OpenGL) 'Z-Buffer' does all the hard work for you. Maybe travis could implement it in LDView, (or (...) (14 years ago, 23-May-11, to lugnet.cad, FTX)
|
13 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|