Jump to content

custom smoosh deformer


Recommended Posts

Hey All!

I'm trying to replicate a piece of geo as if it were pressed up against a pane of glass. I was trying to solve this without any simulations can someone point me in the right direction? Here is what I started with a sample scene. here is an image of what I wanna achieve. I think I need to do it with an attribute because eventually, I need to apply this to an alembic animation of a character so I cannot depend on position.

 

Thanks in advance!

 

example.thumb.PNG.1afd29be67381e5f9c1bdd9733df1f08.PNG

jl_smoosh_v001.hiplc

Link to comment
Share on other sites

Hi @jonidunno,

you can project a mesh onto a plane using the planepointdistance-function with a grid on the second input:

// PARAMETERS
float in = chf('in');
float out = chf('out');
float off = chf('offset');
float soft = chf('soften');

// PLANE
vector p;
vector pos_pt = point(1, 'P', 0);
vector nml = prim_normal(1, 0, vector(0.0));
float d = planepointdistance(pos_pt, nml, v@P, p);
vector plane = p + normalize(nml) * off;

// MASK
vector dir = normalize(pos_pt - v@P);
float angle = dot(dir, nml);
float sdist = sign(angle) * d;
float bias = smooth(-out, in, sdist);
float mask = smooth(-soft, soft, sdist);
vector pos = lerp(v@P, plane, bias);

// OUTPUT
f@mask = mask;
v@P = pos;

Later I might discuss the code a bit here: https://procegen.konstantinmagnus.de/pressing-meshes-against-a-plane

plane_title.png

pressing_plane.hipnc

  • Like 2
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...