4
\$\begingroup\$

I'm looking for a resource to figure out how to program a function to cut a 3d model in game.

Example: Enemy/NPC is sliced into 2 pieces with a sword. His body is not hollow, you can see bloody texture where normally a 'polygon hole' would be.

The first step is to actually 'cut/slice' the model, then add in polygons to fill the hole in the model. I know this can be done in 3D modelling software, but I'm not sure how to go about doing this in a game, code-wise. I do not wish to use 'pre cut-up" models, the code will determine where the cut is.

Any pointers in the right direction would be greatly appreciated.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

What you want to look for are techniques for doing Constructive Solid Geometry, CSG for short. CSG isn't particularly hard (although numerical border cases might cause some trouble), but doing it in realtime isn't trivial.

Sander van Rossen writes interesting stuff about the datastructures he used for his particular implementation. His approach might be more approriate for animated character models than the standard BSP representation often used in non-realtime CSG.

A solid open implementation of rendering CSG objects is OpenCSG.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .