The stars aligned and at some point I decided to generate some dragons.
Sure, sometimes they end up looking a bit dopey, but there can be no doubt that these dragons are pretty diverse and unique. Some of them even are expressive! This post will look over the multitude of overlapping systems that in totality create these sneks.
The Worm
The dragons are in theory fully 3D modelled, but at some point the project stopped caring about the live animations. Basically, originally the dragon consisted of a spine moving in a zig-zag pattern, which tapered off in width towards the end. Imagine a rope going in an S pattern. This means the original dragons looked something like such:
Just without the head, that is. Even here this is a bit of diversity in the length and width of the body, though I did not spend much time on this, since other types of diversity are, er, more noticeable.
The Head
The head, however, is quite a lot more complicated. There are variables controlling the width and height of each five segments of the head. In total, it's not really something you notice too much, though the hope is it makes up part of the dragon's "personality". Also related to the head are, well, the eyes. These have a unique position, size, colour and, er, eyelids. I tinkered with these for days and I still am not satisfied with either diversity or homogeneity.
Instead of just doing normal patterns, one can create stripes by reeeally stretching one of the coordinates in the Perlin noise. On top of this, a gradient from front to back is also added in, meaning that the top one is fully striped at the tail, while the bottom one is not striped at all at the tail.
Talking about gradients, you might also get a dragon which has a ring around its belly. How adorable. This pattern is part of a series of three, where, respectively, the head, the tail or a part in the middle of the body are coloured in. To make it more natural and/or interesting, Perlin noise is added to create an interpolation.
Here we see the another pattern, as noted, where only the head is coloured in. You may also notice the strange, pale line along the top. This is the white belly of the snake. This texture belongs to this dragon, where you are lucky enough to actually see its underbelly:
Applications
So, why did I spend such a lot of time generating dragons? Part of it is because it's cool, y'know. I'm drawing some inspiration from Spore, of course, and the easiest type of creature to generate has to be a snake, or well, a serpentine dragon.
But I also kept alluding to wanting these 160x160 pixel renders rather than the full model. This is because I wanted to use them for this:
This might look quite similar to PokeHearth, and that's because it is. I realised it was a waste of time to spend so long making a game using trademarked Pokémon. Specifically, these dragons were used for the evolution of PokeHearth into the TCGTycoon.
This game would see you design your own cards for a Hearthstone-like game, and then have AI battle each other and evolve strategies and metagames. Your task is then to balance the cards as the AI finds more and more abusive strategies. But all of this is a story for another day. The point is that you might need thousands of pieces of card art - the cheapest alternative was a decent dragon generator and then taking background art from Convolutional Art.
As TCGTycoon is on indefinite hiatus, this is the current resting place for the dragon generator. RIP in peace.
The Worm
The dragons are in theory fully 3D modelled, but at some point the project stopped caring about the live animations. Basically, originally the dragon consisted of a spine moving in a zig-zag pattern, which tapered off in width towards the end. Imagine a rope going in an S pattern. This means the original dragons looked something like such:
Just without the head, that is. Even here this is a bit of diversity in the length and width of the body, though I did not spend much time on this, since other types of diversity are, er, more noticeable.
The Head
The head, however, is quite a lot more complicated. There are variables controlling the width and height of each five segments of the head. In total, it's not really something you notice too much, though the hope is it makes up part of the dragon's "personality". Also related to the head are, well, the eyes. These have a unique position, size, colour and, er, eyelids. I tinkered with these for days and I still am not satisfied with either diversity or homogeneity.
You may also notice that some of the dragons have their mouth open, ready to take a bite out of ya! It is incredibly hacky. When the mouth is open, a red rectangle and white triangles are drawn onto the skin texture, and then the whole head is duplicated, turned upside down and moved and shrunk, to form the lower jaw. This is one of the things that only work because I abandoned the live animation to just deal with single image exports.
The Skin
Compared to how much you really pay attention to it in the end, a lot of time and care was taken to make the skin textures as good as possible. I'm quite proud, honestly. I mean, I never actually exported the textures before now, so this is genuine pride in my past self.
The textures are generated on a pixel-by-pixel level according to some functions. Some functions are the same for all dragons, and then there are ten different types. But on top of this, the way the different colours play together, as well as a range of other variables, create way more than ten types of skin.
So let's take a look at some skins:
Each skin texture is made from three colours. The primary colour, an alteration thereof, and the secondary colour. The primary colour and its alteration are used to create the base texture. Then the secondary colour, which is often different both in hue and brightness, is overlaid according to one of 10 colouring schemes. The two above colouring schemes use Perlin noise to create a pattern, one of them with stretched Perlin noise. If you notice that the left part of the texture is brighter, it's because that's the part that's applied to the dragon's head.
Talking about gradients, you might also get a dragon which has a ring around its belly. How adorable. This pattern is part of a series of three, where, respectively, the head, the tail or a part in the middle of the body are coloured in. To make it more natural and/or interesting, Perlin noise is added to create an interpolation.
Here we see the another pattern, as noted, where only the head is coloured in. You may also notice the strange, pale line along the top. This is the white belly of the snake. This texture belongs to this dragon, where you are lucky enough to actually see its underbelly:
Ornamentations
Now, with a body, head and skin, we are ready to make the worms into, well, dragons. This is done by adding a range of features to line up with their body.
Some dragons have a spiky spine, having a consistent saw-tooth pattern all the way down their back. These extra models are painted in with another texture made with the same method as the one above, just with less definition and more pale colours.
But it is not just the spiky spine. The very same system can create, er, fins of whatever sort they are, at any direction along the dragon's body. Here we see one which has a horizontal fin close to their tail. The fins have a lot of variables relating to their width, placement, height, and the shape in which they taper off.
But what dragons really are known for is their horns! Their shape is always conical, I have not implemented multi-pronged horns. However, they have a high variety of sizes, positions, colours and shapes. Are they long and straight, or do they curl, perhaps? No two dragon horns are the same - apart from, of course, the two atop the same dragon's head.
But what dragons really really are known for is their wings! Of course, what else could it be. These also, and I am sorry to repeat myself, sport a variety of shapes and sizes. They are generally triangular in shape, but actually consist of five segments:
This is just a sample shape. All nine points have fully variable positions in all three dimensions. Even just their rotation is quite complicated. They are rotated, so as to say, to be somewhere between perpendicular to the body or more streamlined along the dragon's length. Sometimes, like in the example above, they are raised, and at other times are only horizontal. They can be wide or long, big or small. You get the idea at this point, I'm sure.
Posture
As mentioned, originally the dragons actually snaked their way across the screen in a sine-wave motion, but really, this makes for boring pictures. Instead I opted for a posture described by a row of variables:
- x, y and z rotations describing the angle of the "camera". While x describes how close to the camera, y is up and down and z is left and right if looking at the dragon head-on. The camera can be rotated along all three axes, though mostly y.
- y and z speed. The speed describes the distance in a given dimension between two segments of the snake's body (automatically seperated by x). The y-speed then describes if the snake's body (and only somewhat head) is angled up or down, and the x-speed if it is angled left or right.
- y and z acceleration. Similar to speed, the acceleration describes a motion along the body. For instance, a snake which is curved from left to right would have positive z-speed and negative z-acceleration.
- y and z circling. Instead of constantly increasing like acceleration, the circling describes a sine-wave motion.
These four sets of variables together describe some quite complex positionings of the dragon's body. It creates a lot of failures though, where the body is stretched much too far (for instance when both speed and acceleration are highly positive or negative and the camera is angled to emphasize this). A script checks if the dragon is within the export region, and if not, discards the dragon. It is said that three out of four dragons lose their life this way.
Applications
So, why did I spend such a lot of time generating dragons? Part of it is because it's cool, y'know. I'm drawing some inspiration from Spore, of course, and the easiest type of creature to generate has to be a snake, or well, a serpentine dragon.
But I also kept alluding to wanting these 160x160 pixel renders rather than the full model. This is because I wanted to use them for this:
Pretty WIP, this card art. |
This might look quite similar to PokeHearth, and that's because it is. I realised it was a waste of time to spend so long making a game using trademarked Pokémon. Specifically, these dragons were used for the evolution of PokeHearth into the TCGTycoon.
This game would see you design your own cards for a Hearthstone-like game, and then have AI battle each other and evolve strategies and metagames. Your task is then to balance the cards as the AI finds more and more abusive strategies. But all of this is a story for another day. The point is that you might need thousands of pieces of card art - the cheapest alternative was a decent dragon generator and then taking background art from Convolutional Art.
As TCGTycoon is on indefinite hiatus, this is the current resting place for the dragon generator. RIP in peace.
Comments
Post a Comment