# Any polygon -> Sphere

## Recommended Posts

Does anybody know of a way to turn any closed (and no holes,so genus 0 surface) polygonal object into a sphere with equal pointcount?

I've tried normalizing the object's P and raycasting. While this kind-of-works the sphere does not consist of equally spaced points.

Edited by Macha
##### Share on other sites

Does anybody know of a way to turn any closed (and no holes,so genus 0 surface) polygonal object into a sphere with equal pointcount?

I've tried normalizing the object's P and raycasting. While this kind-of-works the sphere does not consist of equally spaced points.

I'm not sure if this is what you are looking for. This is a sphere with equally spaced points. It is not entirely stable though

SphereFromPoints.hipnc

##### Share on other sites

Does anybody know of a way to turn any closed (and no holes,so genus 0 surface) polygonal object into a sphere with equal pointcount?

I've tried normalizing the object's P and raycasting. While this kind-of-works the sphere does not consist of equally spaced points.

Can you post some sample geometry?

##### Share on other sites

Clever setup in the file above!

Below is an example geometry.

For example, blending each of the pieces to spheres.

example.hip

Edited by Macha
##### Share on other sites

I hope I understood what you wanted.

I only converted one piece into a sphere. You'll have to add a foreach to process all the pieces, but other wise my approach was simple. Using the center of a piece I project each point out a given radius, then apply a Smooth SOP to tighten all the edges. This process is then repeated in a ForEach X number times until an even sphere is created.

Not sure if this is the fastest solution, but it works.

sphere.hip

##### Share on other sites

Hey Hopbin, this is virtually identical to my setup except that you put the last step into a foreach again. I never thought of that! I tried it but a foreach inside a foreach doesn't seem to work. Even if nothing is inside the nested foreach, it messes up the geometry!

Any inklings as to why?

foreachexample.hip

##### Share on other sites

Stamp Name and Index Stamp Name variables should be unique for nested ForEach SOPs to work, so just rename them in second For

##### Share on other sites

My approach doesn't really generate equal length edges.

I was thinking that a virtual spring force could be applied to the edges to draw them closer to each other, and then repeat that in a for/each. I gave it a try, but sadly couldn't get it to work.

I'm sure someone as a VEX node somewhere that does averaging of edge lengths correctly.

##### Share on other sites

Thanks Anim.

Trying this method with more complicated objects we notice that it is not stable.

Surely this should be possible.

Like 3d pelting.

Hmmm.

foreachexample.hip

##### Share on other sites

Does any of the geometry contain convex hulls?

##### Share on other sites

Does any of the geometry contain convex hulls?

Possibly, but it wouldn't be extremely convex.

In any case no holes, so that in principle a blend into a sphere would be possible.

##### Share on other sites

I'm off to bed now, but maybe you can explain something to me. As the documentation in Houdini isn't very clear.

When working with a For/Loop in a VEX SOP. How is the output calculated? I mean, how do something like take a constant as an input and then sum it by the total number of steps in the loop as the output. So that, if the constant was 1 and the Loop went from 1 to 10, then the output should then be 10.

Did that make any sense? I basically don't understand how the output of a For/Loop works.

##### Share on other sites

Here is an example Hopbin.

The thing to remember with the forloop vopsop is that you need to plug in the value that you want to modify. If no modification occurs (due to a logic decision) then it will pass the input value out unchanged. If a condition is met it will evaluate whats inside the loop, but you have to plug that parameter in!

forloop.hip

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×