Sign in to follow this  
  • entries
    375
  • comments
    1136
  • views
    297498

Rotting corpse bonanza!

Sign in to follow this  
superpig

85 views

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.
Sign in to follow this  


1 Comment


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now