Need help with model cutting and model deforms for darkplaces engine
Members - Reputation: 101
Posted 21 November 2012 - 12:55 PM
I would like to add an axe to a mod I'm working on. I've allready added 4 other ancient weapons including caltrops and a torch that burns, gives light, and extinguishes in water, also other bludgeon weapons and ancient ranged weapons.
I cannot add an axe or a sword however because it would not be any different than the bludgeon weapons without some darkplaces engine modifications: the axe needs to cut and cleave that which it is brought against, for this there need to be routines in the darkplaces engine that cut things via a plane and then either loop-fill the hole or just mirror the new model on the inside with a blood texture (easier) (depending on species).
The subroutine would need to accept a few parameters: coords of the cut plane (ofcourse), texture to use for blood, weather to loop-and-fill with new polygons the hole or to just copy-reverse the new model(s) and make an interior hull (easier).
This could all be placed in a modeldeforms.c for darkplaces.
Other deforms that would be nice could be: shatter (model is reduced to collections of it's triangles), shrink/expand, collapse (think disolve in acid, model is collapsed/shrunk towards the bones), cave-in (radius is given and point, any part of the model that is in this radius is collapsed away, thus looking like a cave-in).
Here's a zip of just the engine: http://ompldr.org/vZ2R0dA/darkplacesforxonotic.zip
Members - Reputation: 101
Posted 21 November 2012 - 12:58 PM
This is what other developers for darkplaces suggested:
<Sniper|AFK> By model cutting, what are you referring to?
<Space_Man> laser scalpels
<Sniper|AFK> Seemingly that shouldn't be terribly difficult to implement
<Space_Man> human or animal models? there is an important ethical difference
<Sniper|AFK> For the physics system being used, you'd create a new actor or entity to handle the newly created pile of guts or whatever.
<Space_Man> no sane person wants to experiment on human models
<Space_Man> but a cute dog model...
<Sniper|AFK> Let's say you chopped off a leg.
<Sniper|AFK> You'd need to load up the model's verticies, create a clipping plane for the slice, and designate which polygons were affected
<Sniper|AFK> Two new models would need to be created,
<Sniper|AFK> The "hole" in the leg would need to be filled with an appropriate "blood and guts" textured mesh
<Sniper|AFK> You'd probably designate a particle system for the center of the newly created hole, at which point blood gushes out.
* LordHavoc has quit ("Client exiting")
<Sniper|AFK> The physics system would take care of the collision of either mesh.
* LordHavoc (~firstname.lastname@example.org) has joined #darkplaces
* Caleb gives channel operator status to LordHavoc
<Sniper|AFK> Something to that effect.
<Sniper|AFK> Obviously there'd be more to it, but overall, I'd probably code it in those steps.
<Sniper|AFK> As for the actual slicing and filling of the model, I'm sure there are papers around for that.
The game and engine are GPL licensed, so virtually anything can be done with it.
<Spoike1> no, none.
<blendarer> I just want.... model cutting and deforms
<blendarer> and I.. don't know how to do this
<Spoike1> oh, is that all?
<blendarer> suppsidly it's easy
<blendarer> that's all
<Spoike1> aye, it is really easy...
<Spoike1> doing it in realtime in a persistant manner on the other hand...
<Spoike1> especially if you want the severed limb to fall on the ground instead of instantly vanishing in an immersion breaking way
<blendarer> be given an entity and fall on ground like a gib
<blendarer> (doesn't need to be properly min/maxed or anything)
<Spoike1> if you have a mesh and a plane to cut along, you can test the distance from the point, and figure out the fraction and midpoint
<Spoike1> problem is that in an animating mesh, that mid point moves.
<Spoike1> and the plane bends too.
<Spoike1> and the animations kinda expect there to still be an arm or whatever to counter balance the animation's momentum, etc
<blendarer> could still keep the bone there?
<blendarer> (but no verts )
<blendarer> I made a thread here http://forums.xonotic.org/showthread.php?tid=3666 about that
<blendarer> but whatever's simple is fine too, something is better than nothing
<Spoike1> easiest way is to likely build the mesh, figure out the interpolant values, and then generate a completely new mesh from the original mesh. then import animations from the origional model into your new mesh.
<blendarer> if animation can't be done this could just be a death effect which wouldn't be called unless the blow's dmg reduced theirs to less than 0
<blendarer> Spoike1, in the engine?
<Spoike1> using vertex weights to figure out the new midpoint of the lines on the cuts
<blendarer> may I post these things to that thread (so others can read the ideas?)
<Spoike1> do whatever you want, so long as I don't have to stop being lazy.
<blendarer> are there any turtorials on darkplaces I can read to learn how do work with it and maybe do this
Members - Reputation: 101
Posted 21 November 2012 - 01:28 PM