Need help with model cutting and model deforms for DP engine

Ask us questions.

Moderator: Developers

Need help with model cutting and model deforms for DP engine

Postby Haeylleh » 2012-11-20 21:47:41

I Need help with model cutting and model deforms for darkplaces engine.

I was wondering if a developer could help add a feature to the opensource darkplaces engine. Model cutting and model deforms.

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).

Some models ingame:
[img] ... u8a6b9.jpg

[img] ... wy3jnq.jpg
Posts: 4
Joined: 2012-11-20 21:43:30

Re: Need help with model cutting and model deforms for DP en

Postby Haeylleh » 2012-11-21 18:41:47

Here's a zip of just the engine:

But here is how to download the whole game with all the source (the darkplaces directory has the engine): ... ory_Access

This is what other developers for darkplaces suggested:

<Sniper|AFK> By model cutting, what are you referring to?
<Space_Man> laser scalpels
<Space_Man> ?
<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 ( 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.

<Spoike1> no, none.
<blendarer> 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 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

The game and engine are GPL licensed, so virtually anything can be done with it.

Here's a crosspost to where discussion has taken place: ... &pid=52686
Posts: 4
Joined: 2012-11-20 21:43:30

Re: Need help with model cutting and model deforms for DP en

Postby Haeylleh » 2012-12-02 04:51:54

I posted a gameplay video of the mod sofar:

Goal of the mod is similar to the Unreal Chaos mod: more weapons, higher damage rate, more realism in the weapons (jams, manual reload, so on), and a better use of the current effects (gibs don't happen all the time, only with appropriate weapons or damage types, same with blood).

Added weapons are:
g98 rifle
explosives with regular and deadmans' trigger (suicide)
assault rifle
automatic shotgun

Additional weapons are:
pump shotgun
heavy machinegun
lightINing gun

changed weapons are:
uzi (now mac10 with ability to add silencer)
rifle (now is bolt action, uses LHutche's model, silencer can be added)

plus all the standard weapons. (All higher dmg rate, and nade shoots pellets too)

Additional vehicles:
cruizer (car)
audi (car)
camaro (car)
sopwith biplane
sopwith triplane
german fokker triplane
sparrow helicopter

Mounted Weapons added (you push them around, or they are on a pintel or circular mount):
maxim machine gun
lewis gun
spadu gun
m184 minigun (speed can be adjusted)
mh2b .50 cal
GRAIL energy weapon.

All the media is gpl or cc0 or cc-by. All the code is gpl (ofcourse!). Totally opensource mod, care was taken with copyrights, (but not patents etc).
The media source is available too.
Mod can be downloaded here: ...

Media source is at:

email at haeylleh at yahoo dot com if you are interested or want to help

(Also there are some added map things, a misc_ that fires crossbow and almost any other
type of projectile in the game at wherever you point it on the map (triggerable)
and a func_ that allows one to change the paintjob on his vehicle or (if
a certain spawnflag is set) himself (or both if both flags are set)

//This is misc_fire_crossbowbolt
//It allow you to have your map fire projectiles at things and people in the map
//Many ways to fire.
//Hope not too hacky

/*QUAKED spawnfunc_misc_fire_crossbowbolt (.5 .5 .5) ? START_ON DEST_IS_FIXED
Fires a crossbow bolt
Can also fire other things.
Where to fire the shot at (a target_position or so)
What triggers this to fire
sets which projectile to fire:
0 crossbow bolt
1 small fireball
2 crylink line
3 electroball
4 laserbolt
5 rocket
6 timed grenade
7 explosives
8 hagar grenade
9 EMP hook grenade
10 Uzi bullet
11 HMG bullet
12 shotgun blast
13 crylink ring
14 electro bolt
15 HLAC bolts
16 grenade
17 nex beam
18 big fireball
The reason for the mix-and-match listing is so if a mapper
is trying out each one, he will not see too many of the same
effect over and over and then think something is broken or
he has come to the end of the list before he has.
spawnfunc_target_position where the misc_fire_crossbowbolt ends
Posts: 4
Joined: 2012-11-20 21:43:30

Re: Need help with model cutting and model deforms for DP en

Postby Haeylleh » 2012-12-02 04:54:03

A thought I had was this: extrude and pinch == fills hole.
extrude the edge verts and then collaps all the new verts into one. That would fill the cut hole.
Posts: 4
Joined: 2012-11-20 21:43:30

Return to Contact

Who is online

Users browsing this forum: No registered users and 1 guest