bubble geometry in houdini

   13750   6   0
User Avatar
Member
22 posts
Joined: 11月 2006
Offline
hi all,

would like to know how to make water bubble geometry in geo. i want to have spheres interecting sharing a flat surface and not the curve surfaces when i surfsect (for nurbs) or cookie (in polygon)…

i tried to scale down to 0 after surfsecting two sphere taking their intersection. this may work for 2-3 spheres… would like to know if there is more efficient way to do it especially when i want to try it on large numbers of interecting spheres.


thats something i like to acheive


thanks
User Avatar
Member
257 posts
Joined: 11月 2007
Offline
sounds like voronoi fracturing to me, with manipulation of the outer surfaces to fit a sphere to the outer shape. Check out Johner's tool:
http://www.sidefx.com/exchange/info.php?fileid=660&versionid=660 [sidefx.com]
and:
http://forums.odforce.net/index.php?/topic/9119-voronoi-dynamic-location-based-fracture-wip [forums.odforce.net]
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
22 posts
Joined: 11月 2006
Offline
thanks for sharing, now i get some general ideas of how it works… however,i have loaded the voronoi_fracture .otl file, but somehow there are warning messages-
oplibSop/jl_voronoi_fracture?Sop/jl_voronoi_fracture Warning(431): Unknown parameter type - assuming float

strange!

cheers
User Avatar
Member
1145 posts
Joined: 7月 2005
Offline
Depending on how old the otl is you may be getting errors due to changes in newer houdini versions. Provided the tool still works you can safely ignore these.
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
874 posts
Joined: 10月 2008
Offline
Do you want a physically correct model? Intersecting bubbles will not have flat intersection surfaces, but curved ones. There's an additional problem in that you can't just place a second or more bubbles arbitrarily because they choose their own distance from each other (because they want to equalize forces).

It's an interesting problem though. Hmm. Maybe if I have time and a flash of insight I might try something.
--
Jobless
User Avatar
Member
874 posts
Joined: 10月 2008
Offline
This may not be what you want but I thought it was interesting so I looked into it a little.

Below is a python script for the intersection of two bubbles. It takes a sphere as an input and from a given radius of a second sphere it calculates its position from the center (it's center is never on the first spheres surface unless they are exactly the same size). Then it places that bubble randomly on the surface (sphere symmetry, so no preferred position).

A third sphere is calculated which represents the intersecting surface. The 3 surfaces always create angles of 120 degrees between them.

I also attached a vopsop version that is more interactive but less transparent on the algorithmic side.

There is a solution for 3 bubbles but as far as I know there is no known exact general solution for n-bubbles, although people have “faked” it of course.


Here is the code. It's a bit flaky.


import math
import random

# This code is called when instances of this SOP cook.
geo = hou.pwd().geometry()
points = geo.points()
# Add code to modify the contents of geo.

#——Get radius——————-
def getRadius(nodename,sphere_name):
nodepath = nodename.path() + “/” + sphere_name
obj = hou.node( nodepath )
r = obj.parm(“radx”).eval()
v_pos = hou.Vector3()
return r, v_pos

#–Make Merge————————————–
def makemergenode():
nodename = hou.pwd().parent()
nodepath = nodename.path()
obj = hou.node(nodepath)

if hou.node(nodepath).glob(“mergebubble”) !):
pass
else:
print “make merge”
obj = hou.node(nodepath)
merge = obj.createNode(“merge”,“mergebubble”)
merge.setDisplayFlag(1)


mergeobj = hou.node(“/obj/sphere_object1/mergebubble”)
print mergeobj, type( mergeobj)
for i in hou.node(nodepath).glob(“sphere*”):
mergeobj.setNextInput(i)
#

#–Make Sphere————————————–
def makesphere( name, center, radius ):
nodename = hou.pwd().parent()
nodepath = nodename.path() #+ “/” + sphere_name

if hou.node(nodepath).glob(name) !):
pass
else:
obj = hou.node(nodepath)
bA = obj.createNode(“sphere”,name)
bA.setTemplateFlag(1)
# bA.insertInput( hou.node(nodepath+“/mergebubble”) )
pt =
pr =
pt.set(center)
pt.set(center)
pt.set(center)
pr.set(radius)
pr.set(radius)
pr.set(radius)

#——Calculate B sphere properties—————-
def makeB(vs,radii):
#make a new sphere
A, rA = vs,radii
rB = random.random()*rA
radii.append(rB)
rC = (rA * rB)/(rA-rB)
#find position of B
dAB = math.sqrt(rA**2 + rB**2 - rA*rB)
#knowing the AB distance we can randomly place B around A by converting to spherical coordinates
r = dAB
theta = random.random()*math.pi*2
phi = random.random()*math.pi
x = r*math.sin(theta)*math.cos(phi)
y = r*math.sin(theta)*math.sin(phi)
z = r*math.cos(theta)
B = hou.Vector3()
# find C
dAC = math.sqrt(rA**2 + rC**2 + rA*rC)
vAB = B - A
C = A + (vAB.normalized() * dAC)
dAC = math.sqrt( rA**2 + rC**2 + rA*rC )


# make sphere geometry
bubblename = “sphereB”+str(rB)
makesphere( bubblename , B, rB )

bubblename = “sphereC”+str(rC)
makesphere( bubblename , C, rC )


#—–MAIN———————————
def main():
nodename = hou.pwd().parent()
sphere_name = “sphere1”
r,v = getRadius(nodename, sphere_name)
radii,vs =,

for i in range(2):
makeB(vs,radii)

makemergenode()
nodepath = nodename.path()
# print hou.node(nodepath).glob(“sphere*”)


#—————————————-

main()
print “————”

Attachments:
s2.jpg (7.4 KB)
s1.jpg (15.4 KB)
vopsop version.hipnc (367.1 KB)

--
Jobless
User Avatar
Member
874 posts
Joined: 10月 2008
Offline
And a cookie version of the same thing.

Edit: Bug: It doesn't work if you move sphere A. You've got to add the A position to the B vector, and it'll be fine.

Attachments:
vopsop version cookie.hipnc (380.4 KB)
cookiev.jpg (30.3 KB)

--
Jobless
  • Quick Links