Skip to main content

CG Earth

Click to view larger

You may have noticed that my blog background changed a couple days ago. I've been meaning to change it for quite a while, but I didn't get around to it. Then, a few days ago, I had some free time on my hands. Why not create a 3D model of Earth, I wondered? So I pulled up Blender (a free computer graphics program I use) and got to work.


I actually wasn't entirely sure where to begin, but I had an idea of the basics. I needed to:
  • Map some terrain onto a sphere
  • Make an atmosphere
  • Create clouds
  • Prevent the clouds from looking like a weird shell around the planet
I'm not fully fluent in all the different techniques and features for Blender, so I looked for a planet Earth tutorial online. I soon found a BlenderGuru tutorial describing how to create and render a model of the planet Earth.

The problem with the tutorial is that it was for a different version of Blender, and as a result didn't do everything I wanted to do. I watched most of the tutorial, did some more Google searches, and figured out the rest on my own.

The final result consists of three layers of spheres of different sizes. It sounds pretty simple, but the important part is how I treat those layers.

The first layer is the actual surface of the planet. To make it as accurate as possible, I mapped NASA image data onto its surface. This required a total of 4 different images; I downloaded all but one of them directly from nasa.gov. The images were extremely large (many megabytes, many pixels), so I scaled them and compressed them until they were less than 5 MB each.

The main image, of course, is the following cloud-free "blue marble" map of earth's surface:

Land, sea, ice; used as a color image

I used this image to color the planet. NASA also included some other maps of the surface, but they were inaccurate because they did not include the polar ice caps, so I went with this one.

The next image I used was a map of surface topography. In this image, brighter pixels represent higher elevations and darker pixels represent lower elevations. I used the image as a normal map for shading. Basically, it puts shadows on the sides of mountains.

Topography; used for surface normals

The next image is a specularity mask. It's black where there's water, and white where there's land. I got this texture from blenderguru.com, because NASA didn't seem to have it. I used the image to determine which parts are reflective and which parts are not. The ocean should be shiny in sunlight, but the land should not.

Water map; used for specularity mask

Last but not least, I needed a map of city lights for the night side of the planet. I started with this image:

Earth at night

I started by mapping the image to the dark side of the planet. The problem is that the image also contains some blue, so the dark side of the planet was actually producing its own blue light. It didn't look bad, but it was unnatural. So uploaded the image to GIMP, where I removed the blue and converted to greyscale. This was the result:

City lights; used for light emission

...which is a map of the city lights, and practically nothing else. I used this final image to map some glowing points of light onto the dark side of the planet.

That finished the first layer. You might not have noticed all of those details, but the final result wouldn't have been the same without them.

The next layer is the cloud layer, which was much simpler. I only used one image:

Clouds, used for color, transparency, and surface normals

I used the image data for color as well as transparency and normal mapping. That way, the sphere is opaque where the clouds are, and transparent everywhere else. The clouds are also grey in places, and have a bumpy texture.

The next layer, the largest sphere, is the atmosphere. I didn't use any images for this sphere; instead, I used volume scattering to scatter blue light, and some math to make the atmosphere fade away at the edges. The resulting atmosphere is actually unrealistic – Earth's atmosphere doesn't extend this far from the surface. I decided to do it this way, though, because it looked better.

That's the basic idea for how I designed my 3D CG Earth. All I had to do next was add a background. Then, after rendering the final image, I applied JPEG compression in GIMP, and I was done.

So that's how I created the new background for my blog. What do you think? Comment below!


New posts every month – subscribe for free!


Comments

  1. Its great! I can barely see that its not real! Does blender make a new version every year?

    ReplyDelete
    Replies
    1. Thanks for commenting! Blender releases a new version whenever a new version is finished, which is usually every few months.

      So far this year they've released 2 versions. The new versions generally contain minor updates like bug fixes or speed improvements, but occasionally they'll add a big new feature like support for Cycles volume rendering.

      Delete
    2. Yea I was thinking about getting it but the last time I tried it had a virus.

      Delete
    3. Really? I don't think Blender has ever had any viruses, so it was probably a false positive. If you download the .exe directly from blender.org, you're safe.

      I read that some virus scanners were giving false positives because one of the filenames used by Blender is also commonly used by real viruses; that may be the issue. I've never had any trouble with Blender.

      Delete

Post a Comment

Popular posts from this blog

Which Hurts More?

212° F Let's play a little game. I'll list a bunch of possible actions. Each action will have 2 variations, (a) and (b). You choose either (a) or (b), depending on which would be safer (or less painful). Each of the questions will involve an oven hot enough to bake a cake (350° F), and a pot of boiling water (assume we're at sea level). So... would you rather: 1.     (a) Stick your hand in the oven     (b) Stick your hand in the boiling water   ... for a period of 10 seconds 2.     (a) Leave a fork in the oven     (b) Leave a fork in boiling water   ... for a period of 15 minutes. Then hold the fork tight with your bare hand. 3. Fill a jar to the top with cool tap water. Then:    (a) Place the jar in the oven    (b) Place the jar in the boiling water   ... for a specific, but unknown, period of time. Then remove the jar and put your hand in it. First see if you can figure these out yourself. They shouldn't be too...

2014 in Photos

The year of 2014 is over; the year of 2015 has begun. Over the past year, I took a lot of pictures - more than 1200 photos of clouds, bugs, plants, rocks, and more. I deleted most of the low-quality and repetitive photos. Then, I selected 20 of the remaining photos which I thought were the most interesting or significant. In this post, I'll include those photos, in chronological order. Spring 1. Cold Hummingbird I took this photo after a late snowstorm in Spring. In the days leading up to the storm, it was warm and sunny and the fields were green, so the snow came rather unexpectedly. During the storm, one of the hummingbirds at our feeder was covered in ice and could barely fly. This hummingbird was more fortunate, but unlucky nevertheless. 2. Green Landscape I took this photo on the side of a biking trail. I didn't edit or crop the photo - this is how it looked. 3. Indian Paintbrush The Indian Paintbrush is an unusual flower. What appear to be flower petals are actually brigh...

Nature Wallpaper

I collected 12 of the highest-resolution, best-quality photographs of nature I've taken over the past few years, cropped them to highlight the important parts, and then applied JPEG compression. Now I'm releasing them for my blog readers to enjoy as a desktop background. To download as a .zip file, click here . Note that the photos shown in this post are low-resolution previews. If you have any questions about the wallpaper, please comment! New posts every month -  subscribe for free !