Complicated "birthing distribution" problem?

   7293   7   2
User Avatar
Member
56 posts
Joined: March 2006
Offline
I'm trying to create a deformable model of a roughly spherical probability cloud that is affected by an underlying lattice. As always, a picture is worth a 1000 words. The attached reference image shows a 2d slice through the cloud. In this cut, the lattice shows up as a tiled number ‘5’ on a die. You can see that the cloud drops off in intensity with radial distance from the centre, and mostly avoids both lattice locations (white dots) and the bonds that connect them. I don't have an analytic expression for the distribution, just this reference image and a .geo file of the lattice points and connecting line segments. To perhaps state the obvious, you can't just revolve this image to get the 3D distribution.

I've been trying unsucessfully for the last couple of hours to birth a distribution of particles that (i) drops off radially, and (ii) avoids the lattice sites and bond locations. I can't seem to get an overall metaball representation to work (a large ball for the overall spherical shape, small balls copied to each lattice point to subtract from this field). Such an approach would no doubt be quite computationally intensive?

I then toyed with an orthographic matte OpenGL rendering of a slice through the lattice, using COPs to create a suitable grayscale map that combined the slice image and a radial-drop-off map for driving the birthing. The problem here is that I would need create many side-by-side slices (and in XY, XZ and YZ planes) to give a reasonable approximation to the overall 3D distribution.

Once I've got this for the spherical distribution, I need to animate distortions of the overall spherical shape (into a teardrop, say). For these distortions, the underlying lattice itself will remain fixed. For the final look, I imagine a “globular cluster”-like particle feel rather than a more traditional smoke cloud. And no doubt I'll need to remove or make semi-transparent an octant or wedge to enable the viewer to get a sense of the inner structure. For now though, I'd be happy with a point cloud.

Any suggestions for possible approaches would be greatly appreciated ;-)

Attachments:
latticefield.jpg (57.3 KB)

User Avatar
Member
321 posts
Joined: July 2005
Offline
For birthing particles, what's worked for me is to birth evenly through space, but then use the density lookup function (which goes 0 -> 1) to *kill* particles, i.e. delete sop with densityLookup()>rand($ID).
Antoine Durr
Floq FX
antoine@floqfx.com
_________________
User Avatar
Member
56 posts
Joined: March 2006
Offline
Hi Antoine. Could you give me a bit more info on this method? Looking through both the expression and VEX references, I don't see a “densityLookup()” function. Do I need to write this myself? (I'm also confused by the “> rand($ID)”. What is the intent here?)

In any case, my issue at the moment is constructing a representation of the above 3D pattern. Starting with a large metaball (positive density), I tried adding small metaballs with negative weight at each lattice site to act subtractively (lower density in these regions to a minimum of zero). This is pretty computation intensive for even 5000 lattice sites.

I wonder if there is a better approach? For example, if I could construct a bunch of temporary geometry inside which no particles should ever exist, perhaps I could birth geometry only on the “outside” of this collection?
User Avatar
Member
7773 posts
Joined: July 2005
Offline
I'm pretty sure Antoine means “densityLookup()” as whatever method you use to determine your density value at the current 3D location.

If you're using metaballs, then you can save it out as a .bgeo file and then do the density look up using a Metaball Density VOP. If that is too slow, then you can use it to write out a .i3d file which discretizes into a 3D texture. Then you can sample it via the Texture 3D VOP.

http://odforce.net/wiki/index.php/I3d [odforce.net]
User Avatar
Member
321 posts
Joined: July 2005
Offline
futnuh
Hi Antoine. Could you give me a bit more info on this method? Looking through both the expression and VEX references, I don't see a “densityLookup()” function. Do I need to write this myself? (I'm also confused by the “> rand($ID)”. What is the intent here?)

The > rand($ID) is so that not all particles are killed, just a greater likelyhood are killed. If you have a density function that returns zero to one, density > rand($ID) will, as density approaches one, pretty much guarantee that a particle is killed, and as density approaches zero, pretty much keep it alive (you might have to reverse the greater-than/less-than sign to get what you want). If instead you just killed particles when density > .5, you'd have a solid set of particles on the inside, and none at all on the outside.

Whenever I approach a problem like this, I like to put it into 1D mode, i.e. put particles on a single line, e.g. the X axis. Then I apply my kill function and see what still lives, which is easy to tell when it's on a single axis. Even a 2D version is pretty telling. However, density functions in 3D are very misleading, as you often have “stuff” outside of the boundary that's “thicker” than what you expect, because you're getting a bit from all three dimensions. This is why you can first do it on a single dimension, and prove the math to yourself that it is working as expected.


– Antoine
Antoine Durr
Floq FX
antoine@floqfx.com
_________________
User Avatar
Member
56 posts
Joined: March 2006
Offline
Not having written any vex/VOP code before, I'm still struggling with getting this working. Rather than write out to disk, isn't it the case that I could create a SOP that takes a point cloud and metaball as inputs? In my case, the “subtractive” metaballs are static. They are created once by copying a metaball to each lattice point (white dots in the image above).

I'm actually a little worried now that I don't understand how multiple metaballs interact. I know you guys aren't suggesting this approach but on the sidefx list, Mark Elendt suggested “setting the weight of the little metaballs to a negative number … it has the effect of subtracting their weights from the sum.” I've attached a simple hip trying this out. As loaded, a negative-weight metaball (metaballSubtractive1) creates a nice negative space at the centre of a larger metaball (metaballMain). I would have thought though that two of these subtractive metaballs would either create a bigger hollow or, if arranged like a peanut, create two equal-sized hollows. I don't see this. Note that there are 3 takes showing the various results.

Re the vex/vop approach, I'd really appreciate if you could give a newbie some step-by-step pointers to writing this add-on. Even steps like “read this …” would be extremely helpful.

Cheers,
darran.

Attachments:
test_metaball.hip (288.3 KB)

User Avatar
Member
56 posts
Joined: March 2006
Offline
I've just spent the past few hours immersed in VOPs. It is nowhere near as intimidating as I had thought. While I haven't actually solved my problem, I'm seeing a tiny speck of light at the end of the tunnel ;-)
User Avatar
Member
54 posts
Joined:
Offline
i tried this myself, to learn about the metaball density VOP, and itworks fine - but only when exporting the metaball field to an external geo file and using that in the density VOP.

Is there any way to get the weight directly from a metaball field within the scene?
  • Quick Links