Ever wondered about the Earth image on the screen background of every new iPhone? Turns out it's another Blue Marble image and here is an article on how it's made written by the artist Robert Simmon himself: Crafting the Blue Marble.
A journey to create a CG model of our beautiful
home planet
while learning more about
its wonders along the way...
Topics
- atmosphere (5)
- clouds (3)
- making-of (8)
- moon (1)
- night (5)
- ocean (3)
- research (16)
- scattering (4)
- shaders (5)
- specular (3)
- terminator (3)
- WIPshots (21)
Wednesday, August 22, 2012
Sunday, August 19, 2012
Iconic Earth images
While researching, I stumbled across this great article about 10 Iconic Images of the Earth from Space. Images featured include the Blue Marble and the Pale Blue Dot.
One of the most iconic photos ever is the Earthrise taken by astronaut William Anders on Dec 24, 1968 during the Apollo 8 mission. To quote Anders: "We came all this way to explore the Moon, and the most important thing is that we discovered the Earth"
In 2007, JAXA (Japan Aerospace Exploration Agency) launch a lunar orbiter SELENE (nicknamed Kaguya after the moon princess from Japanese folklore) whose on-board HDTV cameras recorded high-definition video footage of a newer Earthrise:
We are indeed lucky to be living at a time when technology allows us to appreciate our home planet from a perspective that must have once been unimaginable.
One of the most iconic photos ever is the Earthrise taken by astronaut William Anders on Dec 24, 1968 during the Apollo 8 mission. To quote Anders: "We came all this way to explore the Moon, and the most important thing is that we discovered the Earth"
The first public image of an Earthrise from Moon orbit (Dec 24, 1968) |
In 2007, JAXA (Japan Aerospace Exploration Agency) launch a lunar orbiter SELENE (nicknamed Kaguya after the moon princess from Japanese folklore) whose on-board HDTV cameras recorded high-definition video footage of a newer Earthrise:
We are indeed lucky to be living at a time when technology allows us to appreciate our home planet from a perspective that must have once been unimaginable.
Wednesday, August 15, 2012
Shader upgrades ^^
Necessity can be a great motivator. A recent freelance opportunity meant I had to create much faster shaders to get the job done in time. I dove head first into VEX code writing for the first time, and managed to adapt Sean O'Neil's real-time atmospheric scattering algorithm into my new Earth shaders.
My method uses the CPU instead of GPU and is not real-time, but is still multiple times faster than my old method while looking visually very similar. Some volumetric shadow effect is lost, but not really noticeable if you are not looking for it, and the amount of speed up is well worth tradeoff.
Naturally, the implementation is not straightforward and took me almost 3 days to get it working properly. Perhaps I'll post more details under the "making-of" label in future.
My method uses the CPU instead of GPU and is not real-time, but is still multiple times faster than my old method while looking visually very similar. Some volumetric shadow effect is lost, but not really noticeable if you are not looking for it, and the amount of speed up is well worth tradeoff.
Naturally, the implementation is not straightforward and took me almost 3 days to get it working properly. Perhaps I'll post more details under the "making-of" label in future.
Making of a Planet - Part 3 - Shader Basics
In this post I'll be describing what I learnt about shaders when building the CG Earth, with specific examples of Houdini VEX shader networks. First off, a quick introduction to how shaders work.
Shaders are actually program code written in a shading language. However, Houdini allows the code to be build visually as a node network (called a SHOP network, for SHader OPerators). The most famous industry shader language for rendering CGI is the RenderMan shading language. For real-time graphics (e.g. games and 3D applications) you will hear names like GLSL and HLSL. Houdini's shading language is called VEX (Vector EXpressions).
Regardless of shading language used, the simplest shader returns a constant color at every point, making the object appear uniformly flat. In the following example, a constant color blue is being fed into the surface output of a Material Shader Builder node in Houdini's SHOP network:
Let's consider how light may affect how the surface looks.
The following example is the basic Lambert shader (which mathematically is the dot product of the normalized surface normal vector, N, and the normalized light vector, L). It's amazingly elegant that this single dot product formula is enough to describe how the light falls off a surface depending on its angle to the light source:
So we now have a properly lit teapot, but what if we want it in blue color? All we need to do is to multiply the result of the illuminance loop with a constant (blue color) before passing it to the output:
Houdini already includes a selection of basic CG shaders (such as Lambert) as a network node so we don't really need to create our own illuminance loops. However, writing your own illuminance loop function allows specific low-level control over the look of your material. For the Earth shader, I adapted a light wrap shader inside the illuminance loop to simulate atmospheric scattering.
The example below is a slightly more complex shader including specular highlights and texture mapping, but the basic concept is the same as the previous examples. Notice that the texture map (diffuse color) is multiplied with the Lambert shading, and the specular is added to the results.
Shader writing may not be everyone's cup of tea, but with some effort anyone can write their own shader. There's a definite amount of mathematics and logical thinking involved, but with it comes the power to go beyond what is available off-the-shelf.
If you're keen to find out more, I recommend the following books:
1) Texturing and Modeling: A Procedural Approach
2) The RenderMan Companion: A Programmer's Guide to Realistic Computer Graphics
3) Advanced RenderMan: Creating CGI for Motion Pictures
That's it for today. Next post I'll elaborate more about my Earth shaders.
What are Shaders?
Shaders can be thought of a set of program instructions that tells a renderer how to determine the color of a surface (or volume) at any given location. In 3D programs, they are also referred to as materials.Shaders are actually program code written in a shading language. However, Houdini allows the code to be build visually as a node network (called a SHOP network, for SHader OPerators). The most famous industry shader language for rendering CGI is the RenderMan shading language. For real-time graphics (e.g. games and 3D applications) you will hear names like GLSL and HLSL. Houdini's shading language is called VEX (Vector EXpressions).
Regardless of shading language used, the simplest shader returns a constant color at every point, making the object appear uniformly flat. In the following example, a constant color blue is being fed into the surface output of a Material Shader Builder node in Houdini's SHOP network:
![]() |
The constant shader instructs the renderer... |
![]() |
...to use the same color for every point on the surface |
Let's consider how light may affect how the surface looks.
The following example is the basic Lambert shader (which mathematically is the dot product of the normalized surface normal vector, N, and the normalized light vector, L). It's amazingly elegant that this single dot product formula is enough to describe how the light falls off a surface depending on its angle to the light source:
![]() |
A classic Lambertian shader... |
![]() |
...makes the teapot surface react correctly to light |
Lighting Inside a Loop
In Houdini, this lighting calculation must take place inside what is called an illuminance loop. A loop in computer programming is a sequence of instructions that repeats itself until particular conditions are met. Think of it as repeatedly calculating the same lighting formula (dot product) for all the points on the surface that appears in the final image, using the corresponding N and L vectors for each point location.So we now have a properly lit teapot, but what if we want it in blue color? All we need to do is to multiply the result of the illuminance loop with a constant (blue color) before passing it to the output:
![]() |
The Lambert shading network from before is actually hidden inside the illuminance loop node above |
![]() |
Only one dot product and one multiplication is needed to get this blue teapot |
Houdini already includes a selection of basic CG shaders (such as Lambert) as a network node so we don't really need to create our own illuminance loops. However, writing your own illuminance loop function allows specific low-level control over the look of your material. For the Earth shader, I adapted a light wrap shader inside the illuminance loop to simulate atmospheric scattering.
Building Visual Complexity
When shaders take into account various factors such as lighting and texturing, more complex looks can be achieved. Notice also how we can take the first two separately rendered images (the constant blue and the grayscale lit teapots) and combine them using a multiply blending in a 2D program to get the same results (blue lit teapot). Therein lies the flexibility and power of render passes and compositing, because we can tweak the amount of blending without having to re-render in 3D.The example below is a slightly more complex shader including specular highlights and texture mapping, but the basic concept is the same as the previous examples. Notice that the texture map (diffuse color) is multiplied with the Lambert shading, and the specular is added to the results.
![]() | |
No illumination loop used here |
![]() |
More complex shaders will result in more realistic surface appearance |
Shader writing may not be everyone's cup of tea, but with some effort anyone can write their own shader. There's a definite amount of mathematics and logical thinking involved, but with it comes the power to go beyond what is available off-the-shelf.
If you're keen to find out more, I recommend the following books:
1) Texturing and Modeling: A Procedural Approach
2) The RenderMan Companion: A Programmer's Guide to Realistic Computer Graphics
3) Advanced RenderMan: Creating CGI for Motion Pictures
That's it for today. Next post I'll elaborate more about my Earth shaders.
Monday, July 2, 2012
Thursday, June 21, 2012
Making of a Planet - Part 2
In this post, I'll be describing in more detail how the CG Earth is constructed.
The whole planet was broken down into several key components: land, water, clouds, atmosphere and an atmospheric "rim". The atmosphere has two components because it's not a true volumetric simulation, but a kind of hack ^^;
A displacement shader is used with elevation data to create the mountains and terrain above ground, and bathymetry data is used to create the ocean floor below sea level.
The volumetric effect is created using a set of concentric sphere of increasing size and decreasing opacity. The Rayleigh scattering effects is creating using ramp lookup based on a modified Lambert angle. As the shading approaches the terminator, the light color turns reddish.
The other component is the atmospheric rim, which uses another ramp lookup to create the blue "outline" around the limb of the Earth.
I must confess the most of the effects are hacked - they are "physically informed", but not physically based. At this point in time I'm still researching true volumetric solutions for the clouds and true scattering for the atmosphere.
In the next post, I'll talk about the various shaders.
The whole planet was broken down into several key components: land, water, clouds, atmosphere and an atmospheric "rim". The atmosphere has two components because it's not a true volumetric simulation, but a kind of hack ^^;
Land
Nothing fancy here that's not been done for decades. A simple sphere primitive with polar (spherical) UV projection so that the Blue Marble textures can be wrapped around it. Of course, it's well known that the Earth is not a perfect sphere, but an oblate spheroid. This is approximated using an Equatorial radius of 6378.14km and Polar radius of 6356.75km![]() |
An early "making-of" montage showing the key components of the Earth setup |
A displacement shader is used with elevation data to create the mountains and terrain above ground, and bathymetry data is used to create the ocean floor below sea level.
Water
This is just another sphere primitive with an ocean shader applied. Water reflects the sun with a much stronger specular glint than the land or clouds. In the final version, however, I ditched both the bathymetry and water components and instead included the ocean shader into the single land shader for the entire planet. This was done to optimize rendering since the sea is really not that transparent from space, therefore calculating displacement for the sea floor is a waste of render time.Clouds
After much experimentation with various volumetric hacks, I eventually settled upon the same age old technique everyone else is using - a sphere (surprise, surprise) mapped with transparency data from NASA's cloud texture, with the same cloud map doubling as a displacement map to give the clouds actual thickness. On top of this, I added procedural noise for detail, since the cloud map is of noticeably lower resolution than the land texture. To be honest, I feel that I have failed in the implementation of this component most miserably, so future versions will likely be done differently.![]() |
Displacement mapping to give the clouds thickness; procedural noise to add detail |
Atmosphere and Rim
Another key component that makes or breaks the look of a CG planet is the atmosphere. The atmosphere of the Earth interacts with sunlight to produce a multitude of lighting effects and localized color shifts. Indeed, it is reason why the sky is blue and why the Sun appears yellowish when viewed from the ground.![]() |
No atmosphere |
![]() |
With atmosphere |
The volumetric effect is created using a set of concentric sphere of increasing size and decreasing opacity. The Rayleigh scattering effects is creating using ramp lookup based on a modified Lambert angle. As the shading approaches the terminator, the light color turns reddish.
The other component is the atmospheric rim, which uses another ramp lookup to create the blue "outline" around the limb of the Earth.
I must confess the most of the effects are hacked - they are "physically informed", but not physically based. At this point in time I'm still researching true volumetric solutions for the clouds and true scattering for the atmosphere.
![]() |
The sane Rayleigh ramp lookup is used to color the cloud layer. A crude but effective technique ^^;; |
Size Matters
As mentioned previously, all modeling was done to relative scale as much as possible in the spirit of "realism". Initially I used a unit of 1km but the comparatively small details of Earth and the astronomical scale of the solar orbit appear to cause precision problems when rendering shadows. No amount of tweaking the raytracing bias worked. In the end, through trial and error I found that using a base unit of 10km seem to minimize the glitches. So, for example, instead of 6378.14 for the Equatorial radius, I used 637.814In the next post, I'll talk about the various shaders.
Labels:
atmosphere,
clouds,
making-of,
ocean,
scattering,
specular,
terminator,
WIPshots
Saturday, June 16, 2012
Making of a Planet (version 0.2b) - Part 1
As promised, I shall attempt to summarize the techniques I used to create the CG Earth from the previous post. This version represents another milestone in my efforts to create a decent photorealistic Earth using computer graphics.
Before I begin, it seems more and more people are interested in Earth observation. One emerging hobby is for people to build and launch home-made high altitude balloons containing low-cost GPS systems and digital cameras up into the stratosphere to capture videos and photos of the Earth from "space". These balloon capture amazing imagery of the Earth from altitudes upwards of 30km, but is still well within the Kármán line (altitude of 100km) commonly considered the boundary between Earth's atmosphere and outer space. For comparison, the International Space Station (ISS) orbits between 278-460km above ground. Still, the balloon footage are a great source of additional reference material ^_^
Looking at the scene network above, you can see that I have not only created the Earth, but also the Moon, Sun and the ISS. I've been careful to scale all the objects as well as their orbits to relatively accurate proportions using data from the internet. In reality, all orbits should be elliptical, but circular orbits are easier to setup for now. However, I did apply correct inclination and axial tilt parameters for both the Earth and Moon.
The setup is basic CG101: just use null objects and correct parenting. So, the Earth rotates about it's axis, the ISS and Moon rotates around the Earth, and the Earth-Moon system rotates about the Sun. The animation controls are set up for properly relative orbital periods - i.e. Earth rotates on it's own axis once a day, ISS makes one revolution round the Earth in 90 minutes, Moon revolves round the Earth every 27.3 days, Earth goes round the Sun in 365.25 days. Of course, time can be allowed to speed up, slow down or stop in the CG world. Offset controls allow independent control over exactly where to position the objects in orbit to allow fine tuning for shot composition.
In the next post, I'll describe how the Earth is constructed. Until then... ^^/
Before I begin, it seems more and more people are interested in Earth observation. One emerging hobby is for people to build and launch home-made high altitude balloons containing low-cost GPS systems and digital cameras up into the stratosphere to capture videos and photos of the Earth from "space". These balloon capture amazing imagery of the Earth from altitudes upwards of 30km, but is still well within the Kármán line (altitude of 100km) commonly considered the boundary between Earth's atmosphere and outer space. For comparison, the International Space Station (ISS) orbits between 278-460km above ground. Still, the balloon footage are a great source of additional reference material ^_^
Scene Setup
Okay, back to the production report. In this first post I will outline the features I have built into my scene setup and the type of options they offer for creating Earth renders.![]() |
Houdini scene |
![]() |
The Moon looks tiny bacause it is 384400 km away from Earth. It takes light 1.3 seconds to reach Earth from the Moon! We can make the Moon appear bigger in shot by increasing the focal length |
The setup is basic CG101: just use null objects and correct parenting. So, the Earth rotates about it's axis, the ISS and Moon rotates around the Earth, and the Earth-Moon system rotates about the Sun. The animation controls are set up for properly relative orbital periods - i.e. Earth rotates on it's own axis once a day, ISS makes one revolution round the Earth in 90 minutes, Moon revolves round the Earth every 27.3 days, Earth goes round the Sun in 365.25 days. Of course, time can be allowed to speed up, slow down or stop in the CG world. Offset controls allow independent control over exactly where to position the objects in orbit to allow fine tuning for shot composition.
Cameras and Animation Controls
All this trouble to be "realistic" actually makes setting up cameras and shot composition even more difficult. So I took a more sensible approach by setting up orbital cameras around the Earth (attached to the ISS) and Moon, with controls to adjust their location and orientation. Again, it's all null objects and parenting, with expressions to drive rotation channels to simulate orbit.![]() |
Centering the Earth Cam on any location is as easy as entering their latitude and longitude. Here's London at 51.5171° N, 0.1062° W |
![]() |
View from the Moon ^^ |
In the next post, I'll describe how the Earth is constructed. Until then... ^^/
Subscribe to:
Posts (Atom)