Volume calculator

Volume calculation is now included in my personal Blenderbuild:

http://www.silentthunder.de/files/blenderintel.zip

The label below “TexMesh” shows either the volume or surface after clicking the appropriate button somewhat below.

Altering size of an mesh/object will result in change values (after clicking buttons again)
An “open” mesh will give wrong results for volume but surface will still be correct.

Wouldn’t it be easier to calculate the volume exactly? Simply take each triangle and calculate volume of the prism under the triangle. If normal points down, subtract it. If normal points up add it. So you get the total volume. The conditions for the body are similar as yours. The normals have to point outside the body and the body has to be closed. It does not need to be convex.

If you know about that method (or if it comes to your mind), yes.
Sombody on Blender.org already pointed that out and i’ve just implemented it
Works great.

This would be great for softbodies, like gel and the suchlike. a force on each face proportional to the volume difference as well as gravity.
What kind of speeds could you get for this, anything apporaching usable for animations (not realtime, just for simulations)?

Ian

Well the algorithm i am using can calculate the volume AND surface of a 20480 polygon object (#5 ico-sphere+1x subdivide) within 0.01 second.

EDIT:
i am so proud (preview):

this algo will utterly fail on something like this
http://www.matheboard.de/lexikon/Kleinsche_Flasche,definition.htm

and you can bet, artists will model something like that

So i would not want to rely on it for general softbody dynamics.

btw. Maya and co rather use simple tricks to get nice results. Having real volume preservation is something for FEM on high speed clusters.

/BM

a klien bottle [as it is called in english as far as I know, haven’t seen them formally] doesn’t have an inside or out, so of course it would utterly fail

as mentioned, it requires proper normals, which doesn’t make sense [in 3 dimensions] for a klien bottle

[but it is an interesting point nonetheless, I’d imagine an artist would unlikely create a single sided surface and they probably can understand the concept of why it wouldn’t work]

btw. Maya and co rather use simple tricks to get nice results. Having real volume preservation is something for FEM on high speed clusters.

True, but using volume calculation that is as fast as that, as well as surface calculation, a nice soft-body effect could be done. The volume need not be preserved, just the forces need to be calculated to low accuracy. To preserve the volume would require more accurate solutions after the volume calculation rather than this.

Ian

How do I use your program?

I’ve included it in my x86 Optimized build. Check the first post of this thread.

For the speed thingy again:
If i create a UV sphere with 32x32 and appliying several subdivison such that it got 256144 polygons and then clicking my Volume/Surface buttons i cannot recognize a lot of delay till the result shows up.

And i guess a single mesh with 256k polys is already considered “large”