Jump to content
Sign in to follow this  
Atom

Edit SOP (spherify)?

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

Share this post


Link to post
Share on other sites

Thanks, that kind of works but it also kind of messes up some of the edges. Does this also remove scale? It seems like my overall size diminished quite a bit.

Untitled-1.jpg

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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'));

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I like the addition of the vector. It is like having an invisible metaball influence you can move around.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×