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

Should Tau Replace Pi?

The digits of π, organized in a very new way Happy π-day! And happy π-month! Today's month and day - that is, March 14 or 3.14 - includes the first 3 digits of π. And today's month and year - March 2014 or 3.14 - also includes the first 3 digits of π. We won't have another double-day for π for the next 100 years, so enjoy this one! For the special occasion, I'm posting two π-related posts - one for π-month, and the other for π-day. In both posts, I'm setting the font size to approximately π * π + π + π. This is the first post, for π-month; to see the second, go to http://greatmst.blogspot.com/2014/03/pi-month-pi-day-post-2-5-common-pi-myths.html . In this post, I am including an essay I wrote about whether π or τ is the more superior constant. This was written for people who know very little about math, so the basic idea should be easy to understand even for people who are not mathematically inclined. Should Tau Replace Pi? A constant is any number or value that ne...

The Geminids

The Geminid meteor shower is coming up! At 2:00 AM, on December 14 (that's Thursday night, or Friday morning), you can see anywhere from 100 to 150 meteors per hour - depending on the sky and weather conditions. That's more than 1 meteor per minute! This particular meteor shower comes from a 5.1 km wide asteroid called 3200 Phaethon. Flecks of debris fall off this asteroid in a trail around the sun. These bits are called meteoroids . Every year, in December, Earth passes through this stream of meteoroids; when one of them enters Earth's atmosphere, it burns up and we see a meteor. If the meteor is brighter than Venus, it's called a fireball. Fireballs are much less common than meteors. This year, viewing conditions will be especially good; the peak occurs only 1 day past new moon. If you live in an area with lots of light pollution, you will definitely want to drive into the country. If you think the weather will be bad, go out a day or two before or after the peak. Kee...

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...