POV-Ray : Newsgroups : povray.binaries.images : Sky simulation Server Time
30 Jul 2024 08:29:56 EDT (-0400)
  Sky simulation (Message 1 to 10 of 58)  
Goto Latest 10 Messages Next 10 Messages >>>
From: scott
Subject: Sky simulation
Date: 7 Jun 2013 03:36:29
Message: <51b18d7d@news.povray.org>
I've created a macro called SkySim (I'll post it in p.b.s-f once I've 
tidied it up and added comments) that creates a realistic looking sky 
pigment in a sky_sphere based on the sun position and the "haziness" of 
the sky.

The algorithm used is from this paper:

www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf

It is the same algorithm used by the open-source software Stellarium, so 
I already had a starting point in code for the POV version.

If you also use "sunpos.inc" to get the sun position then you can create 
the correct sky based on just the longitude/latitude and time of day 
(this is how I've done it in the test scene).

The renders below are from the test scene with an isosurface ground and 
fog, however I've patched my version of POV so that the fog colour 
matches the sky_sphere and is not a constant colour. I think this gives 
a realistic perception of depth and renders very quickly.

Obviously in a real scene you may want to add clouds, but I hope it's a 
useful starting point for a realistic looking sky.


Post a reply to this message


Attachments:
Download 'skysimtestground1.png' (351 KB) Download 'skysimtestground2.png' (237 KB) Download 'skysimtestground3.png' (259 KB) Download 'skysimtestground4.png' (262 KB) Download 'skysimtestground5.png' (301 KB) Download 'skysimtestground6.png' (197 KB) Download 'skysimtestground7.png' (173 KB)

Preview of image 'skysimtestground1.png'
skysimtestground1.png

Preview of image 'skysimtestground2.png'
skysimtestground2.png

Preview of image 'skysimtestground3.png'
skysimtestground3.png

Preview of image 'skysimtestground4.png'
skysimtestground4.png

Preview of image 'skysimtestground5.png'
skysimtestground5.png

Preview of image 'skysimtestground6.png'
skysimtestground6.png

Preview of image 'skysimtestground7.png'
skysimtestground7.png


 

From: Thomas de Groot
Subject: Re: Sky simulation
Date: 7 Jun 2013 04:04:25
Message: <51b19409$1@news.povray.org>
On 7-6-2013 9:36, scott wrote:
> I've created a macro called SkySim (I'll post it in p.b.s-f once I've
> tidied it up and added comments) that creates a realistic looking sky
> pigment in a sky_sphere based on the sun position and the "haziness" of
> the sky.
>
Interestingly, I use the following code to the same effect. I do not 
remember who proposed this code first unfortunately.

//code start
#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]
       [0.426 color srgb <94,  115,  215>/255]
     }
   }
}
//code end

Al (altitude) and Az (azimuth) are found using sunpos.inc; SunColor with 
CIE.inc.

Thomas


Post a reply to this message

From: William F Pokorny
Subject: Re: Sky simulation
Date: 7 Jun 2013 06:24:26
Message: <51b1b4da$1@news.povray.org>
On 06/07/2013 03:36 AM, scott wrote:
> I've created a macro called SkySim (I'll post it in p.b.s-f once I've
> tidied it up and added comments) that creates a realistic looking sky
> pigment in a sky_sphere based on the sun position and the "haziness" of
> the sky.
>
> The algorithm used is from this paper:
>
> www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf
>
> It is the same algorithm used by the open-source software Stellarium, so
> I already had a starting point in code for the POV version.
>
> If you also use "sunpos.inc" to get the sun position then you can create
> the correct sky based on just the longitude/latitude and time of day
> (this is how I've done it in the test scene).
>
> The renders below are from the test scene with an isosurface ground and
> fog, however I've patched my version of POV so that the fog colour
> matches the sky_sphere and is not a constant colour. I think this gives
> a realistic perception of depth and renders very quickly.
>
> Obviously in a real scene you may want to add clouds, but I hope it's a
> useful starting point for a realistic looking sky.

Not a tool I have in my tool box and one I would like to have. I look 
forward to trying your macro.

Bill P.


Post a reply to this message

From: Samuel Benge
Subject: Re: Sky simulation
Date: 7 Jun 2013 11:05:01
Message: <web.51b1f5b959bb636148146bbd0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> I've created a macro called SkySim

It looks great; I'll have to try it out soon.

> fog, however I've patched my version of POV so that the fog colour
> matches the sky_sphere and is not a constant colour.

Ah, I wish POV-Ray supported that kind of fog! My POV-SDL hack is just too
inflexible to work with things like media clouds. Will you be posting the patch
someday? (In fact, why aren't coders posting more patches? Is everyone waiting
till 3.7 Final or something?)

Sam


Post a reply to this message

From: Thomas de Groot
Subject: Re: Sky simulation
Date: 9 Jun 2013 03:44:50
Message: <51b43272$1@news.povray.org>
Question:

For the visible Sun, you give: #local SunRadius = vlength(sp)/214.8;

I seem to remember that Cousin Ricky evaluated the apparent size of the 
Sun as to be twice as much, i.e.: #local SunRadius = vlength(sp)*2/214.8;

I don't know who is right or wrong but personally I prefer the larger 
size :-) Somehow, it looks more like the natural aspect of the Sun, but 
that may very well not be at all objective.

Thomas


Post a reply to this message

From: scott
Subject: Re: Sky simulation
Date: 9 Jun 2013 05:19:24
Message: <51b4489c@news.povray.org>
> For the visible Sun, you give: #local SunRadius = vlength(sp)/214.8;
>
> I seem to remember that Cousin Ricky evaluated the apparent size of the
> Sun as to be twice as much, i.e.: #local SunRadius = vlength(sp)*2/214.8;
>
> I don't know who is right or wrong but personally I prefer the larger
> size :-) Somehow, it looks more like the natural aspect of the Sun, but
> that may very well not be at all objective.

For my sun radius calculation I used the values from wikipeda, distance 
to sun is 1.5e8 and radius of the sun is 6.96e5, dividing those two 
gives the 214.8.

IMO it also depends heavily on the angle/focal length of the camera you 
are using, you can easily make the sun or moon look way too big or way 
too small (IRL and in POV). In Stellarium there's even a toggle to make 
the moon 4x realistic size because it just seems more "natural", it may 
be a similar reason why Cousin Ricky put in the factor of 2.

Note that if you increase the size artificially and are using the sun 
sphere as an accurate light source for radiosity (or mcpov) you probably 
want to reduce the emission value accordingly (if making the radius 2x 
bigger the area will be 4x bigger, so reduce the emission by a factor 4).


Post a reply to this message

From: Thomas de Groot
Subject: Re: Sky simulation
Date: 9 Jun 2013 07:23:36
Message: <51b465b8$1@news.povray.org>
On 9-6-2013 11:19, scott wrote:
>
> For my sun radius calculation I used the values from wikipeda, distance
> to sun is 1.5e8 and radius of the sun is 6.96e5, dividing those two
> gives the 214.8.
>
> IMO it also depends heavily on the angle/focal length of the camera you
> are using, you can easily make the sun or moon look way too big or way
> too small (IRL and in POV). In Stellarium there's even a toggle to make
> the moon 4x realistic size because it just seems more "natural", it may
> be a similar reason why Cousin Ricky put in the factor of 2.

It is probably an unconscious tendency to 'see' the Sun (or Moon) bigger 
than they really are.

>
> Note that if you increase the size artificially and are using the sun
> sphere as an accurate light source for radiosity (or mcpov) you probably
> want to reduce the emission value accordingly (if making the radius 2x
> bigger the area will be 4x bigger, so reduce the emission by a factor 4).
>

True.

Thomas


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Sky simulation
Date: 9 Jun 2013 09:12:44
Message: <51b47f4c$1@news.povray.org>
Samuel Benge wrote:

> Ah, I wish POV-Ray supported that kind of fog! My POV-SDL hack is just too
> inflexible to work with things like media clouds. Will you be posting the patch
> someday? (In fact, why aren't coders posting more patches? Is everyone waiting
> till 3.7 Final or something?)

actually I seem to recall the license / source code comments did not
allow the publishing of modified sources for beta versions. Not sure if
that also holds for release candidates.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Sky simulation
Date: 9 Jun 2013 09:49:36
Message: <51b487f0$1@news.povray.org>
scott wrote:

> For my sun radius calculation I used the values from wikipeda, distance 
> to sun is 1.5e8 and radius of the sun is 6.96e5, dividing those two 
> gives the 214.8.

Yes, that is the correct value known since antiquity (the ratio is
simply the sine of the apparent angle that is readily observable). It
was the figuring out the actual distances/ radii that took longer ;)

http://en.wikipedia.org/wiki/Aristarchus_of_Samos

Regarding the Sun at least we rarely see the actual disk as it is lost
in the glare, and this has a larger size. And at sunset when we see it
we perceive it as larger than we would overhead:

Overhead, we tend to assume an object is not so far away (maybe typical
cloud distance). On the horizon an object is perceived to be very far
away. So the same angular size is interpreted as a larger object. This
effect persists even when no objects are available for comparison, so
that often heard explanation is an urban myth.

> IMO it also depends heavily on the angle/focal length of the camera you 
> are using, you can easily make the sun or moon look way too big or way 
> too small (IRL and in POV). 

The thing here is that the angular size of the sun is fixed, but the
angular size of other objects in the scene depends on the distance. And
in a photo or render the distance is not readily apparent, we need to
estimate it from the scale of objects.

As an extreme example suppose you simulate a telescopic view with angle
1 degree on a house on the horizon. Now the image contains a house of
reasonable size with a sun filling half the image behind it, so it looks
way to big. But if we were smarter we would judge scale from the Sun and
conclude the house is either a tiny model or very far away).


Post a reply to this message

From: s day
Subject: Re: Sky simulation
Date: 9 Jun 2013 10:05:01
Message: <web.51b48ac359bb6361e52a27db0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> I've created a macro called SkySim (I'll post it in p.b.s-f once I've
> tidied it up and added comments) that creates a realistic looking sky
> pigment in a sky_sphere based on the sun position and the "haziness" of
> the sky.

These look great, I am struggling with creating a realistic sky colour at the
moment so would look forward to giving this a try.

Sean


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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