I’m attempting to do earth with the blue marble textures and of course blender, gimp and good old ms-paint as my tool set.
Now I found a nice tutorial how to make one in Photoshop.
http://gallery.artofgregmartin.com/tuts ... lanet.html





Code: Select all
// Earth vertex shader computes lighting coefficients.
//
// Note: For optimal light animation set the RenderMonkey cycle time
// for predefined variables to 20 seconds. (Found in the Edit->Preferences).
// predefined variables used to animate light direction
uniform float cos_time_0_2PI, sin_time_0_2PI;
// artist variable to control season
uniform float season;
// varying variables passed to fragment shader
varying float Diffuse;
varying vec3 Specular;
varying vec2 TexCoord;
void main(void)
{
// calculate vertex position in eye coordinates
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
// compute the transformed normal
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
// compute the light vector pointing toward the sun, in model coordinates
// x,y compose the longitude and z the (seasonal) lattitude of the nadir point.
vec3 lightVec = normalize(gl_NormalMatrix * vec3(cos_time_0_2PI, season,sin_time_0_2PI));
// compute the reflection vector
vec3 reflectVec = reflect(-lightVec, tnorm);
// compute a unit vector in direction of viewing position
vec3 viewVec = normalize(vec3 (-ecPosition));
// Calculate specular light intensity, scale down and
// apply a slightly yellowish tint.
float specIntensity = pow(max(dot(reflectVec, viewVec), 0.0), 8.0);
specIntensity = 0.3 * specIntensity;
Specular = specIntensity * vec3 (1.0, 0.941, 0.898);
// Calculate a diffuse light intensity
Diffuse = dot(lightVec, tnorm);
// Pass texture coordinates fragment shader
TexCoord = vec2 (gl_MultiTexCoord0);
TexCoord.x = TexCoord.x;
// output final vertex information
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
Code: Select all
// Earth fragment shader blends day/night/cloud/gloss textures based on local time of day.
uniform sampler2D EarthDay, EarthNight, EarthCloudGloss;
uniform bool cloudCover;
varying float Diffuse;
varying vec3 Specular;
varying vec2 TexCoord;
const float Terminator = 0.3;
const float InvTerminator = 1.0 / (2.0 * Terminator);
void main (void)
{
// separate maps are packed into the color components of this texture
// clouds.r = cloud opacity
// clouds.g = water glossiness
vec2 cg = texture2D(EarthCloudGloss, TexCoord).rg;
float clouds = cg.r * float(cloudCover);
float gloss = cg.g;
// load daytime color, plus a specular component modulated by the gloss map
vec3 daytime = texture2D(EarthDay, TexCoord).rgb * Diffuse + Specular * gloss;
// mix in diffusely-lit clouds, modulated by the cloud opacity
daytime = mix(daytime, vec3(abs(Diffuse)), clouds);
// load night image, modulated by cloud opacity
vec3 nighttime = texture2D(EarthNight, TexCoord).rgb * (1.0 - clouds);
// assume day, to start
vec3 color = daytime;
// if fully dark, select night
if (Diffuse < -Terminator)
{
color = nighttime;
}
// within the twilight zone, mix night/day
if (abs(Diffuse) < Terminator )
{
color = mix(nighttime, daytime, (Diffuse + Terminator) * InvTerminator);
}
gl_FragColor = vec4 (color, 1.0);
}


Code: Select all
material Earth
{
technique
{
pass
{
texture_unit
{
texture Earth.jpg
texture EarthNight.jpg
texture EarthClouds.jpg
}
}
}
}