Pullusb / Tesselate_texture_plane

Blender addon - Triangulate your textured mesh while discarding alpha zones
GNU General Public License v3.0
126 stars 11 forks source link

Tesselate texture plane

Blender addon - Tesselate texture plane

Download latest

Demo Youtube

/!\ IMPORTANT NOTES:

If it crash on your image, retry with different settings.

This addon need opencv and triangle modules At first activation, it will try to make an automatic download/installation of modules and their dependancies, if modules folder associated to your installation.
If this doesn't work, go below to manual install.

Want to support my work ? check those links


Description

Automatically tesselate a opaque zone of a texture plane mesh.
You can also just create the contour without tesselation.
The main purpose of the tesselation is to have a some vertices density in the mesh to be able to do "puppet" deformations with some rigging (similar to the puppet tool of After Effects).

Example:
With import image as plane addon, I imported this Ryu drawing image (found randomly on the web for test purpose). "contour only" option generate a mesh with stripped alpha,
otherwise it generate the same contour but fill it with internal triangles.

demo

And after some rig/skinning/animation...

paper ryu rig

...I got Paper ryu!

paper ryu idle

"Papeeer tatsumaki!"

paper ryu idle

Here is the anim pose with wire

paper ryu rig idle anim

Ryu drawing by steamboy (deviant art page), he made a superb animation with pretty much the same technique in after effect (combining multiple layers), see details here


Options detail

Contour only : No tesselation, just mesh the contour of the shape and fill with one Ngon face per separated "island" (stable, use only open-cv module).
Note : does not handle holes.

contour only

Simplify contour : 0=disabled, Approximation treshold of the contour polygon.
Higher value decimate the mesh contour shape.
Note: More simplification need also more pixel margin to avoid cutting though image.

simplify

Aeration : Limit maximum tri area, low value means more density (more triangles).

aeration

Pixel margin : 0=disabled, Dilate contour around shapes.

pix margin

Pixel cleaning : Delete surface with pixel dimensions smaller than given pixel size. (Do not use if your source is pixel art).
Usefull for cleaning unwanted rogues pixels, pushing too much can also erode surface angles.
In the example black part have alpha at 0 (smart test image isn't it ?)

pix clean

Minimum angle : 0=disabled, "quality mesh generation" value, augment the mimimum angle limitation.
The value is not given as an angle but as min/max available. Basically means more triangle with better repartition.
Note : This have a big influence on aeration ! Add more density variation (kind of like Dyntopo for sculpting).
It sizes triangles as needed (usually smaller on the mesh boundary) resulting in a better quality result.

min angle

External contour only : Discard holes or internal shapes, detect only external contour of shapes.

holes

Gift wrap : Close the convex hull of the shape

gift wrapping

UV mask : Generate geometry only on parts enclosed in the UV quad. If False the whole texture is meshed in 3D space.

uv limits

True Delaunay algo : Use another algorithm for delaunay triangulation, conforming delaunay instead of constrained delaunay Triangle module settings. Results isn't so different, but this algorithm make sure voronoï cells are at center of each triangles (can force generation of super tiny tris by complying to this rule).

Additional notes

Where ?

Panel in sidebar : 3D view > sidebar 'N' > Tool > Tex plane tesselation

Credits

The addon is heavily inspired by the original Tesselate addon within the rigging scripts released by "les fée spéciales" studio.

Here are the main differences:

Manual installation of needed module

This addons use two python modules to work. You have to install triangulate and opencv.
Be sure to download a version compatible with Blender 2.80's python 3.7. This means you ought to have the same python version installed and use pip install through this version. If you don't know how to do that look at "how to install module for specific python version".

If you install through pip with pip install opencv-python and pip install triangle.
You should see the folders of the modules in the python installation directory.
In <python_version>/lib/sites-packages.
Now copy opencv and triangle to the Blender module folder. If you don't know we're your Blender modules folders are, look at "Were are the scripts folder in Blender". (Or video "addons and script installation in Blender", version quick or long).

Opencv should have install some library dependency that you can see listed in console at pip install (make sure to copy them as well)

About module installation :
If triangle doesn't install properly with pip, follow this tutorial on module installation by Damien Picard.


Todo:

Changelog

2.0.2

2.0.1

2.0.0

1.1.0

1.0.2