Jump to content

Edit SOP (spherify)?


Atom

Recommended Posts

I have this oval shape that I would like to be more rounded. I have tried selecting some points and increasing the Soft Radius in the Edit SOP but that just does not give me the result I am looking for.

Basically I would like to push the points out from the center sphereically.

Can this be done with the Edit SOP or is there a better node for that?

Untitled-1.jpg

Edited by Atom
Link to comment
Share on other sites

27 minutes ago, Atom said:

Does this also remove scale?

Yes, it places all points exactly one unit away from the world center.

A compromise would be interpolating between the current state and a spherified shape.

@P = lerp(@P, normalize(@P), chf('mix'));

While it might lead to geometrical collisions, you can for sure create really cute baby pigs with it ^_^

 

sphere_pig.jpg

  • Like 1
Link to comment
Share on other sites

Not fixing the overlapping edges of course, but a revised version of the code could be

vector _min, _max;
getbbox(0, _min, _max);

vector _ctre = _max - ((_max - _min) * 0.5);    // compute centroid
vector _size = _max - _ctre;    // find longest distance to centroid
float _radius = length(_size);


@P -= _ctre;    // realign to centre of the world
@P = lerp(@P, normalize(@P) * _radius, ch("bias")); // spherify
@P += _ctre;    // reposition in world

It will spherify any object wherever it is in the world while maintaining a sense of scale.

  • Like 1
Link to comment
Share on other sites

1 hour ago, iamyog said:

It will spherify any object wherever it is in the world while maintaining a sense of scale.

Useful idea. I compressed the code a little..

vector center = getbbox_center(0);
float size = max(getbbox_size(0));
vector sphere = center + normalize(@P - center) * 0.5 * size;
@P = lerp(@P, sphere, chf('spherify'));

 

Link to comment
Share on other sites

btw: Another option would be offsetting the spherification center.

vector center = getbbox_center(0) + chv('offset');
float size = max(getbbox_size(0));
vector sphere = center + normalize(@P - center) * 0.5 * size;
@P = lerp(@P, sphere, chf('spherify'));

 

human_spherify.png

Edited by konstantin magnus
added screenshot
  • Like 1
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...