Procedural planets

I recently replayed spore in order to review is for my research. Aside from my critical opinion of the game itself (perhaps more on this later) I was particularly intrigued by the procedurally generated worlds that feature most prominently in the ‘space stage’. Having already examined the various methods of generating planetary type spheres (tesellation, long/latitude etc) I had also concluded that for most purposes a cubic sphere approach was the best for extending heightmap based world generation. Essentially this process involves taking a standard 3d cube where each face is a mesh of some specific dimension (64×64 in the case below) and then normalising each point on the face to a vector that we can project outwards to a spherical surface. When such a mesh is fixed around the origin at an appropriate scale, each projection will make a curved surface that is a 6th of the overall sphere. Of cource there is some distortion where the corners of the faces are squashed together, but this is fairly minor, especially when compared to the polar distortions you get with heightsliced spheres. To implement the mesh creation I made a class in unity to handle a single face and then spawned six of them at the appropriate angles in the worldspace.

Cubic sphere

The next step is to add heightmap displacement to the spherical projection of each point on a face. Its trivial to take a set of 6 heightmap textures and apply them to each face to provide an offset to the projection return vertex.normalized * (radius+heightoffset);. However the main issue to deal with is the seams/cracks between faces. All the neighbouring heightmaps must form continuous values across their borders, and since we are essentially using a cubemap, several borders are rotated or flipped. Initially I considered writing some sort of transformation function to allow my procedural heightmap functions to work across a cubemap. This proved quite difficult and at the same time i discovered that spore (and others) ‘cheats’ by generating a reversed cubemap texture from a clever internal set of cameras and some origin facing billboards.

The approach is to generate an array of billboarded ‘brush’ polygons around the origin of a 3d space. The brushes are mapped with various textures that (alpha)blend together to form terrain heightmap features. The polygons all face inwards and essentially create a reversed sphere of your final mesh. Six camera shots are then taken of the brushes from the location of the origin and along each axis and direction.

Brush polygons arranged in a sphere

Due to the persepctive correction of the rendering process (remember to set the fov angles to 90) the resulting images form a perfect cubemap. These cubemap faces can then be used to displace the points on our actual sphere face meshes.

Camera alignment

Resulting cubemap

Final sphere

A different heightmap brush result

There is a unity webplayer demo here . Its just one simple brush and you will need to refresh the page to generate a new sphere.

Next I implemented a height/slope analysis function to create a blend map for assigning different textures per altitude in a seperate shader (see previous posts) and a third person controller/camera. I will post some more detailed images either here or on flickr when I record a larger range of worlds, possibly with atmospheres, specific coloration and water etc.

P.S. Some excellent references for this type of technique can be found here and here..

28 responses to “Procedural planets”

  1. Rune says:

    Pretty neat! I’m looking forward to see what comes out of this. Thanks for sharing the technique you used.

  2. Simon says:

    I thought this voxel-based approach yielded some really interesting results:

  3. tom says:

    Ooh nice link simon, that looks really interesting!
    At the moment im torn between a cube/voxel approach and a multiple heightmap layers approach, its a balance between complexity scale and smoothness….

  4. ®io says:

    Nice explaination Tom, thanks. The link to the demo is broken?

  5. admin says:

    OOps yeah ®io,
    I moved servers recently and not everything made it across.
    Ive fixed the link now.

  6. Antony says:


    It is really interesting, the procedural planet generation, terrain generation, fauna and flora, physics algorythms, etc. i have very experience on the subject. If you know any good graphics engines that let me script forms as algorythms, please email me!

    I could help you with trigonometric terrain generation because i have a 7-8 years experience of synth design and trigonometric graphics algorythms. I can really fine tune endlessly varied formulas of bumps, valleys, cliffs, canyons, peaks, points, pseudo noise, to make most varieties of landscape types.

    My ideal is to make some games where all the shapes are procedurally generated, mostly about exploring giant and organic looking spaces, logical animal and plant generation, where people could edit game types to make flying, exprloration etc, arcade games.

    anyone that knows about game engines that are good for manipulating mathematical shapes, where i could easily code land, physics and interaction algorythms, mail ant.stewart at

  7. Antony says:

    Here is another possibility for spherical terrain mesh. you could make multiple passes of different kinds of terrain maths all at a different axis, so it is like applying rolls of wallpaper around the planet. say 2 sweeps of peaks, 2 sweeps of hills, 2 sweeps of canyons, some integer rounding/modulos across inclines to make cliffs etc, passes for smoothing, pseudo noise, etc. except that it’s best to cover only 30% of the terrain at every pass for every terrin type, to have different zones.

  8. Josh W says:

    That cubemap procedure is incredibly elegent!

    It strikes me that if you create an image on the sphere interior that does not have rotational symmetry, and relate that to the type of terrain you wish to produce, then you will be able to insure that the corners stitch together:

    The generative function could have all it’s randomness applied to how it _inteprets_ the texture cues, (Eg create patches of some kind, derived from 2d noise (or maybe 3d using rgb) aligned and scaled to the decal thing, rather than being applied independently). Then it would apply identically to the versions of that decal/texture element on the different parts of the texture. The big problem with this idea in my mind is that you then have the problem of what to do on the edges of these patches (you’d probably have to design them all so they approach known surfaces at the edges, like dance mixes do to help dj mixing), and there is the problem of exact duplication of terrain patches across the world if you have too few biomes.

  9. Cosmas A says:

    It looks like your cube sphere is separated by each face side. How exactly did you solve the problem of the normals being corrected after you generated the map. That’s where I’m stuck. From what I’ve seen there’s no way Unity can recombine the meshes.

  10. admin says:

    Hi Cosmas,

    Unity can recombine meshes actually,
    will allow you to add them together. However theres a max vertex limit for any single mesh, so its often not a good idea to do this anyway. You can always call recalculatenormals on the meshes after tehy have been ‘sphereized’. You could also calculate the normals yourself since you will know the adjacent vertices for every point. I guess the only trick part might be where one face meets another, in those cases you might have to get the normal array from the mesh and do some fiddling to fix it…

  11. Jason B says:

    would it be possible, to post the formula to spherifiy an cube in unity. I tried it with the equal-area-formula on wikipedia but i failed. Could you give a hint or maybe the formula itself?
    I would really appreciate it. Thanks in advance.

    • admin says:

      Basically make a cube that is centred around the origin (dimensions of -1 to +1 xyz or something)
      The step through every vertex of the cube and do this
      Vector3 spherepoint=cubepoint.normalized * radius;
      where radius is the radius of the spehere you want as result.
      Its that simple, as long as your cube is centred on 0,0,0 you can fiddle with the radius and cubesize to get different effects etc if you want.

  12. Jason B says:

    thank you so much. You just made my day. :)

  13. Splatz says:

    Pretty cool and well explained but i have a question:
    How did you make the bubblebrush in your webplayer demo and like they have in the references? Gimp or Photoshop?
    Where do i get this brush?

    • admin says:

      Im not quite sure what you mean, if you mean just the texture that is used to make the inverted sky then i made it in photoshop in about 5seconds i think.

      • Splatz says:

        Yes, i ment the “inverted sky”, did you use any particulary brush? i dont have photoshop so i can’t take a look at them, but if i knew the particulary brush i could find the equivalent for gimp or would it maybe possible to send me the texture?

  14. John Whigham says:

    Good work here, great to see what people are doing in this area. This is pretty much the same technique I use for the terrain planets in my Procedural Universe project “Osiris” – see especially this early post:

    • admin says:

      Thanks John, Ive been following your work for a while, great stuff with the planetary rings etc. Looking forward to seeing how far you can take your engine!

  15. Ebil says:


    Could you please explain more how to do this?
    Im trying for several days now to create a sphere out of 6 cubes. Was gone through several math formulars but somehow i cannot get it to work :/

    Also what you wrote above
    “Vector3 spherepoint=cubepoint.normalized * radius;

    Doesnt help me. What is pherepoint and cubepoint?
    Could you post some example code please or explain it in more detail?
    Also what would be the best way to create a sphere everywhere (so not just on 0,0,0)
    Thanks in advance!

  16. Caius says:

    Hi NullPointer,

    I’ve done something similar to this technique with 6 single planes creating the cube. The problem I’ve been having is gaps between the edges, did you experience this no is this just a added problem with using 6 single planes?

  17. USA Proxies says: : cheapest high level private proxies with 50% lower price! Professional quality, Limitless proxies, Very speed and Least expensive rates : only $0.25 for every proxy! Finest non-public proxies simply from

  18. USA Proxies says: – lowest priced elite private proxies with 50% discount! Elite quality, Unlimited proxies, Excellent speed as well as Least expensive charges – simply $0.25 for every proxy! Very best personal proxies only on

  19. : cheapest elite private proxies with 50% discounted! Professional quality, Limitless proxies, Super speed as well as Cheapest rates – just $0.25 each proxy! Best personal proxies just on

  20. USA Proxies says: — lowest priced top-notch private proxies with 50% lower price! Top notch quality, Unlimited proxies, Super speed and also Least expensive costs : only $0.25 every proxy! Ideal private proxies only by

  21. Faustino says:

    Guys who of you play Pokemon GO? Amazing game, finally Scyther has been caught using pokebusterbot.

    With this bot you can catch pokemons on autopilot!

  22. Superb blog! Do you have any tips for aspiring writers? I’m hoping to start my own blog soon but I’m a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely overwhelmed .. Any ideas? Thanks!

  23. This site won’t render appropriately on my android – you might wanna try and repair that

  24. Awesome site you have here but I was curious if you knew of any community forums that cover the same topics discussed in this article? I’d really like to be a part of online community where I can get responses from other knowledgeable individuals that share the same interest. If you have any suggestions, please let me know. Appreciate it!

Leave a Reply