Building a sphere with random holes

Hey ho,
I am trying to make a sphere with holes in it. Which seems pretty easy but for me apparently isn’t^^
Well, actually I managed to do it both by boolean SOP and hole SOP but the problem is that they don’t actually make empty holes into it. There are still circles with polygons so when I put all that into a GEO it’ll show the holes instead of a sphere with empty holes.

The next problem would be, to place the holes randomly around the sphere. Like that they are still attached to the outlines of the sphere but not at the joints of the polygons but randomly.

I tried explaining my case as good as possible but if you have problems to understand it, I’ll be happy to clarify… Maybe the pic will help…

Hi @madamecelindra,

this is a very nice project :slight_smile:

The first issue (no holes) can be solved by activating the Create Groups parameter in the Boolean SOP and appending a Delete SOP where you select one of the created groups to be only left with the sphere with holes.

I thought the second task could be solved with the Copy SOP’s Stamp feature: Stamping let’s you specify a “parameter” in the Copy SOP’s Stamp page which can have a different value for each copy created. This “parameter” can then be used upstream to the Copy SOP and therefor change the copy and template data for each copy.
Unfortunately though stamping seems to only work on the copy data. You could for example make every hole a different size and randomize things that way: enable stamping on the Copy SOP and define a parameter with the value being an expression: tdu.rand(me.inputPoint.index) this will generate a random number for each point from the template input (your original sphere). Now in the Transform SOP you are using on the spheres being copied onto the original one, use the function fetchStamp('yourStampParName', 1) on the Uniform Scale parameter to change the scale of the copy sphere for every point - the result being that every hole will have a different size.

For randomizing their position, I wonder if you could use a Divide SOP, Subdivide SOP or similar followed by a Add SOP where you delete the Geometry but keep the points. Now utilizing a Sort SOP, randomize the point order and follow this up with a Delete SOP where you delete the difference in points to your original sphere.

Hope this helps
cheers
Markus

Hi again @madamecelindra,

actually creating the random points on a sphere can be quickly done with the use of a Copy SOP and stamping too.
Imagine you have a single point that sits on a sphere with a radius of 1. That point could be described using a Add SOP with the point position being 1, 0, and 0. Now appending a Transform SOP and using the fetchStamp on the Rotate parameter before feeding it into a Copy SOP, will create x random positions on a sphere surface.

For number of copies on the Copy SOP, I used 50 in this example.

Cheers
Markus

Hey @snaut ! Thanks for your fast answer.
Your solution for the first issue worked perfectly fine if I apply it to my old system.
With the second issue I am having problems probably because I don’t entirely understand it^^
Question 1 would be: How do you get to the amount of the multiplications in the parameters of the Copy SOP. *360 I understand but where do the ones for the copyIndex come from?
Question 2: In both ways of randomizing the points I have the problem that the points are not big enough that the Boolean or the Delete SOP would work with them.
Sorry for the probably very stupid questions for someone who actually understands this program^^

Hey @madamecelindra,

the .copyIndex is a member of the Copy SOP Class and is the index of the copy currently processed by the SOP. So for each copy the SOP is creating this value counts up by one and can then be used upstream via the stamping feature. The tdu.rand() function generates a random number with the .copyIndex being the seed.

These points can now be used as template points for another Copy SOP which creates copies of the spheres that are suppose to create the holes at every position of the random points. The result can now be used as one of the inputs to the Boolean operation.

Attached is a example file
Hope this helps
Markus

holesRnd.tox (10.0 KB)

Thanks! I think I still didn’t understand all of it but with your file I was able to make it work!

You might be able to achieve similar results with a sprinkle SOP

1 Like

@Achim - nice one - absolutely!