Calculate solid volume part II

Started by
4 comments, last by Randy Gaul 8 years, 10 months ago

Now i know how to calc a solid volume, but i found that i will have to slice that solid by 4 planes that will shrink it, i am wondering if i could do a fast clip without involving csg into that (way too expensive - i need that to run realtime). Any ideas how someone could do that

i can iterathe throug faces/vertices do some fancy stuff but i rather want to avoid outputing new vertices and storing the output solid to another part in memory.

eppo went with idea of using spheres as volume then slicing it with a plane maybe this is easier but for now i dont know how to do this either.

Advertisement
Just try it out as you have it now. It will probably be fast enough. If you find later it doesn't run fast enough then try to speed it up.
My current game project Platform RPG

problem with csg operation is that i need to allocate new chunk of memory->delete old one, recalculate all face normals, recalculate all faces center points etc. i will need models that i will perform csg on for one ship i plan to use more than 10 ships, + i am targeting mobile phones...

Stencil masking, though I doubt it will be faster if you have more than one volume concurrently.

Another alternative is clipping planes in a shader. For 4 planes it shouldn't be a problem (clipping the volume to the planes), but you probably have to clip the 4 planes themselves to new vertices if the original volume has many planes and you need that new polygon to close the clipped volume.

EDIT:

I probably misunderstood.. perhaps you just want a fast way to calculate the clipped volume, I was thinking about drawing..

yeah i am trying to calculate the clipped volume as fast as i can. :) thats for calcing buoyancy force for the ship

Oh you should have said you were doing bouyancy stuff earlier. Erin Catto has a very good article in Game Programming Gems on bouyancy + triangle clipping. The way it works requires no additional tools or authoring, and will work for triangle meshes (not necessarily convex).

I wrote a bit about it here, but be sure to also read his article (I think in programming gems 4, maybe 3): http://www.randygaul.net/2014/02/14/buoyancy-rigid-bodies-and-water-surface/

But you did say 4 planes. If you're doing bouyancy stuff, why 4 planes instead of just 1?

This topic is closed to new replies.

Advertisement