Archive for May 28th, 2009

Time to remove that grin from my face

Thursday, May 28th, 2009

I’m basically looking for a new job. If you want to know the details, if you have a nice position to offer, or if you just want to say hello, please use the previously created email.

New email

Thursday, May 28th, 2009

Please use this new email from now on. Hopefully that one will remain active each time I have issues with this website.

Immature game development

Thursday, May 28th, 2009

I just noticed this post here, that I somehow missed before. I suppose it means game development was immature at Grin before February 2009? This might explain that.

Character slicing demo

Thursday, May 28th, 2009

Here is a small “character slicing” demo that I was working on recently. It started as an innocent discussion at work. Somebody asked if it would be technically possible to cut a character at runtime with an arbitrary plane, and have the cut pieces continue using the character’s animation file for some frames, before going ragdoll. Some people said “forget it” because of the huge amount of work involved. I said “yes you can”, and then went ahead and proved it:

www.codercorner.com/Code/CharacterCutDemo.rar

The demo was made at home in the evenings, using an old Unreal character. Here is a video featuring a more modern character:

http://www.codercorner.com/Movies/CharacterCut.avi

There is a ridiculous amount of steps in this algorithm, although all of them are relatively simple. On top of my head:

  • do software skinning for one frame, to get access to the character’s geometry
  • cut the graphical mesh with a plane. This creates new vertices and triangles.
  • compute new vertex data for the new vertices. You can lerp your way out of troubles for position / UVs / normal(s) / colors, but you can not interpolate the skinning data, so you need something else to figure out bone IDs and weights.
  • triangulate the hole(s) you just created in the character’s surface. Replicate boundary vertices, compute new vertex data for those.
  • optional: update vertex colors so that the vertices nearby the cut plane get a red tint.
  • re-split the character for HW rendering (e.g. see “Skin Splitting for Optimal Rendering” in GPG6). When using HW skinning the character has already been cut to several batches, each batch using a limited number of bones depending on HW constraints. The nasty thing is that you can not cut each batch individually, as it creates troubles later on when triangulating the holes. So you need to put the skin back in a single batch, cut it, then re-split it according to HW limits.
  • slice the bones’ bounding volumes. This may only work with boxes and convexes, as a sliced sphere or capsule gives you a non-trivial shape that your physics API might not support. Recreate physics shapes for cut volumes.
  • duplicate physics bodies across the cut line. One issue here is that a vertex on one side of the cut plane might still reference bones located on the other side. So you need to choose between either fixing all the (now) invalid bone references in the vertex buffer, or let the bones exist as ghosts on the other side of the plane. Both approaches have pros and cons.
  • disable joints across the cut line. Some subtleties here.
  • create two new skins with the newly created graphics data, skinning data and physics data…
  • optional: add extra effects like particles or blood spats, and sounds

I’m glossing over a fair amount of minor details and potential refinements, but that’s the rough road map.

shopfr.org cialis