POV-Ray : Newsgroups : povray.general : Function for air density : Re: Function for air density Server Time
30 Jul 2024 06:30:23 EDT (-0400)
  Re: Function for air density  
From: SharkD
Date: 2 Sep 2009 09:26:03
Message: <4a9e726b$1@news.povray.org>
triple_r wrote:
> Just make it go up to 50 or 100km.  The density at 100km is about 6e-4 percent
> the density at the surface.  You'd have to try *very* hard to make this appear
> as a discontinuity.
> 
>> Could you please rewrite your density function to take this into
>> account?
> 
> exp(-1.2e-4*(h/Meters-6375000))
> 
> Does that sound right?  Just be aware of precision issues if you're going to
> model the earth in meters.
> 
>  - Ricky

Here's my first attempt. I can't see a whole lot in the image. Could you 
suggest some better settings for the scattering media?

-Mike

//BEGIN
#local Meters = 4;
#local InnerRadius = EarthRadius;
#local OuterRadius = EarthRadius + 100000 * Meters;
#local BoundRadius = sin(acos(EarthRadius/OuterRadius)) * OuterRadius;
#local DiffrRadius = OuterRadius - InnerRadius;
#local ScaleAmount = 32;			// arbitrary number
#local HazePigment = pigment
{
	function {exp(-1.2e-4 * (f_r(x,y,z) - EarthRadius)/Meters)}
	color_map
	{
		[0 rgb 0]
		[1 rgb 1]
	}
}

difference
{
	sphere {0, OuterRadius}
	sphere {0, InnerRadius}
	bounded_by {cylinder {<0,EarthRadius,0,>, <0,OuterRadius,0,>, BoundRadius}}
	hollow
	material
	{
		texture {pigment {rgbt 1}}
		interior
		{
			media
			{
				scattering	{1, 0.5 * 1/ScaleAmount/1000}
				method		3
				intervals	1
//				samples		30, 100
				samples		10, 40
				density
				{
					pigment_pattern {HazePigment}
					density_map {[1/4 rgb 0][3/4 rgb 1]}
				}

			}
		}
		scale ScaleAmount
	}
	translate -y * EarthRadius
}
//END


Post a reply to this message

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