POV-Ray : Newsgroups : povray.binaries.scene-files : Sky simulation Server Time
19 Apr 2024 05:28:48 EDT (-0400)
  Sky simulation (Message 11 to 20 of 38)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Fractracer
Subject: Re: Sky simulation
Date: 1 Jul 2013 09:15:00
Message: <web.51d1801559bb6361916440570@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > Thanks, I go to try this when my render in works will stop.
>
> OK but I still find it odd you get an error when using Y as a parameter.
> What is the exact error you get, can you copy and paste it here for us
> to see?
>
> If you copy the below code into an empty POV document (so just 1 line) -
> does it work?
>
> #local xyYtoR = function (x,y,Y){ x+y+Y }

OOOPS!!! after trying this (its work) I have re-read my code and I've seen a Y
declared by me (I know, #local is better than #declare).
I'm a stupID!!


Post a reply to this message

From: scott
Subject: Re: Sky simulation
Date: 1 Jul 2013 09:52:13
Message: <51d1898d$1@news.povray.org>
>> #local xyYtoR = function (x,y,Y){ x+y+Y }
>
> OOOPS!!! after trying this (its work) I have re-read my code and I've seen a Y
> declared by me (I know, #local is better than #declare).
> I'm a stupID!!

Not your fault, no matter what variable name you choose to use there is 
always the chance someone else is using that same name elsewhere. 
Another reason to stick to x,y,z for function parameters.


Post a reply to this message

From: scott
Subject: Re: Sky simulation
Date: 5 Jul 2013 09:40:50
Message: <51d6cce2$1@news.povray.org>
> See example images posted in p.b.i
>
> SkySim.inc is the macro, SkySimTestGround.pov is a simple example of a
> scene using the macro.

Updated .inc file attached to fix the bug found by Thomas in p.b.i


Post a reply to this message


Attachments:
Download 'windows-1252' (7 KB)

From: Cousin Ricky
Subject: Re: Sky simulation
Date: 7 Sep 2013 17:30:00
Message: <web.522b99e159bb6361306548240@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >> #local xyYtoR = function (x,y,Y){ x+y+Y }
> >
> > OOOPS!!! after trying this (its work) I have re-read my code and I've seen a Y
> > declared by me (I know, #local is better than #declare).
> > I'm a stupID!!

You are not stupid, Fractracer.  It is a design flaw in POV-Ray.

> Not your fault, no matter what variable name you choose to use there is
> always the chance someone else is using that same name elsewhere.
> Another reason to stick to x,y,z for function parameters.

If the ideal of using meaningful identifier names isn't reason enough, sticking
to x, y, and z won't help if the function has more than three arguments.  That's
why I do things like this:

   #declare RE_fn_Wheel = function (x, y, z, RE_P0_RMajor, RE_P1_rMinor)

Where "RE_" is a prefix reserved by the include file (i.e., users are instructed
not to declare any identifiers that begin with "RE_").  Cumbersome yes, but
accidents are avoided.

This happens whenever you declare an identifier and then later use that same
name as a function argument.  (I mentioned this in the p.b.i thread where a
similar issue turned up with macro names.)  Oddly, it doesn't happen if you
declare the identifier /after/ the function is defined.


Post a reply to this message

From: Ive
Subject: Re: Sky simulation
Date: 27 Oct 2013 11:05:24
Message: <526d2bb4$1@news.povray.org>
Great work!

I was just about to do the same thing but while struggling with the math 
to express the pigment functions I luckily found your implementation ;)
But I'm wondering: while you cite the Preetham paper you do use 
different values for the A to C parameters and also for the Perez 
formulation.
Actually I do like the resulting renders better with the original values 
from the Preetham paper (might very well just be a matter of individual 
taste) but I'm curious where the other values did come from.

Also I'm wondering about the multiplication factor of 1000 for the 
zenith luminance. As far as I understand it this formula return the
luminance in cd/m2 therefore this additional multiplication just makes 
the exposure factor unnecessary small.

Here is what I do use (with the originalPreetham/Perez values):

// constant factors
#local AY = 0.1787*Turbidity- 1.4630;
#local BY =-0.3554*Turbidity+ 0.4275;
#local CY =-0.0227*Turbidity+ 5.3251;
#local DY = 0.1206*Turbidity- 2.5771;
#local EY =-0.0670*Turbidity+ 0.3703;

#local Ax =-0.0193*Turbidity- 0.2592;
#local Bx =-0.0665*Turbidity+ 0.0008;
#local Cx =-0.0004*Turbidity+ 0.2125;
#local Dx =-0.0641*Turbidity- 0.8989;
#local Ex =-0.0033*Turbidity+ 0.0452;

#local Ay =-0.0167*Turbidity- 0.2608;
#local By =-0.0950*Turbidity+ 0.0092;
#local Cy =-0.0079*Turbidity+ 0.2102;
#local Dy =-0.0441*Turbidity- 1.6537;
#local Ey =-0.0109*Turbidity+ 0.0529;


#macro computeZenithColor(T,thetas)
  // Calculate luminance

  #local zenithLuminance = ((4.0453*T - 4.9710) * tan( (4.0/9.0 - T/120) 
* (pi-2*thetas) ) - 0.2155*T + 2.4192);
  #if(zenithLuminance<=0)
   #local zenithLuminance=1e-11;
  #end

  // Calculate colour
  #local thetas2 = thetas*thetas;
  #local thetas3 = thetas*thetas2;
  #local T2 = T*T;

  #local zx= ( 0.00166*thetas3 - 0.00375*thetas2 + 0.00209*thetas) * T2 +
             (-0.02903*thetas3 + 0.06377*thetas2 - 0.03202*thetas + 
0.00394) * T +
             ( 0.11693*thetas3 - 0.21196*thetas2 + 0.06052*thetas + 
0.25886);

  #local zy= ( 0.00275*thetas3 - 0.00610*thetas2 + 0.00317*thetas) * T2 +
             (-0.04214*thetas3 + 0.08970*thetas2 - 0.04153*thetas + 
0.00516) * T +
             ( 0.15346*thetas3 - 0.26756*thetas2 + 0.06670*thetas + 
0.26688);

  <zx,zy,zenithLuminance>

#end


-Ive


Post a reply to this message

From: scott
Subject: Re: Sky simulation
Date: 29 Oct 2013 05:03:13
Message: <526f79d1$1@news.povray.org>
> But I'm wondering: while you cite the Preetham paper you do use
> different values for the A to C parameters and also for the Perez
> formulation.

I took the values that the Stellarium source code used rather than the 
paper itself, I guess the authors of Stellarium tweaked them a bit. I 
guess you can use whichever set look better for you.

> Also I'm wondering about the multiplication factor of 1000 for the
> zenith luminance. As far as I understand it this formula return the
> luminance in cd/m2 therefore this additional multiplication just makes
> the exposure factor unnecessary small.

The formula in the paper gives the luminance in K cd/m2, that's why the 
1000 factor is in there.


Post a reply to this message

From: posfan12
Subject: Re: Sky simulation
Date: 6 Mar 2018 09:15:01
Message: <web.5a9ea1f059bb6361d46f4df10@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > But I'm wondering: while you cite the Preetham paper you do use
> > different values for the A to C parameters and also for the Perez
> > formulation.
>
> I took the values that the Stellarium source code used rather than the
> paper itself, I guess the authors of Stellarium tweaked them a bit. I
> guess you can use whichever set look better for you.
>
> > Also I'm wondering about the multiplication factor of 1000 for the
> > zenith luminance. As far as I understand it this formula return the
> > luminance in cd/m2 therefore this additional multiplication just makes
> > the exposure factor unnecessary small.
>
> The formula in the paper gives the luminance in K cd/m2, that's why the
> 1000 factor is in there.

Quick question:

How do I convert the units of ExposureFactor to my scene?

In my scene, 20 units = 1 foot.

Thanks!!


Mike


Post a reply to this message

From: Alain
Subject: Re: Sky simulation
Date: 6 Mar 2018 21:48:20
Message: <5a9f52f4$1@news.povray.org>

> scott <sco### [at] scottcom> wrote:
>>> But I'm wondering: while you cite the Preetham paper you do use
>>> different values for the A to C parameters and also for the Perez
>>> formulation.
>>
>> I took the values that the Stellarium source code used rather than the
>> paper itself, I guess the authors of Stellarium tweaked them a bit. I
>> guess you can use whichever set look better for you.
>>
>>> Also I'm wondering about the multiplication factor of 1000 for the
>>> zenith luminance. As far as I understand it this formula return the
>>> luminance in cd/m2 therefore this additional multiplication just makes
>>> the exposure factor unnecessary small.
>>
>> The formula in the paper gives the luminance in K cd/m2, that's why the
>> 1000 factor is in there.
> 
> Quick question:
> 
> How do I convert the units of ExposureFactor to my scene?
> 
> In my scene, 20 units = 1 foot.
> 
> Thanks!!
> 
> 
> Mike
> 

The formula use meter, a meter = about 39 inches, or 3 feet and 3 inches 
(3.25 feet in 1 m).
There are 10.5625 square feet in a square meter.


Post a reply to this message

From: clipka
Subject: Re: Sky simulation
Date: 7 Mar 2018 06:44:04
Message: <5a9fd084$1@news.povray.org>
Am 07.03.2018 um 03:48 schrieb Alain:

> The formula use meter, a meter = about 39 inches, or 3 feet and 3 inches
> (3.25 feet in 1 m).
> There are 10.5625 square feet in a square meter.

Sorry to be blunt, but with that many decimals, that number is a lie, as
it implies a precision it doesn't have.

As a rule of thumb, whenever you're doing mathematical computations with
approximate values, it is good practice to round the end result to the
lowest number of significant digits of any of the "input" values.

Also, since the UK imperial and US customary units are defined in terms
of the metric system (yes, you UK folks have been using the metric
system ever since 1930, and you US folks even since 1893(*); it's just
been hidden from you :P), that's what I'd recommend to start with:

(A) from the 1930 BSI (UK) / 1933 ASA (US) definition:

1 inch = 25.4 mm = 0.0254 m
1 foot = 12 inch = 0.3048 m

(B) from the 1959 International Yard and Pound Agreement:

1 yard = 0.9144 m
1 foot = 1/3 yard = 0.3048 m

Either way:

1 square foot = 0.09290303 m^2
1/0.09290303 square feet = 1 m^2

These numbers are exact, by virtue of definition of the UK imperial and
US customary units. Alternatively, here's a high-precision approximation:

10,7639104167097223083335055559 square feet = 1 m^2


(* The 1893 Mendenhall Order (US) definition had 1 yard = 3600/3937 m,
which gives slightly different results, and has remained the basis for
the survey foot.)


Post a reply to this message

From: Stephen
Subject: Re: Sky simulation
Date: 7 Mar 2018 07:21:39
Message: <5a9fd953$1@news.povray.org>
On 07/03/2018 11:44, clipka wrote:
> Sorry to be blunt, but with that many decimals, that number is a lie, as
> it implies a precision it doesn't have.
> 

You are right of course, if bluntly put.

> As a rule of thumb, whenever you're doing mathematical computations with
> approximate values, it is good practice to round the end result to the
> lowest number of significant digits of any of the "input" values.
> 
> Also, since the UK imperial and US customary units are defined in terms
> of the metric system (yes, you UK folks have been using the metric
> system ever since 1930, and you US folks even since 1893(*); it's just
> been hidden from you :P), that's what I'd recommend to start with:

Now, I would be surprised if people in the UK did not know that. I guess 
I was about 15 or 16 when I was taught it at school.
But as a rule of thumb that an inch is about the length of your thumb's 
distal phalanx. Is good enough for children as they more resemble the 
size of an adult of bygone years.

BTW has anyone heard or seen a ruler where feet are divided into tenths?
Giving the impression that there are 10 "X inches" to a foot.
I saw one once about 30 years ago.


-- 

Regards
     Stephen


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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