Rotting corpse bonanza!

Published November 13, 2004
Advertisement
I've just had an idea for doing rotting corpses that I think could be highly cool. The context is corpses for Zombie Nation, though it's probably usable anywhere.

It requires that the corpse model be in two parts - a 'skin,' which is the part that rots, and a 'skeleton,' which is what will show through the rotting skin and be left behind when the skin is all rotted away.

What you do is to set up a 'rot map.' This is a simple greyscale texture applied to the skin mesh which determines how long before that texel on the skin becomes completely transparent. To avoid all corpses rotting in the same way, you could create a bunch of different rot maps and pick one at random when a corpse is created.

You apply the texture to the skin mesh normally, and in the pixel shader, sample the rot map. Subtract a constant value passed through the pixel shader constants - that represents the time elapsed since rotting started - clamping it to the range [0..1]. That's your 'rot value.'

If you pass in a constant 'rot threshold,' perform a max(value, threshold) and then a mul(value, 1/threshold), you'll get a result that stays constant at 1.0 until the rot value drops below the rot threshold, when it begins to drop linearly to zero.

Copy that result to the alpha channel of your output. The skin will thus stay mostly opaque, until rot values start dropping below the rot threshold, whereupon the skin will become translucent and eventually transparent. (Ideally we'd alphakill, but we can't do that on ps output).

Render the skeleton inside and you're onto a winner, as the bones begin to show through the rotting skin.

You could even do it with multiple layers - skin, guts, bones - and apply the same rot map to both skin and guts. Then offset the time elapsed for the guts layer. The skin rots away first, and then the guts start rotting away afterwards. If you use the same rot map then the parts of the guts that have been exposed the longest will rot first.

Mwahahaha.

I should knock up a demo of this.
Previous Entry Curves
Next Entry Brainfart
0 likes 1 comments

Comments

evolutional
You always have the best ideas [grin] I demand request a demonstration.
November 14, 2004 07:00 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement