# best way to stitch a surface detail onto a mesh?

I’m a computer programmer, not an artist. However, I use 3d tools to clean up and export meshes for software. One of the frequent tasks I have to deal with is stitching a surface detail onto a simple mesh. I’m wondering if there are some easy ways to do this…

Imagine a simple example, where there are a set of cylinders that need to stick out of a single flat quad.

One way to do this is an object boolean, but booleans break down and start introducing errors pretty fast as the total complexity of the mesh increases (not the complexity of the intersection).

I’d really like a way to just move a mesh into another mesh and have it create new verticies (subdividing the target) anywhere it touches the target.

Is there some easy way to handle this type of operation?

I’m sorry you feel that way. http://www.youtube.com/watch?v=bVhcB9ucmdg

http://www.meshmixer.com/

There is no “easy way” to do it right. If the detail is small it can be normal mapped. If it protrudes a great deal, it needs to be grafted by hand imo.

LOL

As someone who is both programmer and artist, I use my programming knowledge of when I had to do it all by hand in code and do it me’sen!

However here’s a tutorial which may help those artist types who don’t like going rouge…

There is another on the subject somewhere on there, but it’s not jumping out at me…

@3dementia - I’m talking about a situation which requires geometry to be added. I’m trying to figure out a workflow for grafting it in that actually works.

@rarebit - I already mentioned in my original post why booleans are not an option. First, they introduce random geometry mistakes when either mesh is complex, unfinished, or dirty. That complexity, and those mistakes are not related to the intersection complexity. Second, they don’t work on non-closed submeshes.

I should also add that this is for non-organic precision-shapes, where ‘kinda close’ to the right place is not good enough. I’ve attached an image example of a single cylinder being grafted onto a flat surface. If I know exactly which verticies I need to graft, shrinkwrap can help make them coplanar with a target surface, but it won’t subdivide the target surface for me.

Alias seems to have a workflow for doing this around a mesh-intersection tool (though I’ve never used it). Note that mesh intersection is much simpler than boolean intersection. It simply creates curves at the intersections of two meshes (which don’t need to be closed shapes), which can then be used to cut the meshes. That would at least make it easy to create the right verticies, though it might still be a manual process to weld them together.

As a programmer, this feels like something the computer could do for me so easily, and with math that’s much simpler than boolean mesh intersection. All I want to do is grab a ‘feature’ mesh, and slide it onto a ‘target’ mesh – causing the ‘target’ mesh to subdivide everywhere it gets hit by a vertex of the ‘feature’ mesh, and simultaneously preventing the feature-vertex from penetrating the surface (keep it coplanar with the surface). In a way, this would be like having a “submesh shaped knife cut”.

If you kept sliding the feature into the target, eventually it would be completely smashed into the target mesh surface (it would look like it was shrinkwrap(ed), but it would actually be subdividing the faces), creating a set of cuts completely coplanar with the target surfaces. In my case, I wouldn’t do this, as I want the feature to stick out from the surface. I would slide it in enough to create the necessary cuts in the target surface to join them. This operation doesn’t need to deal with the complexity of removing faces (for example, the faces underneath my new feature-detail), as I could easily remove them manually.

Just like the current shrinkwrap modifier, this doesn’t have the complexity (and unpredictability) of booleans, because ray-to-plane intersection is precise and well defined. As you slide the feature-mesh along an axis, each verticies of that mesh creates a precise ray in the translation direction. Each vertex-ray would intersect the target mesh in one precise spot, and these would be the only places new verticies would be added to the target mesh. Likewise for edge-rays and surfaces. It would only create these verticies when you slid the feature mesh close enough to touch the surface, giving you control over the orientation of the feature protruding from the surface.

Is there any Blender workflow that can get anywhere close to this result, even with a few steps, like the Alias mesh-intersect feature above?

The best I can find is:

1. use shrinkwrap to make coplanar contact points

a) put the feature mesh into a separate object
b) add a “contact points” vertex group to the feature-mesh
c) put the points which are going to merge onto the target surface into the “contact points” group
d) add a shrinkwrap modifier to the feature mesh, use “nearest surface point”, choose the target mesh, and the contact-points vertex group
e) position the feature where you want it relative to the target mesh.
f) apply the shrinkwrap modifer

1. manually merge the faces.

a) JOIN the two meshes, and go into edit-mode
b) remove faces and manually make new faces to stitch the “contact points” into the target mesh

However, it only works well for grafting onto a flat surface. A target-mesh with shape requires additional verticies to be added because of edge/surface intersections that shrinkwrap doesn’t produce.

Your either going of into using curves and NURBS, otherwise it’s boolean operations.

Yes Blenders can be a bit rough around the edges at times, but if you get your normals right, and resetting your mesh, sometimes not doing too much at once, or even do a few steps at a time, then I get the right result every time, just as good as if it was done using AutoCAD or 3DS.

Sometimes i’ll have to delete bits or use intersection instead of difference, etc… but with a little thought you can utilise them to the same degree as any other.

To do your situation manually, delete the face at the bottom of the cylinder, and the face on the cube, then use the available vertices to create faces (‘F’).

see this file for a way of manually projecting an edge… after that it is deleting some verts and creating new faces, maybe bridge from loop tools could help

@rarebit - i’ve explained twice above why booleans do not work for me, most notably because I’m working with dirty meshes that are not closed. The process I’m talking about is part of the cleanup, so an answer like “clean them up and use booleans” is just a circular non-solution.

@liero - I looked at your example file. This is the same process I described above using shrinkwrap. It works for projecting against a flat plane… However, if there are a set of surfaces, it doesn’t add the necessary verticies at the crease of the surface. You can see the problem from the example file on this reply, where the projected circle “cuts across” the corner of the cube because there are no verticies on the edge. Obviously it’s possible to fix these points up manually, but as the submeshes begin to have any complexity, it’s not so easy.

I’m not interested in hearing about ways to use booleans, or ways that work only in these very limited situations. I’m wondering if there is a really excellent general case way to do this, because it not I may spend some time programming an operator to handle it.

### Attachments

sample_merge_issue.blend (63 KB)

Yes, I later saw you had already tried that… such tool as you pretend would be a nice addition.

as liero says, the tool you have in mind would be very good. if you could make it work you might be a bit of a hero.

in other arch and mech software that i use, boolean ops are seen as perfectly normal operations and are used without a thought for the details of the underlying mesh, because nobody cares or can even see it, and it doesn’t affect the process.

but if you want a mesh with nice topology and edge loops in all the right places, as you say, boolean ops just can’t do it yet, or without human intervention - rarebit i would like to hear more about how you use booleans and then tweak the mesh afterwards

the process of grafting one mesh to another has a lot in common with the process of making a specifically shaped hole in a mesh

in blender-world this would usually involve steps like:

add edge loops to the mother mesh to increse the density of quads in the intersection region
delete an appropriate vertex
extrude and scale the edges of the newly created hole
give the new edges a suitable shape (various techniques available)
add an edge loop on the “mother” side of the junction

then the child mesh could be introduced and possibly stitched to mother (ideally the number of verts in the hole = no of verts on the face of the child mesh - a process of aligning verts and then removing doubles could be used)

or the edges of the hole could simply be extruded.

of course for more complex situations like your example or when the parent mesh surface is curved … tricky to automate

there is an excellent script for 2.49 which i have used a lot in the past - geomtool:
http://glender.hybird.org/
it allows projection of selected edges to another mesh surface, with or without cutting of the edges. the script could easily be updated for 2.5x

edit: sorry pics in wrong order

### Attachments

So many n00bs think that there is some tool that will help them accomplish their goal. But just like with code, the simplest solution is often the best answer. If you need vertices somewhere…put them there.

Again going with the coding analogy, you often have to make sacrifices or adjust other portions to accomplish the goal you are after. Nothing will ever be perfect, allowances have to be made.

It’s like designing a website, there will never be a website builder that can do everything that a real codemonkey can. There is no “make butterfly” button, if there was, would there also be buttons to adjust the shape of the wings and the thickness of the antennae? What about the colors? What about an alien butterfly with razor sharp teeth and 6 inch claws?

Blender’s toolset is designed in such a way that anything can be achieved. Trust me there is nothing on this planet or in your imagination that cannot be modeled with blender. That being said, Blender is an artist’s tool. It is not autocad, nor is it Rhino 3d. It is a grand piano made for making beautiful art. Precision is often sacrificed for form and speed. Not to say that you can’t be precise…all right I’m rambling, sorry.

See the attached blend, I lowered the cylinders vertex count, set everything aligned with a world axis and recentered. Then I just moved the verts where they needed to be. Of course, this topolgy is not correct for subdivision, if you subdivided this mesh it would prolly look rotten.

I think the fun part of modeling is figuring out the topology, how to make this shape. It is a never-ending learning experience that will bring you hours of pain, and tears of joy when it works out. but it is highly addictive and extremely fun.

There are two types of modeling, hard-surface and organic. Man-Made vs Nature. Hard surface is very easy to achieve, and doesn’t deform, whereas organic is much more challenging and must be made to stretch and flex. Both have their sets of rules and best practices that you need to follow to achieve good results, but nothing is etched in stone. Whatever works is the slogan to live by. See the attached leg, it is a retopo of an octopus sculpture, took me until the fourth tentacle to finally figure out this topology, and I am sure a master like Jonathan Williamson could show me a better way.

Good luck hth,
-mike

### Attachments

cube-cylinder.blend (59.6 KB)leg.blend (915 KB)

yet still believe there will always be new and more efficient ways to do things …

i would love to see someone have a go at a script that can perform mesh intersections - even simple ones

as you say there is great fun in working out good ways to model a particular situation, but if it is a situation that comes up often - nice to have an automated / semi-automated method

anyhoo, here’s another way to model the crazy cube-cylinder intersection:

project one end face of the cylinder onto the cube (shrinkwrap)
add a few edge loops and delete 4 quads to create a 16-vert opening in the cube

alt select the edges of the hole in the cube and the projected circle edges
w > looptools > bridge (thank you crouch!)

minimal tweaking and done

### Attachments

cube-cylinder-2.blend (985 KB)