These are some of the shaders I wrote for Dragonvale. I’m mostly just uploading them here because they were fun to make and I am eternally grateful that I got paid to make silly graphics effects for dragons professionally. I also tried to write some quick notes about how they work, at least for the ones where I can remember.
Some of these might seem pretty odd; although I do think they ended up being kind of fun and adding to the quirky uniqueness of the game. Generally the “traits” were first conceived of as abstract design decisions, and then we just had to come up with some sort of visualization/art to align with that trait. An additional constraint is these shaders had to work across a very large range of dragons, generally, so we couldn’t get too fussy with integrating it specifically into a dragon. Alas. There would have been some neat things we could have done there.
In any case some of these are pretty out there, such as the “plant” shader where vines grow on the dragon, or the “earth” trait where part of them are made out of rock with constant crack-forming earthquakes; but at the very least they’re entertaining!
Abraxas Shader
This was a really simple pulsing effect. If I recall correctly, I took the original texture atlas, created a separate texture with gradients on the parts where I wanted the effect to occur on one of the color channels, and then used the other color channel as a mask. Then it was just a matter of sampling some small range to actually display based on time variable being fed into the shader.
Air Trait
This was a special trait that could be added to a dragon via some game mechanics that are a bit fuzzy in my head right now. The effect itself was pretty simple — mask for where the effect goes, and then I just blended two fractal/noise textures against each other while sampling them with some offset sine waves.
Antumbra Dragon
The idea with this dragon was to create the effect that it had lava flowing in its abdomen. I really can’t remember how I did this one; flow maps were probably overkill so I think I did something with sampling two textures generated off what was probably voronoi noise with some sort of offset timing in how they moved.
Corrupticorn
I think the idea with this dragon is that it was kind of like a unicorn dragon, but quite corrupt. But hey, even corrupt dragons can have pretty wings, can they not? This was pretty simple, I just converted the color space to HSV and rotated through hue values, while moving around a texture with some sparkles.
Ghost Dragons
This was for a Halloween event where we needed ghost dragons. The dragons were rendered into an offscreen texture with a shader that desaturated it into monochrome and then hue shifted to blue; with using the y coordinate mixed with time in an offset sin/cos mix in the vertex shader to make the dragon wavy. Then the final result was alpha blended into the scene. I really wanted to a do glow/blur on these guys, but alas it was a bit too slow on our target hardware at the time (iPhone 4) on parks with hundreds of dragons.
Earth Trait
This is admittedly one of the odder effects I wrote. Part of them is rock. With earthquakes!
Egg Shaders
This effect was for dragons that you didn’t hatch, but instead where you placed the egg on a pedestal for people to admire. I mostly just went for sort of a “magical” glow here.
Lightning Trait
This was a really simple shader to write, but it ended up looking pretty cool. I believe I used a fractal plugin in GIMP in order to create the lightning texture itself, and then it essentially gets blended in on a psuedo-random interval based on the current game time. And of course some simple perlin noise in the background to create the a bit of a cloud effect.
Light Trait
I really wanted to do more of a glow/blur effect on this, but alas, our hardware target mixed with the way the dragons were textured and modeled made this too expensive for the hardware we were targeting at the time (An iPhone 4 I believe)
Metal Trait
One of the rare times I went subtle on an effect. Just have a bit of a light gloss effect on it with some (fake) bump mapping.
Plant Trait
This was the “plant” trait. I went for a vine-growing effect (using a gradient texture with time based clipping to control how the vines grew)
Sandscale
Flowmaps with sand!
Scorn Dragon
If I recall correctly this was for a valentines day event. The effect itself was really simple, just a hue shift and a simple fire effect, although I think we were all pretty amused with how it turned out. The hard part was syncing the shader effect with the animation, I believe we did something like had an invisible bone exported in the animation from Maya where the coordinates (0-1) were used by the artists to control the timing of the effect.
Search Feature/Effect
This was a feature I added to the game for one of those “do-what-you-want” free days we’d have every few weeks. I think it was more useful for me as a developer fixing parks than as a player tool, but I was happy with how the desaturation helped to highlight what you were searching on. I realize the progress bar on searching the park seems very odd; and at the moment I can’t recall why that operation was so expensive, but it was, so we split the iteration time over multiple frames to keep the game from getting choppy while a search was occurring.
Yolk Shader
I don’t think this ever made it into the game, but this was a prototype “yolk” shader for eggs of some sort. Just some simple signed-distance-fields mixed with sampling a gradient texture to make the transition more in “steps” than a smooth one.
Dice Physics
I think this feature is pretty much the definition of overkill, although I was quite pleased with it. Our game director at the time really wanted a D20 in the game and to have the feeling of throwing it, so I wrote a pretty unique physics system for this. In retrospect I really should have used rigid body physics and a convex mesh collision system; however, I actually ended up using spring physics with really rigid springs and a very generous amount of iterations per frame. In double retrospect, we really probably just should have made the dice abstract, instead of adding a 3d object to a 2d game and a miniature physics system, but where’s the fun in that?