PShape + 3D no es bueno

Hi! I’m trying to do the following:
I have a file with a complex model in it, originally STEM format, which I’ve gotten into STL, and it still has a lot of polygons ( 40,000 I think ). While I can draw the object, frame rates are bad, so I look and find PShape that seems to have a lot of benefits.

Processing-latest, ie 3.3.7, running on OpenGL I think.

When I spend two frustrating hours failing with PShape, I ran into the following problems:

createShape in my environment requires getting a hold of the PApplet, which I don’t use anywhere else and would require some gymnastics to acquire. It’s not lying around, for sure.

createShape is documented to simply take a family. It doesn’t.

Thus, I am simply new-ing a PShape object, which seems to at least compile, but I haven’t seen anything on the screen yet.

draw(shape, x, y ) doesn’t seem to have a 3D version ( I was expecting draw(shape, x, y, z ) ), or is in viewport coordinates, which I haven’t had to use for anything before. I don’t know why I can’t simply draw, and let the coordinate system figure itself out.

The fill() primitives seem hinky in some way. I see there is a difference between what one is supposed to call before actually attaching the shape information, and after ( dynamically ). I am using integers everywhere else and I’m getting bad token errors.

The examples referred to in the documentation simply don’t exist in the Processing IDE.

The documentation says “This is a placeholder in Processing 1.0”, which doesn’t inspire confidence when the version is 3.0.

I get from the doc that I want to create a PShape per triangle ( instead of having a “bucket of triangles” PShape, which seems quite sad ), and set a parent GROUPS PShape. While that seems good, I’m starting to think I’m not going to get much performance out of using PShape, as I think it’s likely to be a heavier weight object compared to simply creating triangle-type objects.

Now… Maybe I want to try to convert my STEM into an OBJ which is internally supported, but I thought I’d give a list of my gripes in case someone would like to look into this.


Hi @bbulkow!
Can you post some code/reference geometry? I can take a look at it on my machine and see if I can suggest any alternative workflows.

1 Like

“Alternative workflows” — do you mean that PShape is known not to be a successful workflow?

I have a public repository at: . If you look in, you’ll see reading the STL file. If you look in UI.pde, you’ll see blasting the STL triangles into the screen. This isn’t final code by any means - you’ll see the hardcoded path to the STL file needs changing.

I have worked with my modeling guy, I can get a lower triangle count, but he’s having trouble getting under about 80k triangles in his STL output.

I have submitted my question not because I want a solution - I’ve abandoned PShape - but instead to alert you that your documentation is simply not self consistent. Examples are being pointed to which don’t exist, statements of stability are unclear, the ability to create 3D pshapes just seem to have an incomplete API.

Good luck!