This tutorial was originally printed in 3DWorld Magazine back in March 2008 – 11 years ago as I write this now in 2019. It was originally titles, “How do I create, texture and render a photorealistic planet?” but to be frank, I don’t feel it really stands up to that sort of scrutiny today. However, it does still show the principles to creating a good base for a planet with the effective usage of fractal gradients to generate height, so here you go. Enjoy… well, I hope you enjoy it.
There are quite a few nice maps of the planet Earth on the web. At JHT’s Planetary Pixel Emporium you can find surface maps for all the planets in our solar system. But this is all fine and dandy until you want to come up with your own. See, no matter how hard you try, you end up painting something that, well, lacks definition. It all looks a bit flat, doesn’t it? Not enough of those, as Slartibartfast of “Hitch-hikers Guide to the Galaxy” fame would put it, “lovely crinkly edges.” Planets are, after all, fractal by nature thus providing more crinkly edges than you can shake an Arcturan Mega-Donkey at.
When it comes to making a terrain or planet you have the choice of using a DEM map – a digital elevation model to the uninitiated – which replicates reality or the nightmare of coming up with something in Photoshop both of which are prohibitive by the very nature of being pixelated. In other words, you can’t get in really close without seeing squares. In 3D we are inundated with people telling us that 2D maps are the only way forward, that for reality you need to use the realistic. But if the nature of the world is fractal, then surely using a 3D texture which is, by its nature, fractal means we are using realism? Well… No, not really. But if you are trying to create a planet from nothing, fractals are the way to go.
Let’s take a look at the Earth. It is made up of flat and mountainous land masses, shallow and deep water, equatorial regions, arid deserts and polar icecaps. Not to mention, we have an atmosphere which reflects light, clouds that swirl over the surface and, thanks to certain ape descended lifeforms, electricity lighting up the planet’s dark side. Though the lighting is man-made and the clouds follow distinct weather patterns the rest is fractal. So it is arguably possible to make a planet using fractals.
Here’s how we turn ourselves into potential Magratheans. To put it simply we use the colour amplitude values of a 3Dtexture map to control the UV coordinates of colour ramps to form land, sea and so on. Yes, told you it sounded simple. And what this does is give us a prime opportunity to work intensely within the hypershade, rendering our results
Time to start, well, make yourself a sphere (nurbsSphere’s are fine for this, but if you want to use a polygon Sphere, that’s fine too) Oh, and a light, too! Okay, select the sphere and create and add a new blinn shader to it. For viewing in the viewport, we’re going to keep this as vanilla as possible, so don’t do anything you can’t see in the viewport. We are going to begin by creating one of many colour ramps, the first one here will be to provide the divide between land and sea.
Attach a new ramp to the blinn’s colour. Delete the middle colour and change the top and bottom colours to white and black respectively.
Open the hypershade and select the blinn then in the menu Graph > Input Connections.
Now you have the blinn shader in the bottom box, create a 3D texture crater. This will control much of our shader.
In the Hypershade, select the crater and in the Attribute Editor, turn the colours to black, grey and white.
Now MMB drag the crater onto the ramp selecting other from the popdown menu to open up the Connection Editor.
Scroll down the left hand side until you find outColor, click it open and then connect the outcolorR to the U Coord and V Coord under the ramp’s Uv Coor
Now open the ramp in the Attribute Editor. At the moment, you can see in the hypershade that the ramp’s two colour values are looking a little like a negative of the crater.
In the ramp, bring the two colours closer together, around .51 and .49.
Looking in the hypershade now, you should see a monochrome planet in the making.
Render out a view from the perspective window and take a look at the placement of your texture.
Well, you’ve got nice edging, but really it all looks a little on the small side.
Either in the Outliner or the hypershade, select the place3dTexture1 node and then in the Attribute Editor or Channel box change all the scale values to around 5.
Better, although let’s add a little more information into our planet.
In the Attribute Editor at the top is a slider caller Shaker set to 1.5.
Move it up to 2 but no higher. Higher and the white value goes above 1 and causes the texture to wrap black.
Try it, it looks weird.
Okay, now turn it back to 2.
Edit the scale again to your taste.
In the hypershade, select the connecting line between the ramp.outColor and the Blinn then delete it.
Now create a blendColors node and connect it’s output into the blinn’s colour.
Now MMB drag the ramp onto the blendColor to open the Connection Editor and connect the outAlpha of the ramp onto to blender of the blendColors node.
Wow, you’ve got a red and blue planet.
In the blendColors click the checkerbox of the colour that you want to be your land.
I chose the blue From the menu that appears create a new ramp.
Now, following the method set out in step 3, connect the outColorR of the crater to the Uand V coordinates of this ramp.
Render out an ipr image. Set the green to sandy brown and the blue to a deepish green.
In the hypershade, select the new ramp then RMB to open Edit > Duplicate > With Connections to Network.
This new ramp, drag it onto the blendColor1 node and connect it to the remaining colour.
This will be our sea, so adjust this new ramp to look something like the colours to the left.
Let’s make the planet more regional.
In the land ramp, select the green colour and click it’s checkerbox connecting a new ramp into it.
Change that ramp to a U Ramp and change the top and bottom colours to white.
Change the middle colour to a desert like shade and then slowly add quite a few various green shades to the areas in between.
Something like in the image to the left.
Now would be a good time to save.
We still need more variety in the land.
Open the region land ramp – here ramp4 – in the Attribute Editor.
Pop open the menu marked HSV Color Noise and add raise the Hue, Sat and Val Noise up a little, then set their frequencies to something like 5.
This should chase the colour around a little bit
Make a new ramp, this time selecting the divider ramp we first created, then from the hypershade menu select Edit > Duplicate > With Connections to network.
Set both values to black and put them at the top and middle of your new ramp.
Connect the outAlpha of this to the U Wave and V wave of ramp4.
Make the top black a little bit grey and this will swirl the land.
Save your work.
Well, it’s a flat planet with no highlights, isn’t it?
Create a new blendColors and attach ramp1’s outAlpha to its blender.
Connect the outColor of the blender into the Specular Color of the Blinn.
Now change the colours in this blendColor to white and very dark blue.
Rename this new blendColor to specularHighlight and the one connected to the colour to landSeaColor.
Select the Blinn. click the diffuse’s checkerbox .
When the Create Render Node window opens create a blendColors.
The Connection Editor will pop open and in here connect the outColorR of the blendColor into the Blinn’s diffuse.
Set the colours to white and light grey then click on the blender checkerbox and create a solidFractal node.
Set its values as in the image to the left adding some global diffuse lowlights.
Click on the Blinn’s bump checkerbox, creating a new Crater.
Make its colours range from white to black. Create a Reverse node in the hypershade and plug ramps1’s colour into its input.
This will add a depth value of 1 to just the land.
For control over this value create a MultiplyDivide node, connect the reverse1.output into its input then it’s outputX into the bump3D’s bump depth.
Create another bump3D and in the Connection Editor, making sure both displays’ Show Hidden are flagged, connect its outNormal into the normalCamera of the first bump3D.
Create a Brownian, set its weight 3D to 2,2,2 and attach it to the bump3D’s value.
Duplicate the multiplyDivide node without connections.
Connect the outColour of ramp1 into this.
Connect the multiplyDivide to the bump3d2’s height as you did in step 15.
You might notice a lack of cities.
We are going to paint these, but we need a canvas.
Select your planet and then in the hypershade shift select the landSeaColor node you created.
In the hypershade menu select Edit > Convert To File Texture.
In the box that opens, set the resolution to 2048 by 2048, file type to tiff and click Apply.
In your project’s sourceimages folder, you should now find a big tiff called landSeaColor-planet.tif.
Load it into your paint package, in this case Photoshop, rotate the canvas by 90 degrees clockwise and the change the image size to 4096 x 2048.
Create a new layer and on it paint white blobs where you fancy you want cities.
When you are happy, add the maximum monochromatic noise to it.
Then, using the wave filter set to a square type experiment until you get a kind if city grid feel as above.
Duplicate this layer and repeat the wave on this, putting them against black.
Save this out as cities.tga or png – whatever, your choice.
Back in Maya click the checkerbox next to Incandescence and connect up a new ramp.
We want this to be black on the sun side and our cities map on the dark side.
Create a Blinn shader.
To use its light info as a UV control for the connect its outColour into the UVCoordinates of the ramp.
Adjust the blinn’s lighting until you get something like the image here.
Now change the ramp’s colours, removing the red and turning the green black.
Move the blue up a touch and then click its checkerbox and create a new file node.
Navigate to the cities image file we created in the sourceimages folder.
Adjust its colour gain to an orange tone.
But our cities are in the water too.
Create a new blendColors and attach the initial ramp we built into the blender.
Attach the blend to the colour offset gain of the city texture.
Change the colors to the city orange for the land and black for the water.
Hey presto, no floating cities, which is a bit of a bonus.
Import the shader cloudShader.ma provided.
I recommend real clouds maps which you can find online, but as we are working with fractals, this is a good example shader.
In the hypershade, create a Layered shader.
Open the Attribute Editor.
Drag into the Layer Shader Attributes the cloud shader then the planet shader.
Delete the green placement shader.
Next we will create the atmosphere.
Create a lambert.
Select the layered Shader, open the Attribute Editor then drag the new Lambert into the Layer Shader Attributes moving it to the far left.
Click the Lambert’s transparency’s checkerbox and create a new ramp, setting it top down white to black.
Now create a samplerInfo node and in the Connection Editor connect its facingRatio output into the Vcoord of the ramp.
Change the lambert’s colour to a pale blue and, bingo, you’ve got some atmosphere.
If you want to change the look of the planet, just move the 3dTexturePlacement node of that first crater and almost everything moves to suit.
Work up your final render in something like Photoshop or GIMP, Krita or Affinity Photo.
For the lead image, I duplicated the rendered image, blurred it and dropped it behind the original to create the atmospheric penumbra, as well other effects to improve the final output.