POV-Ray : Newsgroups : povray.general : Modelling atmospheric refraction Server Time
23 Dec 2024 20:00:51 EST (-0500)
  Modelling atmospheric refraction (Message 1 to 7 of 7)  
From: Glenn W
Subject: Modelling atmospheric refraction
Date: 14 May 2018 01:05:01
Message: <web.5af917a3f1832a558e8262e20@news.povray.org>
Hi,

I'm trying to model atmospheric refraction on a globe. My first attempt at this
was to have a sphere centred at the origin representing the earth surface, and
then several concentric spheres that represent the different densities (and
therefore different refractive indices) of air as you gain in altitude:

sphere {
    <0, 0, 0>, EarthRadius
    pigment {

        image_map {
            jpeg "mercator.jpg"
            map_type 1
        }
    }
}

.... and then:

sphere {
 <0, 0, 0>, EarthRadius + 0.050 // 50 metres above the surface
 texture { pigment { color White transmit 1.0 } }
 interior { ior 1.000271 }
}
sphere {
 <0, 0, 0>, EarthRadius + 0.001 // 1 metre above the surface
 texture { pigment { color White transmit 1.0 } }
 interior { ior 1.000293 }
}

I then place the camera a few metres off the ground (that is, between the two
refractive spheres) and point it off into the distance at a tangent to the
sphere - the idea is that this ray will eventually hit the boundary of the
higher sphere, and refract the ray downwards. This should result in an image
where the background mountains appear higher than they truly are in 3D space.
But this setup doesn't give me the results I am expecting. Is there anyone that
has successfully modeled atmospheric refraction before? Failing that, iss there
some way to debug trace a particular ray, showing exactly how it interacts with
these refractive spheres? What happens at the boundary of one of the spheres if
the light is travelling *OUT* of the sphere?

I have attempted to use "difference" spheres, which makes the refractive spheres
into "shells", like layers of an onion - I have a feeling this is where I should
be heading, but again, couldn't get it to work.

Any help appreciated.


Post a reply to this message

From: Stephen
Subject: Re: Modelling atmospheric refraction
Date: 14 May 2018 03:54:52
Message: <5af940cc$1@news.povray.org>
On 14/05/2018 05:59, Glenn W wrote:
> Failing that, iss there
> some way to debug trace a particular ray, showing exactly how it interacts with
> these refractive spheres?


Interesting project. I'm sorry I have no experience with this.
I think that if you used a very tight beamed spotlight with media and 
photons. Might be something to try.

-- 

Regards
     Stephen


Post a reply to this message

From: William F Pokorny
Subject: Re: Modelling atmospheric refraction
Date: 14 May 2018 07:24:45
Message: <5af971fd@news.povray.org>
On 05/14/2018 12:59 AM, Glenn W wrote:
> Hi,
> 
> I'm trying to model atmospheric refraction on a globe. My first attempt at this
> was to have a sphere centred at the origin representing the earth surface, and
> then several concentric spheres that represent the different densities (and
> therefore different refractive indices) of air as you gain in altitude:
> 

I'm not aware of anyone having modeled this effect in POV-Ray. Some 
thinking aloud - and without morning coffee as yet...

When your camera is inside an object you want to use the keyword 
'hollow' or 'hollow on'. When a ray starts, the containing interior is 
associated by where the ray origin sits. I'm not sure what happens when 
there are multiple initial surrounding interiors. Which does it pick... 
Is the ordering stable...

My understanding is when a ray leaves a surface it drops an interior and 
moves to the previous enclosing interior as determined when it 
encountered starting surfaces / interiors - or it drops back to no 
interior. So maybe shells, but always 'above' the camera with the most 
dense shell the most inside? Top surfaces mattering geometrically and 
the bottom surfaces compressed..?

Others here know atmosphere better than me, but atmospheric refraction 
is a continuous effect as the density increases toward the surface so 
the real light path will be a curve. If you want to demonstrate that 
curvature somewhat precisely your probably out of luck - too many 
surfaces(1) to approximate anything appearing continuous. If all you 
want is to demonstrate the visual offset for some point(s) at a distance 
from some set altitude perhaps a single containing sphere with some 
mathematical adjustments for an effective delta-IOR is enough?

It might be for near-ish objects like a mountain range in the distance 
you'll not have the accuracy in POV-Ray you need at realistic IORs to be 
able to 'see' the effect.

Expect near-ish atmospheric effects would be dominated by heat / 
convection currents, particles, humidity etc more than atmospheric 
density.

Bill P.

(1) - Perhaps there is some way to distort the surface of the containing 
objects(s) in a way which would equivalently and continuously model the 
effect?


Post a reply to this message

From: Bald Eagle
Subject: Re: Modelling atmospheric refraction
Date: 14 May 2018 10:30:00
Message: <web.5af99c422d3b5824c437ac910@news.povray.org>
I see WP has replied already -

I'll follow up with some thinking out loud.

1. As clipka will probably eventually point out, POV-Ray is a raytracing
software, not a commercial scientific or astronomical visualization package.  So
keep in mind that there may be limitations on what you can realistically
accomplish.

2.  Related to the above, there will be a certain distance / unit limit due to
the computational, representational, and storage methods used to process the
data.  As such, there will be rounding and float errors, etc.
Just check out the infamous RingWorld thread(s) and any astronomical or full
scale terrestrial/planetary discussions.
So, you'll also run into the real world problem of trying to measure a small
change in LARGE numbers.   Your signal may get swallowed up in the computational
error noise.

3.  I don't believe you can currently do anything like an interior_map, or apply
a pattern like gradient or spherical to an interior IOR.   This is something to
seriously consider as a future feature, but as far as I'm aware it's not yet
possible.


Which means you may need to do something clever and unrealistic to give the same
overall effect.

In the meantime, I might write a simple scene that modeled the ideal path of the
refracted ray, and plot that as a sphere sweep, spline, etc and put a box target
at the intended impact point, and see what happens when you simulate the light
ray over such long distances, with such large numbers.

Also, you can scale down your scene by a few orders of magnitude, so that all of
your numbers fall within 1e-6 < x < 1e6 or whatever the upper and lower bounds
currently are.


Post a reply to this message

From: clipka
Subject: Re: Modelling atmospheric refraction
Date: 14 May 2018 10:45:47
Message: <5af9a11b$1@news.povray.org>
Am 14.05.2018 um 16:25 schrieb Bald Eagle:

> 1. As clipka will probably eventually point out, POV-Ray is a raytracing
> software, not a commercial scientific or astronomical visualization package.  So
> keep in mind that there may be limitations on what you can realistically
> accomplish.

Why should I point that out? Enough people doing that already ;)

> 3.  I don't believe you can currently do anything like an interior_map, or apply
> a pattern like gradient or spherical to an interior IOR.   This is something to
> seriously consider as a future feature, but as far as I'm aware it's not yet
> possible.

You're absolutely right there - both with the "not yet possible"
assessment as well as the "consider as a future feature" part.

Certainly not trivial to implement though, so I hope nobody's holding
their breath.


Post a reply to this message

From: Stephen
Subject: Re: Modelling atmospheric refraction
Date: 14 May 2018 13:25:02
Message: <5af9c66e$1@news.povray.org>
On 14/05/2018 08:54, Stephen wrote:
> On 14/05/2018 05:59, Glenn W wrote:
>> Failing that, iss there
>> some way to debug trace a particular ray, showing exactly how it 
>> interacts with
>> these refractive spheres?
> 
> 
> Interesting project. I'm sorry I have no experience with this.
> I think that if you used a very tight beamed spotlight with media and 
> photons. Might be something to try.
> 

The above works but I cannot get the layered media shells to work. Sorry.

-- 

Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Modelling atmospheric refraction
Date: 14 May 2018 19:06:34
Message: <5afa167a$1@news.povray.org>
Le 18-05-14 à 00:59, Glenn W a écrit :
> Hi,
> 
> I'm trying to model atmospheric refraction on a globe. My first attempt at this
> was to have a sphere centred at the origin representing the earth surface, and
> then several concentric spheres that represent the different densities (and
> therefore different refractive indices) of air as you gain in altitude:
> 
> sphere {
>      <0, 0, 0>, EarthRadius
>      pigment {
> 
>          image_map {
>              jpeg "mercator.jpg"
>              map_type 1
>          }
>      }
> }
> 
> .... and then:
> 
> sphere {
>   <0, 0, 0>, EarthRadius + 0.050 // 50 metres above the surface
>   texture { pigment { color White transmit 1.0 } }
>   interior { ior 1.000271 }
> }
> sphere {
>   <0, 0, 0>, EarthRadius + 0.001 // 1 metre above the surface
>   texture { pigment { color White transmit 1.0 } }
>   interior { ior 1.000293 }
> }
> 
> I then place the camera a few metres off the ground (that is, between the two
> refractive spheres) and point it off into the distance at a tangent to the
> sphere - the idea is that this ray will eventually hit the boundary of the
> higher sphere, and refract the ray downwards. This should result in an image
> where the background mountains appear higher than they truly are in 3D space.
> But this setup doesn't give me the results I am expecting. Is there anyone that
> has successfully modeled atmospheric refraction before? Failing that, iss there
> some way to debug trace a particular ray, showing exactly how it interacts with
> these refractive spheres? What happens at the boundary of one of the spheres if
> the light is travelling *OUT* of the sphere?
> 
> I have attempted to use "difference" spheres, which makes the refractive spheres
> into "shells", like layers of an onion - I have a feeling this is where I should
> be heading, but again, couldn't get it to work.
> 
> Any help appreciated.
> 
> 

Anytime that you encounter a surface between a high and low IOR from the 
high side, you may get total internal reflection. It can happen no 
mather the difference between the 2 IORs if the incident angle is 
shallow enough.

In your case, it will cause bands to appear.

What you need is some support for variable IOR. This is not supported. 
Maybe in some future version, but nowhere near in the future.

A thing that you may try is to use some curved prism somewhere between 
the camera and those distant objects.


Post a reply to this message

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