Jump to content

Rbf Morpher


Recommended Posts

Hi all,

Whilst looking around at papers on PSD and MWE I came across all sorts of info on RBF's (radial basis functions) since these are used to calculate the weights for the PSD.

I also came across a way of using them to do feature morphing between topologically different meshes using a method called Thin plate spline mapping.

Anyhoo I've been experimenting and put together this basic sop that impliments it. Basically the idea is that you mark feature points on two different meshes and this sop would deform the input mesh to match (approximately) the second mesh using the transformed feature points.

In the papers they generally use it to morph different heads and then do weight transfer from the morphed head onto the new unmorphed one. The transferred weights are capture weights so the head can then be animated without having to manually set the weights up for it.

The applications of this are quite varied though so I thought I'd share it.

I have one problem with it at the moment. It works but after a few clicks in the hip file it will crash with a memory error. So if anyone can see what I've done wrong that would be great. It's a very simple piece of code, I must have just missed an initialisation or something but I can't see it.

I'll look at it again later and see if I can spot it with fresh eyes.

The attached just uses a linear basis but I've commented the bit you need to change to try different types of interpolations.

RBFmorpher.zip

enjoy!

  • Like 1
Link to comment
Share on other sites

I havent downloaded this but it this type of thing is very useful thing. I believe I've even RFE'd it in the past. Digital Domain has a very similar thing written for Maya guys which uses Thin Plate Spline RBFs to interpolate shapes. Linear interpolation can be so ugly and you always have to hide it by blending in other shapes with staggered timing to hide the bumps caused by the discontinuities. This tool really helps ensuring that facial animation (if you're using Blend Shapes) is smooth and more natural looking.

I've found many uses in FX work for this type of smoothed interpolation. I've sketched around in the past by using a Trail SOP to generate connected polys, converted them to curves (FitSOP) and then these as the new curves as the rails for interpolated shapes. I haven't tried this with character faces though. I'll be it wouldn't be the speediest for thousands of points.

I'd love to see other types of shape interpolation available Houdini, so thanks Simon!

Link to comment
Share on other sites

@Edward

When I get some nore time I'll try and make some pics for you. Still need to squash that bug first.

@Jason

It's quick for small numbers of feature points, not sure the math holds up when the number gets high. Basically to set up the weights you have to solve N linear equations, where N is the number of feature points. I don't think the solving methods will hold up for 100's let alone thousands. The idea is that the points are very sparsely generated and that you don't need many to control the surface.

However if its thosaunds of points you wish to deform it would be super fast. This is because you only create N weights, so if you have 1000's of points controlled by only 10 feature points it would be quicker than most other methods. Also doing the original calculation to set it up only involves solving for 10 equations which is also very quick.

I'll post results when I've played with it some more.

By the way I'm always open to any idea for deformers.....

(Must try and find time to look at that cloth solver you sent me....)

Link to comment
Share on other sites

I have one problem with it at the moment. It works but after a few clicks in the hip file it will crash with a memory error. So if anyone can see what I've done wrong that would be great.

27323[/snapback]

Hey Simon ... I think the problem is your set of tP = P and P = tP calls. I don't think UT_Permutation has a proper copy constructor, so you'll get memory badness when P and tP go out of scope and both try to delete the same memory (the array of values that the UT_Permutation class stores).

Cheers!

Link to comment
Share on other sites

Here's some piccies and a hip file to play with.

It took more points than I hoped to get anywhere near the target but mildy less work than it would've doing it with a lattice in points mode. Since I don't really want this for matching faces I think it will work very well.

Anyway judge for yourselves.

1. Original head

2. Target head

3. RBF morphed head

4. Point lattice deform - with one fixed capture radius

post-509-1147121522_thumb.jpg

post-509-1147121860_thumb.jpg

ExampleRBF.zip

cheers to rjpieke for spotting the UT_Permutations error, saved me a few hours hunting...

Link to comment
Share on other sites

Here's a small update, I've added some different kernels for calculating the RBF part.

Hey Simon,

Just took a quick peek now:

Very Nice!! :thumbsup:

Don't know the details at all, but it seems like a useful deformer.

Good stuff, and thanks for sharing!

Link to comment
Share on other sites

Simon, this is a great thing, thanks;)

However, I've noticed if you change around the inputs a lot to things with different point counts it will freak out. I have some more thoughts for you on this but I'll have to write to you about this later. It turns out that my previous reply to you on this was related to a similar piece of technology based on RBFs but not the equivalent of this at all.

Here is a RedHat 9 dso for anyone who wants to to play along.

EDIT: This is for 8.0.589. Should work with any Houdini version around that build, I hope. Not much seemed to change in the Journals around that period.

SOP_RBFmorpher_RH9_dso.zip

Link to comment
Share on other sites

Simon, this is a great thing, thanks;)

However, I've noticed if you change around the inputs a lot to things with different point counts it will freak out. I have some more thoughts for you on this but I'll have to write to you about this later. It turns out that my previous reply to you on this was related to a similar piece of technology based on RBFs but not the equivalent of this at all.

Here is a RedHat 9 dso for anyone who wants to to play along.

EDIT:  This is for 8.0.589. Should work with any Houdini version around that build, I hope. Not much seemed to change in the Journals around that period.

27418[/snapback]

Could you explain a bit more about what you did to make it freak out. I've only tested it with that one file so far. I did try pumping in a subd surface of the original head and it seem to be happy. But I haven't given it much of a workout yet.

Here's a compiled H8.0.410 dso for winows users

SOP_RBFmorpher.zip

Link to comment
Share on other sites

thanks simon, will be reading through lunch.

i saw the actors site before... and skimmed through it... i'll have to be more careful on the next thing... you never know what you can find out there..

it looks really interesting (yourSOP) I tried it out and it worked fine... I was able to make it slow down with a resampleSOP adding more points on the reference curves.. but the results were very similar to the sparse curves..

cool

-k

Link to comment
Share on other sites

I idea here is definetely to use as sparse a number of points as possible, if you were to need lots then using a point lattice would probably be better.

This technique works well with sparse point density where a point lattice will fail and with dense points its the other way around....

Link to comment
Share on other sites

Could you explain a bit more about what you did to make it freak out.

SOP_RBFmorpher.zip

27428[/snapback]

Its pretty easy; while the display is on the RBF morpher, change the number of deform points (2nd input). It doesnt like having mismatched numbers of points on the point cloud.

1) take a sphere,

2) scatter 25 points on it

3) create a RBF Morpher and wire the sphere into the 1st input

4) wire the scatter into the RBD Morpher 2nd and 3rd inputs. all is good.

5) duplicate the scatter and make it generate 100 points

6) wire this new scatter into the 3rd input of the same Morpher

Link to comment
Share on other sites

Its pretty easy; while the display is on the RBF morpher, change the number of deform points (2nd input).  It doesnt like having mismatched numbers of points on the point cloud.

1) take a sphere,

2) scatter 25 points on it

3) create a RBF Morpher and wire the sphere into the 1st input

4) wire the scatter into the RBD Morpher 2nd and 3rd inputs. all is good.

5) duplicate the scatter and make it generate 100 points

6) wire this new scatter into the 3rd input of the same Morpher

27481[/snapback]

Oh right, yes that makes a lot of sense. I'll add a test to prevent it trying to solve a situation where the point counts don't match.

Cheers!

Here's a version with this fix implemented

RBFmorpher.zip

Link to comment
Share on other sites

  • 3 months later...

hey all

i dont think this should be under hdk, however i want to follow this morphing thread.

it was mentioned that one can use the uv values of 2 object to blend between objects with topological mismatches.

can someone mention what vop/vex i can use to extract the object or world space position using the second objects uv value,

or is there another method of extracting this data ?

thanks in advance

brian :blink:

Link to comment
Share on other sites

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...