POV-Ray : Newsgroups : povray.newusers : Animation : simulating sunset and day/night transition : Re: Animation : simulating sunset and day/night transition Server Time
26 Jun 2024 09:59:50 EDT (-0400)
  Re: Animation : simulating sunset and day/night transition  
From: Thomas de Groot
Date: 15 Jun 2012 02:49:44
Message: <4fdadb08$1@news.povray.org>
On 15-6-2012 0:11, clipka wrote:
> Am 14.06.2012 23:25, schrieb rodv92:
>> Hello, i would like to know how to make this day/sunset/night transition.
>>

I think you should read the tutorials by Bruno Cabasson in 
povray.binaries.tutorials: TerraPOV - Sky system - .

For Sun colours/temperatures, I use LightSysIV 
http://www.ignorancia.org/en/index.php?page=Lightsys and in particular 
the module CIE.inc which lets you modulate the light colour from Kelvin 
2800=red to 7500=blue white.

A typical set of code I use myself is like this (with thanks to Jaime 
Vives Piqueres in particular):

#declare Kelvin         = 6200;
#declare SunFactor      = 4;

#include "CIE.inc"
#declare SunColor     = Blackbody(Kelvin)*SunFactor;
#declare SunDis       = vlength(MySunPosition)*2/215;

#if (Area)
   #debug "\nUsing an area_light for the Sun.\n"
   light_source{
     SunPosition
     color SunColor
     area_light
     SunDis*x, SunDis*z,
     5, 5
     adaptive 2
     jitter
     circular
     orient
     parallel
     point_at <0, 0, 0>
   }
#else
   light_source {
     SunPosition
     color SunColor
     parallel
     point_at <0, 0, 0>
   }
#end

// a sky sphere
#declare fn_horizon = function {max(y, 0)}

#declare fn_sun =
function {
   pattern {
     spherical
     scale 3
     translate z
     rotate -Al*x
     rotate Az*y
   }
}

sky_sphere {
   pigment {
     function {pow(fn_horizon(x,y,z)*(1-fn_sun(x,y,z)), 0.400)}
     color_map {
       [0.000 color SunColor/SunFactor]
       [0.426 color srgb <94,  115,  215>/255]
     }
   }
}

I think you could adapt this for your needs.

Thomas


Post a reply to this message

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