# Mesh Library for Processing 3

**URL:** https://discourse.processing.org/t/mesh-library-for-processing-3/21047
**Category:** Libraries
**Created:** [May 19, 2020, 9:08am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047 "2020-05-19T09:08:10Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![artpen](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@artpen](https://discourse.processing.org/u/artpen)
#### Post date: [May 19, 2020, 9:08am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/1 "2020-05-19T09:08:10Z")

</div>

Hi Guys,

I am new to Processing. I think 🙂 Haven’t used it for a while. What is the good and fast mesh manipulation library nowadays? Which is steel in active development.

I remember ToxicLib was amazing, but it haven’t been updated for ages.

Basically I need a mesh Lib with some basic physics simulation potentially. Say for creating origami shapes and flat panels.

Thank you

---

<div class="post-metadata">

### Author: ![artpen](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@artpen](https://discourse.processing.org/u/artpen)
#### Post date: [May 19, 2020, 9:20pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/2 "2020-05-19T21:20:44Z")

</div>

Anyone who does 3D in Processing. Will appreciate any information.  
Thank you

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [May 19, 2020, 9:25pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/3 "2020-05-19T21:25:52Z")

</div>

Hi,

Did you check the 3D libraries listed on the Processing website ? :

- [https://processing.org/reference/libraries/#3d](https://processing.org/reference/libraries/#3d)

---

<div class="post-metadata">

### Author: ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)
#### Post date: [May 19, 2020, 10:35pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/4 "2020-05-19T22:35:59Z")

</div>

Hi @artpen

If your meshes are complex and you need to do a lot of specific operations (split face, get vertices in sorted order, get neighbors in CCW-order, smooth, …), I would suggest [HE\_Mesh](https://github.com/wblut/HE_Mesh) but the library doesn’t come with a physics engine.

For simpler operations, Toxiclibs still does a great job (although it is a bit slower than hemesh) and you get a simple physics engine.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [May 20, 2020, 2:28am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/5 "2020-05-20T02:28:43Z")

</div>

Agree about HE\_Mesh – for interchange I also recently stumbled on an old mesh translation library, although I haven’t tried it.

> **[archive-for-processing/rosettamesh](https://github.com/archive-for-processing/rosettamesh)**
>
> A collection of triangle mesh conversions for Processing, Clojure, and Java. - archive-for-processing/rosettamesh

---

<div class="post-metadata">

### Author: ![artpen](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@artpen](https://discourse.processing.org/u/artpen)
#### Post date: [May 20, 2020, 7:16am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/6 "2020-05-20T07:16:53Z")

</div>

Hi @solub thank you. I looked at wblut last night.  
It looks like what I need. I can probably find separate physics lib ?  
Still experimenting…

---

<div class="post-metadata">

### Author: ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)
#### Post date: [May 20, 2020, 9:08am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/7 "2020-05-20T09:08:39Z")

</div>

It really depends on your goal.

For a moving mesh (growing/folding/bending/…) I personally found Toxiclibs to be the easiest library to work with. It seems to me HE\_Mesh is not really meant to deal with non-static meshes. Depending on the context you might have to rebuild the whole mesh at each iteration instead of updating a specific set of faces. I would advise asking @wblut on GitHub for a better and more detailed answer.

You could indeed import a separate physics library and apply the desired behaviors/forces to your _he\_mesh_ but the conversion between the 2 formats can be costly (ex: convert all the `WB_Vertex` of a mesh to `Vec3D` for force computation, then convert back to `WB_Vertex` for rendering). So, for simple forces like springs, attraction, planarity… you may be better off writing your own functions.

To sum-up: I would suggest Toxiclibs for origami-like folding meshes, and Hemesh for complex static meshes.

Hope that makes sense.

---

<div class="post-metadata">

### Author: ![artpen](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@artpen](https://discourse.processing.org/u/artpen)
#### Post date: [May 20, 2020, 9:52pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/8 "2020-05-20T21:52:46Z")

</div>

> [@solub](#):
>
> To sum-up: I would suggest Toxiclibs for origami-like folding meshes, and Hemesh for complex static meshes.

Thank you @solub. Good advice. I have tried He-Mesh it looks like you right it is not dynamic. But I will check on GitHub.  
I have done some basic stuff using Toxiclibs, will try again.

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [June 19, 2020, 11:11am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/9 "2020-06-19T11:11:40Z")

</div>

This thread is so nice! @artpen, would you consider posting some examples to get people even more excited about meshes?

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 19, 2020, 5:46pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/10 "2020-06-19T17:46:13Z")

</div>

> [@artpen](#):
>
> I have tried He-Mesh it looks like you right it is not dynamic.

You might also be interested in bRigid, which uses JBullet. You can download an direct-install it in your libraries folder in order to access the examples.

> **[bRigid — Lab for Environmental Design Strategies](https://lab-eds.org/brigid)**
>
> is a library by Daniel Koehler for the Processing programming environment. Last update, 02/04/2016. bRigid provides classes for an easier handling of...

There is also a Menger Sponge example from PixelFlow that uses bRigid for its physics.

> <https://github.com/diwi/PixelFlow/blob/master/examples/Skylight/Skylight_BulletPhysics_MengerSponge/Skylight_BulletPhysics_MengerSponge.java>

[![](https://i.vimeocdn.com/video/635968099-3ad354c3e8c7deccc5e87e000020adb21deaf57c6cb150006d4d7845dd419ed7-d?f=webp "Rigid Body - Menger Sponge") ](https://vimeo.com/218485498)

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [June 19, 2020, 9:09pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/11 "2020-06-19T21:09:29Z")

</div>

WOW @jeremydouglass😃 😃 😃

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [June 19, 2020, 9:32pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/12 "2020-06-19T21:32:00Z")

</div>

I tried those examples but there is a lib missing…

> The package “javax.vecmath” does not exist. You might be missing a library.

I’ll try to find it.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 19, 2020, 10:00pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/13 "2020-06-19T22:00:41Z")

</div>

Maybe [https://mvnrepository.com/artifact/javax.vecmath/vecmath](https://mvnrepository.com/artifact/javax.vecmath/vecmath)

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [June 19, 2020, 11:13pm UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/14 "2020-06-19T23:13:33Z")

</div>

I already found it, and have placed the jar in the sketchbook/libraries folder within a folder with the same name.  
But it still complains that the lib is missing;  
(I unzipped the jar, and the requested files do exist).

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [June 20, 2020, 5:01am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/15 "2020-06-20T05:01:42Z")

</div>

The other two missing libs I found [here.](https://github.com/djrkohler/bRigid/tree/master/distribution/bRigid-2/download/bRigid/library)  
But now I get the error:

> NullPointerException  
> Could not run the sketch (Target VM failed to initialize).  
> Make sure that you haven’t set the maximum available memory too high.

The line 534 face = box.getChild(1); was highlighted  
I tried different memory settings without result.

Edit: I commented line 534 until 541, and now it works.  
It’s a pity that my PC is so slow, it’s running at 2,5 fps.  
But it’s really an incredible lib. I’m going to explore it.

---

<div class="post-metadata">

### Author: ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)
#### Post date: [June 20, 2020, 8:41am UTC](https://discourse.processing.org/t/mesh-library-for-processing-3/21047/16 "2020-06-20T08:41:54Z")

</div>

I’ve used HE\_Mesh, ToxicLibs and plain PShapes all in the same project because each has its strength. It’s not hard to convert meshes from one format to the other. I actually used the first two to generate meshes and then convert them to PShape as they are kept in the GPU.

Even if the mesh itself is static, you can translate, rotate and scale them, you can move the camera, and you can deform them with vertex shaders, which is very fast. That allows you to bend, twist, stretch, glitch and apply all kinds of manipulations to them in real time (the same kind of deformations you have in Blender).

Just my 0.01€ 🙂
