Kekouan

Q2Model, Part 6

2023-03-13

Actually, I went back to look at what I worked on after getting the model to render with a texture. Turns out it was animations and figuring out the PCX file. Indexed primitives would turn out to be a colossal pain, but I figured out animations and the PCX file first.

Animations

a frame of the Astroboy animation

a different frame of the Astroboy animation

The way animations work in the Quake 2 Model format is to store the vertex positions of every vertex at that point in the animation. So the stand animation for this model is 40 frames. My rough initial version looked like this:

an animation of the Astroboy stand animation

It's going a bit quickly and I am not interpolating the values between frames, so it's fast and jerky.

There appears to be a standard set of animations, but I've seen models where people have added their own animations:

Some of these are only ~10 frames, whereas the the stand animation has 40 frames in the Astroboy model.

Through the cunning use of interpolation (instead of switching to the next position immediately, transition between the two) and slowing it down a bit:

an animation of the Astroboy stand animation, with interpolation

Delightful.

PCX Files

The textures for Quake 2 Models are stored as PCX files, a delightful image format that was getting long in the tooth even in 1997. I thought this was going to be a vastly more difficult problem to solve. I had the good fortune to find someone who wrote a Quake 2 Software renderer in Swift, and they had to contend with loading PCX files as well.

A bit of tinkering later, and I had this to show for it:

Astroboy model with a texture loaded from a PCX file

Everything is brighter now for unknown reasons, is this the way it's supposed to look? Unknown.