Loading...
Logo
Processing Forum
Hi,

I'm drawing in 3D with P3D and using beginRaw() and endRaw() to export to Pdf.

I'm drawing some (very very simple) shapes that I load with loadShape(), I draw them with noStroke(), fill(0) on a white background, and shape().

Everything works fine, except that in the output pdf you can see the triangles the shape is (automagically) decomposed into. INSIDE the black-filled shapes you can see superthin white edges for each triangle.

Is there a way I can this? Otherwise this renders beginRaw/endRaw pretty useless...

Thanks in advance
m.

Replies(6)

I ran into the exact same problem last week. Anybody can easily see this error by going to Examples -> (Core Libraries) -> PDF -> Complex 3D. It certainly does make beginRaw() useless.
 
I'm pretty sure this is Issue 53, although, I don't see these internal lines in the sketch window or using save() or saveFrame(). So, if they are indeed the same issue, then the problem is well known.
Yeah, that's weird. According to the bug report and comments, the issue should exist also in the sketch window; however I only see it on PDF output.

Is there any feasible workaround?
See http://processing.org/reference/libraries/pdf/index.html
To create vectors from 3D data, use the beginRaw() and endRaw() commands. These commands will grab the shape data just before it is rendered to the screen. At this stage, your entire scene is nothing but a long list of lines and triangles. This means that a shape created with sphere() method will be made up of hundreds of triangles, rather than a single object.
An alternative solution for better looking PDF results is to use beginRecord-endRecord.

See: https://forum.processing.org/topic/graph-inside-circle-ellipse (scroll down for the best options)
Yeah but you can't use beginRecord/endRecord with 3D graphics

I mean, what I need is to draw in 3D but render it into vector 2D output, which is exactly what beginRaw() does and beginRecord() doesn't.


Exactly. I've been playing with OPENGL and ortho() for isometric graphics, which would be amazing in PDF.

I've thought about trying with 2D, but it just seems like it would be too inflexible.

Also, about the thread title, the internal lines happen with both stroke() and noStroke().
I hadn't tried it for 3D, but I see now you are correct that this solution indeed only works for 2D.

It seems beginRaw is triangulated/segmented due to it's implementation ( reference), so I think it would be hard to circumvent this.

If you require vectors, perhaps you can check out an alternative solution such as IgnoCodeLib.