POV-Ray : Newsgroups : povray.general : --- Server Time
2 Aug 2024 00:16:43 EDT (-0400)
  --- (Message 1 to 2 of 2)  
From: Slime
Subject: Re: Earth Texture gradient woes
Date: 23 Mar 2005 12:12:44
Message: <4241a38c$1@news.povray.org>
You shouldn't post images in this group; you should post them in
povray.binaries.images and either put your question in there or ask your
question here, referencing the other post.

> left to right. But the problem is how do I get the starting point of the
> gradient to be the extreme left or right edge of the sphere and not the
> middle, without taking the image maps with it? I've tried 'translate
> <-EarthScale,0,0>' in a few places, but they all seem to take the
> texture map with it (producing a pinched spherical mapping, since it's
> now centered off the side of the sphere). How can I move the gradient
> without moving the texture? Anyone know?

Two options: You can either translate the Day and Night textures by the
opposite amount:

texture {
gradient x
scale EarthScale*2
texture_map {
[0.4 Day translate<EarthScale,0,0>]
[0.6 Night translate<EarthScale,0,0>]
}
translate <-EarthScale,0,0>
}

Or you can use pigment_pattern to translate the *pattern* without affecting
the texture itself:

texture {
pigment_pattern {
    gradient x
    scale EarthScale*2
    translate <-EarthScale,0,0>
}
texture_map {
[0.4 Day]
[0.6 Night]
}
}

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: Earth Texture gradient woes
Date: 23 Mar 2005 12:30:43
Message: <ddr0oDAQcaQCFwR2@econym.demon.co.uk>
Wasn't it Brooks Boyd who wrote:
>Hello All,
>I have been using POV-Ray for the better part of a decade now, but I ran 
>into a problem with a Earth globe I'm trying to render. Here's the bit 
>of code I have:
>
>#declare EarthScale = 2;
>
>#declare FullDay = material {
>       texture {
>               gradient x
>               scale EarthScale
>               texture_map {
>                       [0.4 Day]
>                       [0.6 Night]
>               }
>       }
>}
>
>sphere {
>   <0, 0, 0>
>   EarthScale
>   material { FullDay }
>}
>
>"Day" and "Night" are both textures that pull in a image map of the 
>Earth and spherically interpolate it.

One way of doing it is to discard the gradient pattern and write your
own function. This gives you total control of the scaling and
translation of that pattern independently of any other texture features.

        texture {
                function {x/2 +0.5}
                scale EarthScale

Doing it this way means that you can also do things like
                function {x/2 +0.5 -y/10}
and even things like
                function {x/4 +0.5 -y/5 +z/10}
giving you different tilts on the pattern from the image maps.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.