![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jörg 'Yadgar' Bleimann
Subject: Adding an alpha gradient to an image_map?
Date: 13 May 2012 09:41:43
Message: <4fafba17$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi(gh)!
With a new computer finally at hand, I wanted to upgrade my POVSolar
(and, thus, also POVEarth) project, replacing the simple 2048 x 1024
surface and clouds texture by a more sophisticated one. After adding
separate textures for surface (i. e. land, sea and sea ice) and clouds
(on a slightly larger sphere to make them float at 5 kms above the
surface), I also want to add a "city lights" texture showing only up on
the night side of Earth.
To achieve this, I added the "city lights" image_map as a new texture
layer beneath the daylight surface image_map - but to make it appear on
the night side only, I'll also somehow have to add a gradient pattern
for the alpha channel of the daylight surface texture. Unfortunately,
the official manual is silent about this - it only contains notes on
assigning alpha values to index colours or using the alpha channel
provided with the image file...
So, how can I add an alpha gradient to my daylight image_map?
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Le 13/05/2012 15:41, Jörg 'Yadgar' Bleimann nous fit lire :
> Hi(gh)!
>
> With a new computer finally at hand, I wanted to upgrade my POVSolar
> (and, thus, also POVEarth) project, replacing the simple 2048 x 1024
> surface and clouds texture by a more sophisticated one. After adding
> separate textures for surface (i. e. land, sea and sea ice) and clouds
> (on a slightly larger sphere to make them float at 5 kms above the
> surface), I also want to add a "city lights" texture showing only up on
> the night side of Earth.
>
> To achieve this, I added the "city lights" image_map as a new texture
> layer beneath the daylight surface image_map - but to make it appear on
> the night side only, I'll also somehow have to add a gradient pattern
> for the alpha channel of the daylight surface texture. Unfortunately,
> the official manual is silent about this - it only contains notes on
> assigning alpha values to index colours or using the alpha channel
> provided with the image file...
>
> So, how can I add an alpha gradient to my daylight image_map?
>
gimp ?
Add a alpha canal, edit as convenient that layer, save as flattened png.
Now, the hard part is that excepted for equinoxe, the day vs night line
does not go through the poles and the projection used to make the map
does not help.
Equinox is easy: rectangular, full height. The edge on left & right
might be large enough for whatever needed gradient.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Stephen
Subject: Re: Adding an alpha gradient to an image_map?
Date: 13 May 2012 11:10:38
Message: <4fafceee@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>
> See you in Khyberspace!
I tried this a few years ago. IIRC my solution was to have the day lit
map just above the night map. And difference the day lit sphere with a
box, another sphere would do as well. The terminator was very straight.
But with clever unions you will be able to keep the night side away from
the sun and it can be animated.
--
Regards
Stephen
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jörg 'Yadgar' Bleimann
Subject: Re: Adding an alpha gradient to an image_map?
Date: 13 May 2012 11:23:23
Message: <4fafd1eb$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi(gh)!
On 13.05.2012 17:10, Stephen wrote:
> I tried this a few years ago. IIRC my solution was to have the day lit
> map just above the night map. And difference the day lit sphere with a
> box, another sphere would do as well. The terminator was very straight.
> But with clever unions you will be able to keep the night side away from
> the sun and it can be animated.
I've seen this method elsewhere
(http://www.kuffner.org/james/gallery/raytracing/earth_from_space/), but
what if I want to use spherical meshes for the Earth surface later on?
Also using the mesh two times with a very small radial offset?
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Stephen
Subject: Re: Adding an alpha gradient to an image_map?
Date: 13 May 2012 13:42:12
Message: <4faff274@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> I've seen this method elsewhere
> (http://www.kuffner.org/james/gallery/raytracing/earth_from_space/), but
> what if I want to use spherical meshes for the Earth surface later on?
I don't think that would be a problem.
> Also using the mesh two times with a very small radial offset?
I had not thought of that. I think that your maths will get a bit more
complicated. As you rotate your terminator you will need to counter
rotate your night side sphere. For me, using a modeller, it is much
simpler having two concurrent spheres with one of them differenced with
a box.
But why a mesh? Surely the height difference between sea level and the
top of mountains is very small. Mount Everest is about 0.07% higher than
the average diameter of the Earth. Would that be visible at the height
of your camera? I think that the density of the mesh would need to be
very high to get acceptable detail.
--
Regards
Stephen
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jörg 'Yadgar' Bleimann
Subject: Re: Adding an alpha gradient to an image_map?
Date: 13 May 2012 13:44:13
Message: <4faff2ed$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi(gh)!
On 13.05.2012 19:42, Stephen wrote:
> But why a mesh? Surely the height difference between sea level and the
> top of mountains is very small. Mount Everest is about 0.07% higher than
> the average diameter of the Earth. Would that be visible at the height
> of your camera? I think that the density of the mesh would need to be
> very high to get acceptable detail.
Not with the current scenes, but later on, I plan animated flight
sequences from a height of 10 kms...
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> So, how can I add an alpha gradient to my daylight image_map?
Make two variants of your texture stack: One with daylight image_map,
one with night image map instead; use a slope pattern (oriented towards
the sun) to blend the two stacks.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
It's possible to add an alpha gradient to an image map like this:
pigment {
gradient y
pigment_pattern {
[0 image_map { <your image> }]
[1 image_map { <your image> transmit all 1 }]
}
}
So the gradient blends between opaque and transparent versions of the map.
--
Tek
=?ISO-8859-1?Q?J=F6rg_=27Yadgar=27_Bleimann?= <yaz### [at] gmx de> wrote:
> Hi(gh)!
>
> With a new computer finally at hand, I wanted to upgrade my POVSolar
> (and, thus, also POVEarth) project, replacing the simple 2048 x 1024
> surface and clouds texture by a more sophisticated one. After adding
> separate textures for surface (i. e. land, sea and sea ice) and clouds
> (on a slightly larger sphere to make them float at 5 kms above the
> surface), I also want to add a "city lights" texture showing only up on
> the night side of Earth.
>
> To achieve this, I added the "city lights" image_map as a new texture
> layer beneath the daylight surface image_map - but to make it appear on
> the night side only, I'll also somehow have to add a gradient pattern
> for the alpha channel of the daylight surface texture. Unfortunately,
> the official manual is silent about this - it only contains notes on
> assigning alpha values to index colours or using the alpha channel
> provided with the image file...
>
> So, how can I add an alpha gradient to my daylight image_map?
>
> See you in Khyberspace!
>
> Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jörg 'Yadgar' Bleimann
Subject: Re: Adding an alpha gradient to an image_map?
Date: 14 May 2012 13:49:21
Message: <4fb145a1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hi(gh)!
On 14.05.2012 12:41, Tek wrote:
>
> It's possible to add an alpha gradient to an image map like this:
>
> pigment {
> gradient y
> pigment_pattern {
> [0 image_map {<your image> }]
> [1 image_map {<your image> transmit all 1 }]
> }
> }
>
> So the gradient blends between opaque and transparent versions of the map.
I tried this, but got strangely distorted bitmaps with sharp boundaries
between day and night texture (see attached image). Also, what was meant
to be a rendering centered around North Pole turned out to show mostly
North America...
Here is my code:
#declare sc=1000;
#declare bodies = array [81][12]
{
{ 0, 696000, -1, -1, 7.25, 0,
0, 0, 0, 0.000009, 63.87, 286.125 },
// 0 - Sun
{ 57909100, 2439.7, -1, -1, 2.11, 7.005,
0.205630, 29.124, 48.331, 0.00059, 61.45, 281.01 },
// 1 - Mercury
{ 108208930, 6051.8, -1, -1, 177.36, 3.39471,
0.0068, 54.85229, 76.67069, 0.00019, 67.16, 272.76 }, //
2 - Venus
{ 149597887.5, 6378.14, 6378.14, 6356.8, 23.439281, 0,
0.016710219, 114.20783, -1, 0.0033528, 90, 90 }
// 3 - Earth
[...]
}
#declare east=1;
#if (east)
#declare Pos_Earth = bodies[3][0]*<sin(radians(0)), 0,
cos(radians(0))>; // eastern hemisphere in daylight
#else
#declare Pos_Earth = bodies[3][0]*<sin(radians(180)), 0,
cos(radians(180))>; // western hemisphere in daylight
#end
#macro SetAxis(dec, ras)
rotate <bodies[3][4]-(90-dec), 0, 0>
rotate <0, 90-ras, 0>
#end
#declare T_Earth_Night =
texture
{
pigment
{
image_map
{
png "solarsys/ev5826_land_ocean_ice_lights_8192.png"
map_type 1
interpolate 2
}
// scale <1, 1, 0.5>
}
finish
{
ambient 1
diffuse 0
}
}
#declare T_Earth_Day =
texture
{
pigment
{
image_map
{
png "solarsys/ev11612_land_ocean_ice_8192_POV.png"
map_type 1
interpolate 2
}
// scale <1, 1, 0.5>
}
finish { F_Standard_Planetary_Surface }
}
union
{
sphere // Earth, surface
{
0, 1
texture
{
gradient z
texture_map
{
[0 T_Earth_Day]
[0.45 T_Earth_Day]
[0.55 T_Earth_Night]
[1 T_Earth_Night]
}
scale 2
translate <0, 0, -1>
}
scale <bodies[3][1], bodies[3][2], bodies[3][3]>/sc
}
sphere // Earth, clouds
{
0, 1
texture
{
pigment
{
image_map
{
png "solarsys/cloud_combined_8192a_alpha.png"
map_type 1
interpolate 2
}
}
finish { F_Standard_Planetary_Surface }
}
scale <bodies[3][1]+5, bodies[3][2]+5, bodies[3][3]+4.983270985>/sc
}
rotate -y*clock
SetAxis(bodies[3][10], bodies[3][11])
translate Pos_Earth/sc
}
#declare long =0;
#declare lat=90; // North Pole
#declare long=-long-90; // adjusting longitude to PoV-Ray's
rotation system
#declare h=20000; // orbital height (unscaled kilometres)
#declare camPos = Pos_Earth + vrotate ((6378.14 + h) *
<sin(radians(long))*cos(radians(lat)), sin(radians(lat)),
cos(radians(long))*cos(radians(lat))>, <bodies[3][4], 0, 0>);
#declare camLook = Pos_Earth;
#declare camAng = 40;
camera
{
#if (cam = 5.8)
sky camSky
#end
location camPos/sc
look_at camLook/sc
angle camAng
}
// end of code
See you in Khyberspace!
Yadgar
Post a reply to this message
Attachments:
Download 'povsolar.png' (305 KB)
Preview of image 'povsolar.png'
![povsolar.png](/povray.binaries.images/attachment/%3C4fb145a1%40news.povray.org%3E/povsolar.png?ttop=443866&toff=1800&preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> texture
> {
> gradient z
> texture_map
> {
> [0 T_Earth_Day]
> [0.45 T_Earth_Day]
> [0.55 T_Earth_Night]
> [1 T_Earth_Night]
> }
> scale 2
> translate <0, 0, -1>
> }
Note that this also scales & translates the individual textures in the
map; you'd need to do something like:
texture
{
gradient z
texture_map
{
[0.45 T_Earth_Day translate z*1 scale 0.5]
[0.55 T_Earth_Night translate z*1 scale 0.5]
}
scale 2
translate z*-1
}
(Also note that I removed the texture map entries for 0 and 1, as
they're not needed if they're identical to their respective "neighbor"
entries.)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |