Tuesday, March 30, 2010

Lights! Camera! WAAAAGGGHHHH!

I have been spending most of my free time on Warhammer, mainly reading and painting (I've found a few people mildly interested in playing, but no-one seems to have the time). I've made a start on some custom models, which I think will be pretty unique, and I'll tell you why.

First let me tell you about something I don't understand, but that's interesting nonetheless: plasma balls are scary. Take a power testing screwdriver and hold it near a plasma ball. It doesn't even need to touch it to light up. What's more, if you open the screwdriver and remove the bulb, then just hold it near the plasma ball it will light up - that's all it takes. Hell, if you put it close enough or touching the plasma ball you won't even need to touch the bulb (though touching the bulb seems to provide an earth and allow a better current flow). If you place a small piece of metal such as a coin (I found the metal spring from an old pair of headphones works well) on the surface of the plasma bulb and connect it via a cable to the bulb, it will light up at a distance (if you touch the bulb it will be even brighter).

Holding the screwdriver close to the plasma ball is enough to light it (don't ask why the sides of the plasma ball have been cut off).

The bulb from inside the screwdriver also lights when held near.

The bulb on it's own. It isn't actually touching the plasma ball, but it does need to be very close.

Just holding your hand close is enough to brighten it.

Connecting the bulb to the plasma ball using a simple cable and the spring from an old pair of headphones.

"Stealing" the current: the bulb no longer lights up.

Now the really important thing about all this is that you have a relatively small bulb that lights up when connected to it's power source by a SINGLE cable. Why is this important? Because it means we can install the bulb in a model and we don't need to connect the model with two cables. If done right we only need to place it on a metal surface that is connected to the plasma ball, allowing us to pick it up move it around freely without any annoying cables, and it will still light up! I've already installed some bulbs in a couple of models:

A Grey Knight Terminator (with a failed undercoat).

When connected to the plasma ball by a single cable (through his leg), it lights up!

A Dreadnought (that will eventually be a Grey Knight Dreadnought) with 5 bulbs.

It's connected to the plasma ball ball by a single cable through the leg.

The metal nut is there so you can touch it to brighten the bulbs further.

The view from behind.

Now there is one more thing you can do here (and probably more that I haven't thought of yet), though it's not as impressive and actually far less reliable. When you place a piece of metal on the plasma ball, sparks (or an arc I suppose) will jump to skin or metal held very close - if you're not careful you can end up with an extremely small yet momentarily quite painful burn on your fingers. Allowing an arc to jump to your fingers for about half a second will produce a tiny visible burn (and the small of burnt flesh) without causing any pain, but longer than that and it could hurt. I once burnt a mark into my fingernail by accident, that was rather painfull and the mark was visible until it grew out.

You can get a "captive spark" to jump on a model, but it's tricky to do and the spark is very small, and you need to touch the model to complete the circuit or else it just won't jump. Also you cannot mix sparks and bulbs on a single model, not with any degree of reliability anyway, as my Dreadnought taught me - the messy holes in his Multi Melta are from a failed attempt to get a spark to jump between the barrels. I actually got the spark to jump on occasion, but the bulbs wouldn't light unless the spark jumped. If I wired it up differently the bulbs would work better but the spark never would. Instead I got a spark on the end of a Grey Knight Brother Captain's incinerator. It's reasonably reliable, but the problem is that I think the spark might actually be slowly burning away the metal. It might just be something else or just random luck, but the spark is less reliable now than when I first set it up. Time will tell I suppose.

Grey Knight Brother Captain.

The spark is small yet visible.

This was a hard picture to take, but it shows off the spark a little better.

I will place more detailed descriptions of how I installed the bulbs later, probably after I actually paint the models. I'm putting off the painting until my skills improve a little, as I really want these to look good. As you can see I'm having some trouble with the undercoat layer on metal models, so I still have some things to figure out. By the way, a plasma ball will also light a neon bulb in the same way (the basis of my old home-made lightsaber), but as the smallest neon bulb I have is about the height of a Dreadnought and as thick as his arm, I don't see it as being good for anything other than scenery, and I'm not there yet (besides, since scenery is quite fixed in place the "one cable advantage" is less pronounced). Also, using an oven lighter (the kind that just makes sparks) will also light the bulbs, but they will flicker and you really need two cables then. Good for showing off the models when transporting them I guess. In theory with some work you could use the bit that makes the spark on cheap lighters, but... no.

Wednesday, March 3, 2010

Of course...

I was mistaken yesterday when I thought I had solved all the problems. Of course. Because my mesh was not written (by hand) correctly to begin with, I didn't realise that when it looked right, it was actually wrong. I fixed the problem, but now something else is not quite right: there's some strange offset showing up when I rotate a bone around a joint. I'm still trying to figure out where that came from, I guess I have to re-think everything again.

Tuesday, March 2, 2010

Life is strange sometimes

I appologise in advance for a whole lot of boring detail you don't want to read, but I want to get off my chest.

I spent a good bit of time trying to get the animation system to deform meshes correctly, but I just couldn't quite get it to work and I couldn't figure out why. So I stopped working on it for a good long while. Now when I get into something, I really get into it - for a while. It may take months, but eventually I cool down and my enthusiasm dies. From the moment I came up with my current game dev plans I knew that once my obsession cooled I would stop working on the game, so I worked as hard as I could while the idea was still fresh, hoping that the progress I was making would sustain me. And it did, for a while. But eventually work, video games and Warhammer just pushed the project to the back of my mind.

So I've barely touched the code over a month. I wrote a bit a couple of weeks back, but then I undid all my changes and reverted to what was then month-old code. But it still gave me a better idea of how to solve the problem, and every once in a while I would spare a little thought to the issues I was having. And then today I finally sat down and in under two hours I re-wrote a good deal of the animation code and fixed all the problems. Under two hours. Days of coding in circles, six weeks of avoiding the problem, then two hours to fix it. In a way it's amazing when it happens, but on the other hand it makes you wonder what you were doing wrong the rest of the time.

Anyway, my mistake was that I was not applying bone length correctly, this wasn't a problem sometimes but it screwed up the inverse bind matrix, which made the problem hard to spot. I also removed the bone offset (this can be replaced by intermediate bones, it may be less efficient in some cases but typically the offset is not used so this is slightly more efficient for most rigs), but now that I've figured out the way the bone length is applied I beleive I can easily put the offset back in later if I decide I want it back.

So here's a couple of quick, and rather unspectacular, screenshots. Now I think I need to replace the linear interpolation of the matrices with a spherical linear interpolation, perhaps replace some of the 4x4 matrices with 3x3 for efficiency, then finish implementing the system in the actual animation pipeline. Then of course figure out how to get actual model bone and animation data out of blender and into my engine (either write custom exporters in Blender, which requires learning python, or writing an importer or converting from some other format - which I actually expect to be just as hard of not more so), which of course I can't do until I figure out animation and skinning in Blender... ugh, this is going to take forever, and those Warhammer armies aren't going to paint themselves either.