// Control the planet/sun with these #declare LightPosition = 5*<1,1,1>; #declare PlanetPosition = <0,0,0>; #declare PlanetRadius = 1.5; // Just two example textures with contrasting colours to show the effect. Day side has specular so // you can be certain that the pattern's pointing the right way. // You'll need to mess around with image maps and mapping for these yourself. #declare EarthNightTexture = texture { pigment { rgb <0,0,1> } finish { ambient 0.5 } } #declare EarthDayTexture = texture { pigment { rgb <1,1,0.5> } finish { ambient 0.0 specular 0.5 } } // Unit vector pointing towards the sun (your key light) #declare LightVector = vnormalize(LightPosition - PlanetPosition); // The actual texture you need #declare EarthTexture = texture { // I used pigment pattern just to isolate the gradient bit from any scaling of the day/night textures. pigment_pattern { gradient LightVector // Point the gradient towards the light scale 2 // Requires that planet radius is 1.0 (scale it later) translate -LightVector // Again requires that radius is 1.0 (scale it later) } texture_map { [0.4 EarthNightTexture ] // To change the size of the blending zone between night and day, [0.6 EarthDayTexture ] // move these values closer to or away from 0.5. } } // The following scene data are just to show the texture at work. light_source { LightPosition, rgb 1 } sphere { <0,0,0>, 1.0 texture { EarthTexture } scale PlanetRadius translate PlanetPosition } camera { location z*5 look_at <0,0,0> } global_settings { assumed_gamma 1.0 }