Pantograph: ANOTHER vector rendering engine

I wanted to share the humble results of what I’ve been working on this summer: a vector rendering engine aimed at producing high-quality architectural/engineering drawings. The intention is eventually to port it to Maya, which explains some of the hoops I jumped through - it has a lot of dependecies to keep it somewhat independent of the Blender platform:
GTK/PyGTK
Cairo
cgkit

In theory, all of these are cross-platform libs, so it should be able to work on Mac and Windows too. Cairo should be able to output to PDF, PS, SVG as well as raster formats.

When I get a GUI going I’ll post the code…right now the big bottleneck is the BSP sorting (no big surprise there)…I just got the sorting/splitting to work correctly, so things are still a little ugly.

I’m more interested in good linework than complex shading right now, and having good control of lineweight. I’d also like to implement a clipping plane/sectioning tool for cutaways.

Here’s everybody’s favorite low-poly monkey (the crease lines are a bit hackish still):

RS
http://severnclaystudio.wordpress.com

sorry…a question from a newbie: are you making another rendering engine?..hmm like yafray, or indigo, or maxwel?

garuhhh,

No, more like Swift3d. The problem raster images (as are produced by Blender Internal and Yafray), is that they cannot be scaled, or converted easily to vector formats like Illustrator, Autocad DWG/DXF, or SVG. The “Toon Edge” rendering styles are fine for concept images, but they don’t cut it when you need to bring them into a CAD program.

RS

Sorry the monkey’s so large…I thought it would thumbnail or something when I inserted the image URL

Did you see VRM?
Have a look at this thread, maybe your renderer is the best fit for the job?

khiraly1,

Yes (note the subject line) - there are a couple of them out there - have you used VRM?

I looked at your thread, and that’s exactly what I’d like to do! Do you mind if I use your STL file as a test? Suzanne’s a little more curvy than the sort of stuff I’d like it to do.

RS

khiraly1,

Here’s a test from you STL file (I hope that’s ok):

There’s some funny stuff in between split triangles - I’m hoping to optimize that a bit for the SVG/PDF/PS output.

RS

You can use this stl file of course. You can however download more .stl file from here:
svn co https://reprap.svn.sourceforge.net/svnroot/reprap

These are parts of this machine:
http://reprap.org/pub/Main/AssemblingDarwinMachinery/Assembly.JPG

I have tried to use VRM yes. But I have two concern with it:
the precision is dependant from the camera zoom
it renders all the triangle impedently.

However I hade success today!: I colored the faces of the object, and exported. The exported .svg looks like this:
e-9.svg

The tweaked one is here:
e-11.svg

http://khiraly.googlepages.com/e-11.png

Just use the inkscape’s Find tool! (Edit->Find, style attribute)
I finished this .svg file in 2 minutes!

I have tried to use VRM yes. But I have two concern with it:
the precision is dependant from the camera zoom
it renders all the triangle impedently.

What do you mean when you say the scale is dependant on the camera zoom? You should be able to scale an orthographic image by one of the known dimensions, yes?

RS

I tried from the same viewpoint as you:
http://khiraly.googlepages.com/reprap-2.png

However, I didnt finished it. Here is the .svg file:
http://khiraly.googlepages.com/reprap-2.svg

Feel free to play with.

What do you mean when you say the scale is dependant on the camera zoom? You should be able to scale an orthographic image by one of the known dimensions, yes?

I mean the precision. The vrm stores the coordinate 3 decimal precision, like this:


<path d="M 567.797,235.616 L 472.169,254.69 282.543,316.82 z"
  style="fill:#720000; stroke:#720000;
 stroke-width:1.0;
 stroke-linecap:round;stroke-linejoin:round"/>

So if the object is far from the camera, the small curves wont be perfect curves.

khiraly,

I’m still confused - looking at the SVG files, I don’t see any curves, just polylines. Can you post an example?

If you render it with an orthographic camera, objects close to the camera will be the same size as those farther from the camera, right?

It looks like there’s some hidden-line errors in the drawing - is that coming straigh out of VRM, or has it been cleaned up?

RS

This was so easy I don’t know why I didn’t figure it out a lot earlier…

Yes you are right, the .stl file has only polylines and no curves.

But look at this picture:
http://khiraly.googlepages.com/precision.png

It should be an oval. I examined more carefully, and there is no problem. Its not oval, because the .stl file was not either. Sorry for the confusion.

Your last picture its just excellent. Can you post the exported .svg file too?

(i will be offline for the next week. I really liked our collaboration. Thank you very much!)

Ok, Im back.

rocketship:

  1. can I download your pantograph script? (to play with)
  2. can you post the .svg file please?

Was there any progress?
(I would like to see (instead of dotted line) have different colours (and alpha value) for tha surfaces.

Personally I think it could use a little more anti-aliasing.

khiraly1,

Sorry, I’ve been putting a GUI on it so it’s a little more useful! I’ll post it when I get a chance.

I haven’t tried the vector output yet - it shouldn’t be a problem with the Cairo library, but I have yet to see the quality.

Alpha values are no problem - with the GUI you can now set the color and alpha of the different linetypes and fills.

Are you running Linux? In theory all of this stuff is portable to OSX and Windows, but I haven’t crossed that bridge - I would love to get a cross-platform tester.

RS

M. Crunchy -

Its a screenshot. I agree, though… actually, I think in Cairo you can change the anti-aliasing, though the vector output is more important to me. I’ll look into it.

RS

I’m running Mac OSX, and I’d be willing to test it out. But you’d have to have patience and explain what I need to install it.

daredemo,

Thanks! I’m hoping to have things ship-able this weekend - I’ll write up a quick installation document with it.

RS