Programatically partitioning a complex geometry

I’m working on a digital art project in which I want to apply many images as patches on a 3D human body in three.js. Imagine ‘quilting’ the body’s skin in images. This won’t be possible (or desirable :)) everywhere, but there are plenty of regions that can be partitioned into more-or-less rectangular patches (like the images I’ll use).

I’d like to write code to produce a partition, which I could then edit by hand to improve the aesthetics as necessary. In the geometry there are lines made up of contiguous more-or-less parallel edges, and I could use the underlying bone structure to guide which of those lines are candidate patch boundaries.

I’m pretty sure there is no intrinsic support for anything like this in three.js. But has anyone done something similar, or can you suggest known algorithms for traversing and partitioning the faces with geometric contraints?

In case it’s relevant, I’m creating the figure in makehuman, and exporting to three.js via blender. At least, that seems to work.

Do you mean replace a complex mesh structure with simpler planar quads so you can apply the images?

No I want to keep the faces (with UVs that I’ll compute) and group them into patches to which I’ll apply the images.

I’m sorry, but I just don’t understand what you are trying to do. Could you put together an example, or at least a picture?

The following image is a ‘vorb’: images wrapped around a 3D sphere in three.js. It’s easy to determine those patches algorithmically. Now imagine I want to place them instead on a 3D human figure. I want an algorithm that will find approximately rectangular patches where I can map the images. E.g. you could put one in the centre of the forehead - and in fact a band of images all around the head. Equally there could be bands of images around the wrist, and parallel bands all up the arm. It’s not going to work over an ear, but that’s OK. I want an algorithm to find these patches for me.


I think i understand now. I do no know of such an algorithm, closest thing that comes to mind is mesh simplification, where you look for patches where relative curvature is very low. If you have a fixed model - i would suggest marking those regions manually. You could do that by UV mapping, just break your UV into many rectangles, and map each one to a part of the mesh that’s “flat”. Hope that helps. Best of luck, let us know how it goes :slight_smile: