POV-Ray : Newsgroups : povray.advanced-users : light dependant image_map? Server Time
25 Nov 2024 03:27:40 EST (-0500)
  light dependant image_map? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Erhard Ducke
Subject: light dependant image_map?
Date: 29 Nov 2003 08:48:50
Message: <pj8hsvo9ajp3rbpqcuej2nmf45s7f9bobo@4ax.com>
Hi!
Is it possible to show different image_maps on an object depending on the
quantity of light that falls on a part of the object?
Background:
The earth should show a night bitmap (with city lights) on the night side
and another bitmap on the side that is hit by the sunlight...
Thanks!
E.D.
-- 
Erhard Ducke


Post a reply to this message

From: Christoph Hormann
Subject: Re: light dependant image_map?
Date: 29 Nov 2003 09:32:04
Message: <5pmm91-s7f.ln1@triton.imagico.de>
Erhard Ducke wrote:
> Hi!
> Is it possible to show different image_maps on an object depending on the
> quantity of light that falls on a part of the object?
> Background:
> The earth should show a night bitmap (with city lights) on the night side
> and another bitmap on the side that is hit by the sunlight...

If you really need to have a different pigment on lit and shadowed parts 
of the scene you can use the shadow_pigment feature from Mlpov.  For the 
earth (light source far away, no shadows) a slope or gradient pattern 
based pigment would suffice.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Erhard Ducke
Subject: Re: light dependant image_map?
Date: 29 Nov 2003 11:59:45
Message: <76jhsv4pk8ttf7o4su0flpeeja13hg5ols@4ax.com>
On Sat, 29 Nov 2003 15:24:05 +0100, Christoph Hormann
<chr### [at] gmxde> wrote:

>shadow_pigment feature from Mlpov

As a possible and more trivial solution I declared a texture map with a
radial pattern with frequency 1 to the planet sphere like this:

                  texture {
                    radial  frequency 1
                    texture_map {
                      [0.0  T_EARTH_DAY ]
                      [0.5  T_EARTH_DAY] 
                      [0.5  T_EARTH_NIGHT]
                      [1.0  T_EARTH_NIGHT]
                    }
                 }

T_EARTH_DAY and T_EARTH_NIGHT contain different bitmaps for day and night.
But now I have a new problem:
When I rotate the radial around the y- and z-axis according to the position
of the sun like this:
texture {
                    radial  rotate y*TIME rotate z*ECLIPTIC_ANGLE
                    texture_map {...}
}

the bitmap travels with the radial pattern so that not only bright and dark
zone are moving but the whole earth seems to rotate...
I tried different positions of rotate, all give the same effect.
So it seems that the left edge of the bitmap isn't related to the sphere
any more as usual but to the radial pattern...
I hope I could make the problem clear...;-)
-- 
Erhard Ducke


Post a reply to this message

From: Christoph Hormann
Subject: Re: light dependant image_map?
Date: 29 Nov 2003 12:32:04
Message: <6l1n91-5ng.ln1@triton.imagico.de>
Erhard Ducke wrote:
> [...]
> 
> T_EARTH_DAY and T_EARTH_NIGHT contain different bitmaps for day and night.
> But now I have a new problem:
> When I rotate the radial around the y- and z-axis according to the position
> of the sun like this:
> texture {
>                     radial  rotate y*TIME rotate z*ECLIPTIC_ANGLE
>                     texture_map {...}
> }
> 
> the bitmap travels with the radial pattern so that not only bright and dark
> zone are moving but the whole earth seems to rotate...
> I tried different positions of rotate, all give the same effect.
> So it seems that the left edge of the bitmap isn't related to the sphere
> any more as usual but to the radial pattern...

This is perfectly correct, you can either apply the inverse transform to 
the textures or apply the transform only to the pattern and not to the 
whole texture.  The latter can be obtained with pigment_pattern:

texture {
   pigment_pattern {
     radial
     color_map { [0 rgb 0][1 rgb 1] }
     rotate ...
   }
   texture_map { ... }
}

the former with an inverse transform:

transform {
   ...
   inverse
}

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Christopher James Huff
Subject: Re: light dependant image_map?
Date: 29 Nov 2003 13:56:57
Message: <cjameshuff-459A0F.13570429112003@netplex.aussie.org>
In article <76jhsv4pk8ttf7o4su0flpeeja13hg5ols@4ax.com>,
 Erhard Ducke <duc### [at] gentlemansclubde> wrote:

> >shadow_pigment feature from Mlpov
> 
> As a possible and more trivial solution I declared a texture map with a
> radial pattern with frequency 1 to the planet sphere like this:
> 
>                   texture {
>                     radial  frequency 1

Radial? That seems like the wrong tool for the job when you're just 
using different textures on each side of the sphere. The gradient 
pattern would make more sense...or even an object pattern with a plane 
object, though that would make it difficult to blend between the two.


> When I rotate the radial around the y- and z-axis according to the position
> of the sun like this:
> texture {
>                     radial  rotate y*TIME rotate z*ECLIPTIC_ANGLE
>                     texture_map {...}
> }
> 
> the bitmap travels with the radial pattern so that not only bright and dark
> zone are moving but the whole earth seems to rotate...

This is because you are rotating the entire texture, not just the 
pattern. You need to counter-rotate the textures in the texture_map by 
-y*TIME, or use pigment_pattern or a function pattern to rotate just the 
pattern. If you use the gradient pattern, you could just rotate the 
gradient vector with vrotate().

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Norbert Kern
Subject: Re: light dependant image_map?
Date: 29 Nov 2003 14:10:01
Message: <web.3fc8eebba5497df739448a630@news.povray.org>
Hi,
you should use something like that:

//start code

#declare lightsource = <0,1,1>*1000;

sphere {
        0,1
        texture {
                slope {lightsource,0,1}
                texture_map {
                        [0.475 night_tex]
                        [0.525 day_tex]
                }
        }
        rotate -140*y
        rotate -20*x
}

camera {location <3,3,-3> angle 33 look_at 0}
light_source {lightsource,2.5}

//end code

Norbert



Erhard Ducke wrote:

>Hi!
>Is it possible to show different image_maps on an object depending on the
>quantity of light that falls on a part of the object?
>Background:
>The earth should show a night bitmap (with city lights) on the night side
>and another bitmap on the side that is hit by the sunlight...
>Thanks!
>E.D.
>Erhard Ducke
>


Post a reply to this message

From: Erhard Ducke
Subject: Re: light dependant image_map?
Date: 30 Nov 2003 06:14:01
Message: <ptjjsvgtmvf2idoth3su5su9034e7adj4k@4ax.com>
On Sat, 29 Nov 2003 18:29:42 +0100, Christoph Hormann
<chr### [at] gmxde> wrote:

>texture {
>   pigment_pattern {
>     radial
>     color_map { [0 rgb 0][1 rgb 1] }
>     rotate ...
>   }
>   texture_map { ... }
>}

Using this one I got the same 'mistake'...

//********begin pov code*********
The inverse rotating works fine:
    sphere {0,EARTH_RADIUS
                  texture {
                    radial
                    transform {ROT_TEXTURE}
                    texture_map {
                      [0.0  T_EARTH_DAY transform {ROT_TEXTURE inverse}]
                      [0.5  T_EARTH_DAY transform {ROT_TEXTURE inverse}] 
                      [0.52  T_EARTH_NIGHT transform {ROT_TEXTURE inverse}]
                      [0.98  T_EARTH_NIGHT transform {ROT_TEXTURE inverse}]
                      [1.0  T_EARTH_DAY transform {ROT_TEXTURE inverse}]
                    }
                 }
    }
//*********end pov code********

... but I feel there must be a simplier solution to my problem.
Thanks for your help!
-- 
Erhard Ducke


Post a reply to this message

From: Erhard Ducke
Subject: Re: light dependant image_map?
Date: 30 Nov 2003 06:22:49
Message: <ofkjsvcmmbcptqsjf4net10i3gkcf7j0s3@4ax.com>
Sorry, I have to correct my earlier followup. This one is better:

On Sat, 29 Nov 2003 18:29:42 +0100, Christoph Hormann
<chr### [at] gmxde> wrote:

>texture {
>   pigment_pattern {
>     radial
>     color_map { [0 rgb 0][1 rgb 1] }
>     rotate ...
>   }
>   texture_map { ... }
>}

Using the code above I got the same 'mistake'...

The inverse rotating works just fine:

//********begin pov code*********
    sphere {0,EARTH_RADIUS
                  texture {
                    radial
                    transform {ROT_TEXTURE}
                    texture_map {
                      [0.0  T_EARTH_DAY transform {ROT_TEXTURE inverse}]
                      [0.5  T_EARTH_DAY transform {ROT_TEXTURE inverse}] 
                      [0.52  T_EARTH_NIGHT transform {ROT_TEXTURE inverse}]
                      [0.98  T_EARTH_NIGHT transform {ROT_TEXTURE inverse}]
                      [1.0  T_EARTH_DAY transform {ROT_TEXTURE inverse}]
                    }
                 }
    }
//*********end pov code********

... but I feel there must be a simplier and more elegant solution to my
problem. Five times the same boring inverse transformation is definitely
too much writing...;-)
Thanks for your help!
-- 
Erhard Ducke


Post a reply to this message

From: Michael Zier
Subject: Re: light dependant image_map?
Date: 2 Dec 2003 05:08:33
Message: <3fcc64a1$1@news.povray.org>
Why not using the "phase" keyword...
The following code works fine.

#declare T1=texture {
 pigment {
  gradient x+y
  frequency 6
  color_map {
   [0.45 rgb <1,1,0>]
   [0.55 rgb <1,0,0>]
  }
 }
 finish {ambient 1}
}

#declare T2=texture {
 pigment {
  gradient z+y
  frequency 4
  color_map {
   [0.45 rgb <0,1,1>]
   [0.55 rgb <0,0,1>]
  }
 }
 finish {ambient 1}
}

sphere {
 0,1
 texture {
  radial

  triangle_wave
  texture_map {
   [0.4 T1]
   [0.6 T2]
  }
 }
}

camera {
 location <3,2,-4>
 look_at 0
}


Post a reply to this message

From: Christopher James Huff
Subject: Re: light dependant image_map?
Date: 2 Dec 2003 09:35:17
Message: <cjameshuff-771852.09343602122003@netplex.aussie.org>
In article <3fcc64a1$1@news.povray.org>,
 "Michael Zier" <zie### [at] gmxnet> wrote:

> Why not using the "phase" keyword...
> The following code works fine.

Not really. Due to the use of the radial pattern, the blend area gets 
thinner towards the poles, pinching to a point at the poles. In real 
life, it is constant. (Actually, getting slightly thicker, due to the 
oblate shape of the planet.)
The gradient or slope patterns are more suited to this application. 
Rotating the pattern is as simple as rotating the gradient or slope 
vectors.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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