POV-Ray : Newsgroups : povray.general : user-defined media density function Server Time
1 Aug 2024 00:16:53 EDT (-0400)
  user-defined media density function (Message 1 to 7 of 7)  
From: Eric Buddington
Subject: user-defined media density function
Date: 24 Aug 2006 20:25:01
Message: <web.44ee43068f5cf101abef64010@news.povray.org>
I'm trying to model the Earth's atmosphere (as a sphere) using scattering
media.
The atmosphere's density follows a e^(height) type function.
The available wave types don't seem to include this. I've played with
spherical mapping and poly and cubic wave types,but it's unsatisfactory so
far.

Is there a way for me to create a radial density pattern of A^Br, where 'r'
is the radius and A and B are constants?

-Eric


Post a reply to this message

From: Mike Williams
Subject: Re: user-defined media density function
Date: 24 Aug 2006 21:11:49
Message: <vDNYPGAmvk7EFwX$@econym.demon.co.uk>
Wasn't it Eric Buddington who wrote:
>I'm trying to model the Earth's atmosphere (as a sphere) using scattering
>media.
>The atmosphere's density follows a e^(height) type function.
>The available wave types don't seem to include this. I've played with
>spherical mapping and poly and cubic wave types,but it's unsatisfactory so
>far.
>
>Is there a way for me to create a radial density pattern of A^Br, where 'r'
>is the radius and A and B are constants?

You can use any function{} as a media density pattern

http://www.econym.demon.co.uk/isotut/patterns.htm#density

You could #include functions.inc and use f_r(x,y,z) as an expression for
r, or you could use pow((x*x+y*y+z*z),0.5).

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Eric Buddington
Subject: Re: user-defined media density function
Date: 25 Aug 2006 00:10:00
Message: <web.44ee77ce2dcd370abef64010@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it Eric Buddington who wrote:
> >Is there a way for me to create a radial density pattern of A^Br, where 'r'
> >is the radius and A and B are constants?
>
> You can use any function{} as a media density pattern
>
> http://www.econym.demon.co.uk/isotut/patterns.htm#density
>
> You could #include functions.inc and use f_r(x,y,z) as an expression for
> r, or you could use pow((x*x+y*y+z*z),0.5).

Thank you! I'd been unable to find that in the docs, and was hoping it was
possible. This works far better than the poly_wave approximation I tried
before.

-Eric


Post a reply to this message

From: Nekar
Subject: Re: user-defined media density function
Date: 25 Aug 2006 02:07:50
Message: <44ee93b6@news.povray.org>
"Eric Buddington" <ebu### [at] wesleyanedu> wrote in message 
news:web.44ee43068f5cf101abef64010@news.povray.org...
> I'm trying to model the Earth's atmosphere (as a sphere) using scattering
> media.
> The atmosphere's density follows a e^(height) type function.
> The available wave types don't seem to include this. I've played with
> spherical mapping and poly and cubic wave types,but it's unsatisfactory so
> far.
>


Does this include the troposphere, stratosphere, mesosphere, ozone, etc? Or 
is it just a simple function?


-- 
-Nekar Xenos
"The truth is out there"


Post a reply to this message

From: Eric Buddington
Subject: Re: user-defined media density function
Date: 25 Aug 2006 21:15:01
Message: <web.44ef9f702dcd370abef64010@news.povray.org>
"Nekar" <ger### [at] rpmmagcoza> wrote:
> "Eric Buddington" <ebu### [at] wesleyanedu> wrote in message
> news:web.44ee43068f5cf101abef64010@news.povray.org...
> > I'm trying to model the Earth's atmosphere (as a sphere) using scattering
> > media.
> > The atmosphere's density follows a e^(height) type function.
> > The available wave types don't seem to include this. I've played with
> > spherical mapping and poly and cubic wave types,but it's unsatisfactory so
> > far.
> >
>
>
> Does this include the troposphere, stratosphere, mesosphere, ozone, etc? Or
> is it just a simple function?

It uses the barometric formula
(http://en.wikipedia.org/wiki/Barometric_formula)
to calculate air density (assuming constant temperature, so it's just
Ae^B(height)), and uses Raleigh (type 4) scattering on that density. I then
scale it to earth size, and squash it to fit the Earth's ellipsoidosity
(That's a word. Really. I bet.)

It seems a little too thin overall, probably because there's a fair amount
of absorption and isotropic scattering in the troposphere that I haven't
added yet.

Clouds would be cool to add, but I think very computationally expensive to
do well (this is video, so I can't afford even 15 minutes per image)

-Eric


Post a reply to this message

From: Tim Attwood
Subject: Re: user-defined media density function
Date: 26 Aug 2006 16:02:32
Message: <44f0a8d8@news.povray.org>
> scale it to earth size, and squash it to fit the Earth's ellipsoidosity
> (That's a word. Really. I bet.)

I think the word is ellipticity, or you can use oblateness, since the earth
is an oblate spheroid shape. Though flattening, or equatorial bulge are
probably more descriptive terms.

sphere {0,1 scale (7900/7927)*y}


Post a reply to this message

From: Nekar Xenos
Subject: Re: user-defined media density function
Date: 27 Aug 2006 14:28:20
Message: <44f1e444@news.povray.org>
I did something similar before. I modified the densities in mediasky.pov 
according to info from http://en.wikipedia.org/wiki/Earth's_atmosphere and 
http://en.wikipedia.org/wiki/Ozone_layer

Interestingly the sky wouldn't look right untill I added the ozone layer. 
Unfortunately I have lost these files and I have to do it all over again some 
time.


-- 
/* Nekar Xenos */#local N=<-20,40,100>;#local K=<20,-40,100>;#local R=seed(0);
blob{#while((K-N).x>0)#local X=N;#local N=N+<rand(R),rand(R),1>/3;#local N=(
vlength(N-K)<vlength(X-K)?N:2*X-N);sphere{<N.y,-N.x,N.z>,1,1 scale .02}sphere{N
,1,1 scale.02}sphere{<-N.x-40,N.y,N.z>1,1 scale.01}sphere{<N.x+40,-N.y,N.z>1,1
scale.01 }#end pigment{rgbt 1}interior{media{emission <2,4,5>*5}}hollow}


Post a reply to this message

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