Macha Posted August 16, 2011 Share Posted August 16, 2011 (edited) Does anybody know of a way to model interactively such that the volume of the geometry is preserved. It doesn't matter if the whole model scales, or just squishes one of the axes. If it preserves the volume it'd be happy enough! The trivial way would be to measure the volume and then just scale it, but could there be a neater method? Edited August 16, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
edward Posted August 17, 2011 Share Posted August 17, 2011 Off the top of my head, don't (voxel) fluids preserve volume? Quote Link to comment Share on other sites More sharing options...
Macha Posted August 17, 2011 Author Share Posted August 17, 2011 Hm, maybe an example to illustrate what I mean: Take a polygon shpere with volume v. If we push around some vertices the volume will (likely) change to v+d. I want a constant volume v after pushing around vertices. Scaling globally along one or more axes would be OK. For example, I'd like the total volume always to equal 1, no matter what I do to the sphere geometry locally. Quote Link to comment Share on other sites More sharing options...
kgoossens Posted August 17, 2011 Share Posted August 17, 2011 (edited) Hm, maybe an example to illustrate what I mean: Take a polygon shpere with volume v. If we push around some vertices the volume will (likely) change to v+d. I want a constant volume v after pushing around vertices. Scaling globally along one or more axes would be OK. For example, I'd like the total volume always to equal 1, no matter what I do to the sphere geometry locally. Hi Macha, Is this something you are looking for? Ow, just overlooked your first post so it is not what you are looking for. I don't think I get what you mean with a "neater method". DistortPreservingVol.hipnc Edited August 17, 2011 by kgoossens Quote Link to comment Share on other sites More sharing options...
Nerox Posted August 17, 2011 Share Posted August 17, 2011 (edited) Off the top of my head, don't (voxel) fluids preserve volume? Well I don't know in what kind of setup Macha is going to use this, but what Edward is pointing at is the 'non-divergence' step in volume fluids. It is used to make sure the velocity field doesn't collapse on it self or to avoid that 2 neighbor voxels flow towards each other which would lead to compression. Houdini has a micro solver for this, but since this is meant to work on velocity fields or motion I don't know how you would apply this to a static or even a scalar density field. From the top of my head, I'm making this up as I type , what if you turn the object in to a volume, count the number of voxels, compare this to v(number of voxels before the edit) and move points along there normal to compensate for the compression or decompression? I don't know how you can determ the total number of voxels, but I guess adding up the density of all the voxels does the trick? But how do you do that? Plus you probably also have to take the total area of the geometry in to consideration in relation to the volume in order to figure out how much you need to move the points in or out wards to compensate the volume. I'm sorry I can't give you a closing solution, but I hope this at least helps a bit to get there ;-). Edited August 17, 2011 by Nerox Quote Link to comment Share on other sites More sharing options...
Macha Posted August 17, 2011 Author Share Posted August 17, 2011 (edited) I haven't looked at the file yet because I haven't got Houdini right now but Nerox's idea makes me think of: -distort original geo -measure the total displacement that occured -on those points that haven't changed, get the total point number, divide it by previous total displacement and displace each previously unmoved point by that amount along its normal (negative) If the points are distributed evenly and the deformation not to great then this might a reasonable approximation. Perhaps we could even weigh the points by finding out how much area they cover and correct for that. Hmm! Or scale the whole thing (-moved points) by the square root of of, errrr, the difference of area or something, err Edited August 17, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted August 17, 2011 Share Posted August 17, 2011 I might try to make something that uses CHOPS or VOPS to compare your original mesh to the new one, then dump the value into a transform node. I remember working with volumes of figures and using integrals, but I don't have time to dig through the system right now and figure out how to do it. I am sure that using what I will learn this semester, this wouldn't be too hard if you could use the Point Position in VOPS as a vector field, then integrate it, you should get the volume. Then you would just have to figure out what kind of transformation you wanted to do to get them to match up. Hope something comes of that and I'm really anxious to see what you come up with for it. Quote Link to comment Share on other sites More sharing options...
zarti Posted August 17, 2011 Share Posted August 17, 2011 .. -distort original geo -measure the total displacement that occured -on those points that haven't changed, get the total point number, divide it by previous total displacement and displace each previously unmoved point by that amount along its normal (negative) .. makes sense , but depending on the points you choose to 'transfer' the displacement you also decide 'what kind of material that wd be' . balloon / mud / whatever else .. . ( if this is a criteria , oc ) Quote Link to comment Share on other sites More sharing options...
Macha Posted August 17, 2011 Author Share Posted August 17, 2011 By the way, the volume measuring isn't the problem, that's simply yourgeo>isooffset>measure Quote Link to comment Share on other sites More sharing options...
Macha Posted August 18, 2011 Author Share Posted August 18, 2011 Actually, I just tried the displacing idea I posted earlier and it works Quote Link to comment Share on other sites More sharing options...
Nerox Posted August 18, 2011 Share Posted August 18, 2011 Actually, I just tried the displacing idea I posted earlier and it works I don't know what you're up to but isn't it the case that difference increases between the surface area and the volume area the larger the volume gets? http://en.wikipedia.org/wiki/Surface-area-to-volume_ratio Initially I figured that this would be a problem, but I guess you can take it simply in to account when you compute how much you are going to move the other points? Quote Link to comment Share on other sites More sharing options...
Nerox Posted August 18, 2011 Share Posted August 18, 2011 By the way, the volume measuring isn't the problem, that's simply yourgeo>isooffset>measure Awesome! I would have never figured this out by my self, simply because I assumed that this node would only work on polygons :-). Quote Link to comment Share on other sites More sharing options...
Macha Posted August 18, 2011 Author Share Posted August 18, 2011 Awesome! I would have never figured this out by my self, simply because I assumed that this node would only work on polygons :-). Actually, it doesnt quite work as I thought. It gives the volume of the container... You can approximate the volume by counting the voxels with a certain density. Quote Link to comment Share on other sites More sharing options...
Nerox Posted August 18, 2011 Share Posted August 18, 2011 It appears to be even simpler :-). From the helpcard of the measure SOP: The volume of a polygon is the volume of the pyramid defined with the polygon as the base and the specified point as the apex. This volume is signed and can be summed with those of other polygons to get the actual volume of a 3D object. This summation can be done with an Attribute Promote SOP. This means that by using a measure sop, set it to 'Volume', append an 'Attribute Promote', Original Class = Primitive, New Class = Detail, Method = sum. Set your details view to detail and voila! You can actually prove this by this formula 4/3*pi*radius(power3). Bare in mind that this applies to a perfect sphere, so a more lowres sphere has less volume than a highres one. volumeOfAObject_V01.hipnc Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted August 18, 2011 Share Posted August 18, 2011 Damn you Nick, I just figured that out. I played with a box (easier to calculate the volume) and just used a point sop to add Rand($PT + #) to each direction. The volume calculation works like a charm. The same can be used with area as well to get the total surface area. That is a really neat trick, I may have to play with it some more. The curvature option in the measure SOP is very interesting. Still trying to find really good use for it, but it made for some interesting colors on the mesh when I used it. I am going to try to get a matrix for all of the volumes in a figure based on each polygon. Idk why, but it should be something that is useful. Quote Link to comment Share on other sites More sharing options...
Nerox Posted August 18, 2011 Share Posted August 18, 2011 Damn you Nick, I just figured that out. The pleasure is all mine Adam , I guess you were just 5 hours late ;-) The curvature option in the measure SOP is very interesting. Still trying to find really good use for it... I tend to use it to exclude points of certain operations that are in a very spiky area for instance. I can also imagine you can use it to drive attributes that are used in shading. Quote Link to comment Share on other sites More sharing options...
Macha Posted August 18, 2011 Author Share Posted August 18, 2011 Aaah, yes! Excellent for finding that Nerox. That'll be my trick for the day. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.