Jump to content

Methods for shrink-wrapping a mesh onto a different topology


Recommended Posts

Still fairly new to Houdini and can't quite escape the feeling I might be going about this completely the wrong way, so I'm curious what ideas the good people of odForce might recommend. Strangely, I've not found much in the way of discussion of this sort of problem for Houdini - though perhaps I have not been looking for the right terms?

 

What I'm attempting to do is shrink-wrap a generic mesh (e.g. a high-density geosphere) onto a mesh of arbitrary shape under it, while retaining the geosphere's original topology, preserving as much detail of the source mesh as I can, maintaining as even a distribution of points as possible, and - preferably - doing it fairly quickly.

 

The arch reason for doing it this way (rather than, say, doing a polyReduce on the source mesh or something) is that ultimately feeding in several different source meshes should produce different shapes with the same topology, which can then be smoothly interpolated between. For instance, several frames of a Pyro sim could be meshed, shrink-wrapped and then turned into a vertex animation to create a sort of a 'smoke-in-a-bag' effect. Primarily for real-time rendering purposes where importing a separate mesh per frame would not be a practical solution.

 

The best I've come up with myself is the method I've attached below along with this post. Using a ray sop by itself tends to produce very messy results, so I use the ray sop to cast to minimum distance, then lerp back to 15% of a blend between the original position and the ray sop, relax the points on the result in order to even out the topology and then use a smooth sop to even out the jitters introduced by the relax sop. Iterating this around 20-50 times (depending on the mesh), getting a little closer to the source mesh every time, tends to result in a cautious and slow shrink-wrap that accommodates most meshes without too much artefacting and keeps the geosphere quite nicely and evenly stretched out across the whole mesh.

 

However, it's proven to be very, very slow to run the iteration and I feel like surface detail could be better preserved. As such, would quite like to hear if anyone can suggest other approaches to this problem!

 

iterativeShrinkWrap.hip

Edited by 9of9
Link to comment
Share on other sites

  • 3 weeks later...

I had the same problem and arrived at pretty much the same solution. I am also not satisfied with it. But in the hip file you posted, you have a giant bug. If I see this correctly (and didn't introduce the bug myself), instead of relaxing you merge the points. So you end up doubling your polygon count with each iteration of your procedure. It's the node called "relax2".

iterativeShrinkWrap-D1.hiplc

Edited by DASD
Link to comment
Share on other sites

  • 2 weeks later...

There is no general solution which covers wrapping of "any mesh" to "any other mesh" without some guides. Guides could be let say UV or any other attribute which exists on both geometries. Those could be used for matching which parts from both topology correspond to each other. Without guides, it is possible but with lot of limitations from case to case. In your example, sphere wrapping against torus, there should be a definition what to do with topmost and bottom-most points from sphere? It is obvious that those can not be parts of torus surface if you want resulting topology has sense. So I suppose those have to "stick" to an imaginary plane(s) parallel with XZ plane. 

Anyway, Houdini have a tools for matching different topology (with or without guides).

 

Used algorithm for your example is:

1. Define some search radius which will be used as search distance for each point on sphere

2. For each point on sphere find as much as 500 points on torus which are in that radius distance and average all those point positions. Take also normals from those points from torus and average their directions too.

3. Move each point from sphere to averaged position and assign averaged normal. That will generate geometry similar to extremely smoothed torus but some points will be inside it some outside.  

4. Peak all points enough so each point is outside torus

5. Do ray cast in opposite direction of stored smoothed normal and mark points which failed to intersect geometry by ray casts

 

Here is modified scene:

http://wikisend.com/download/670898/iterativeShrinkWrap_2.hipnc

  • Like 1
Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...