POV-Ray : Newsgroups : povray.bugreports : Light beam won't refract from outside media container : Re: Light beam won't refract from outside media container Server Time
28 Aug 2025 16:16:29 EDT (-0400)
  Re: Light beam won't refract from outside media container  
From: William F Pokorny
Date: 25 Aug 2025 13:29:42
Message: <68ac9d86@news.povray.org>
On 8/24/25 13:16, Cousin Ricky wrote:
> A cylindrical beam does not refract through media unless the light
> source is inside the media container.

Thanks for the example scene!

First, when using scattering media / photons the light source must start 
outside any media container by at least some epsilon amount. Some years 
ago there was a long-ish news thread about this being how POV-Ray has 
long worked. (Yes, it seems like for the cylindrical light source this 
rule is 'somewhat' of a lie for the scattering media calculations... 
News to me.)

Second, when tracing photons through a transparent box, the box itself 
needs a photon{} block with 'reflection on' and 'refraction on'. 
Otherwise, the forward photon tracing stops at that first media-box 
surface. This is why it 'looks like' refraction is not working when the 
light's origin is outside the media-box.

Third, You've got 'hollow on' for the prism. Depending on what you want 
for a result, this can be an OK thing to do. When on, it does mean the 
prism surfaces are treated as infinitely thin surfaces and the 
scattering media (Less, certain, light source settings) is calculated 
inside the prism as if it contains the box's media for both the 
scattering result and photon, media depositions. Using 'hollow off' 
would be more 'realistic' for your scene's set up for the scattering 
contribution.

Fourth, the scattering media result is unrealistic in the original scene 
  given there is refraction. The scattering calculation is done in a 
backward tracing way. To turn off the scattering result you can add 
'media_interaction off' to the light source.

In the attached multi-image, image, the left column is the frame 1 set 
up, and the right column frame 2's. In all results the prism is using 
'hollow off' and a 'photons 'target collect off reflection on refraction 
on } block is used for the media-box.

The top row shows only the scattering media result (no photons).

In the middle row both the scattering and photons contributions.

In the bottom row the scattering calculation is dropped by using 'media 
interaction off' in the light_source{} block.

Yes! There should be some refraction/refection contributions looking 
into the top of the prism coming from the media photons outside the 
prism. We can get those back by using 'hollow on' - as you originally 
did - for the prism while still using 'media_interaction off' with the 
light source. See the larger of the attached images.

Bill P.


Post a reply to this message


Attachments:
Download 'rickyfractionpuzzle.png' (14 KB) Download 'rickyfractionpuzzle_story.png' (46 KB)

Preview of image 'rickyfractionpuzzle.png'
rickyfractionpuzzle.png

Preview of image 'rickyfractionpuzzle_story.png'
rickyfractionpuzzle_story.png


 

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