Animating a Stylized Pixel Planet in Blender 2.8


Welcome! We’ll be making and animating a stylized pixel planet in Blender 2.8 today, which is a technique I used in a recent game I made for the GMTK Game Jam. It’s a really simple and cool looking effect, and is very versatile in case you want to experiment with pixel art with Blender in the future. The main techniques (or, I guess, nodes) are the [SHADER TO RGB] material node and [PIXELATE] compositing node.

Video Tutorial

Final Product

Modelling

FIRST - Make sure you’re using the EEVEE render engine! It’s in the render settings on the right hand side panel.

Delete the default cube and replace it with two UV spheres, one inside the other.

The outer one will be the “cloud” layer, and the inner one will be the actual planet.

That covers all the 3d “modelling” we’ll be doing today.

Shading

For the inside sphere, we’ll have to a NPR (Non photorealistic, ie. Anime style) shader and texture it with a satelite image of the earth you can download HERE.

You might want to hide the outer sphere while you’re doing this, or just delete it and add it later.

We’ll delete the default shader and replace it with the cool SHADER TO RGB node.

Then, we’ll control the colors with a color ramp node, with the interpolation set to CONSTANT. I put 4 colors, in the order from left to right:

  1. Deep ocean blue
  2. Light ocean azure
  3. Grass green
  4. Yellow green plains

Play with the positions of the nodes and change the sliders to adjust to how you’d like it to look.

For the outside sphere, we need to use this image texture as the factor input, to mixing the clouds.

The color ramp node here controls how much of the clouds shows up.

Compositing

To pixelate this, you need to first scale down the image (scale < 1) and then scale it back up by the inverse, with a pixelate node in the middle.

The greater the scale factors (0.2 then 5 is less pronounced than 0.1 then 10). The numbers must be inverses, otherwise stretching will result (inverse as in you scale first by x and then by 1/x).

Scene Setup

Position the camera directly in front of the planet by centering it on an axis (though that doesn’t matter a whole ton), and set the Film settings to “Transparent”. You’ll want to change the resolution to something suitably small, and probably square (I used 256x256)

Animation

You want to add two keyframes for both spheres. First, at frame zero:

Set both the inner sphere (“planet”) and the outer sphere (“clouds”) to have a rotation of zero at frame 1. We’ll make the planet move half as fast as the clouds, and also make it infinitely loopable so both will make rotation that is a multiple of 360.

Then, move the keyframe marker to frame 30 or the final frame (I set mine to 30 because that seemed long enough, though it matters not at all), and set the planet to have a rotation of 360 in the rotation panel on the Z axis on the right (in yellow) and keyframe it by hovering the mouse and pressing I.

_You cannot do this in the editor, as Blender finds the shortest path between the two positions and interpolates it, if you rotate something 360 in the editor, it will treat it as having no change an_d nothing will happen.

Do the same thing to the outer clouds, but this time change the Z-Rotation to 720 degrees.

Next, set the interpolation to linear in the graph editor. This will make sure the loop is smooth, and doesn’t accelerate and then decelerate at the ends of the animation, but rather plays at a constant speed.

And we’re done!

Render this, and you’ll have an easy stylized pixel planet done entirely with Blender!

Exercises for the Reader

Make a procedural planet texture and procedural clouds, instead of image textures!

Use another planet’s surface as an image texture and render it.

Use this as an animated sprite in a game!

Conclusion

Thanks for reading this, and follow my blog if you want to see more! I write around once a week, and usually about Blender or game development with Unity.

In Game

comments powered by Disqus