POV-Ray : Newsgroups : povray.newusers : photons and refraction Server Time
25 Dec 2024 10:44:44 EST (-0500)
  photons and refraction (Message 1 to 10 of 10)  
From: Oliver
Subject: photons and refraction
Date: 17 Aug 2007 12:25:01
Message: <web.46c5caeeadcd499789891a3f0@news.povray.org>
Hi everyone,
I'm new to povray and have recently been playing around with media and
photons.  Below is a little test scene I put together to help me understand
how these things work, but I haven't been able to get it to work as I would
expect.

What is supposed to happen, is a narrow beam of light from a spotlight
enters some scattering media so it shows up, enters a glass block at an
angle, where it is refracted, and then exits at the other side, where it
shows up in the media again.

What actually happens is it shows up before it strikes the block, but then
does not show up again at the other side.  I have been looking at the
source code of other scenes that do something similar (particularly the
advanced/optics.pov scene that comes with povray) but I can't really tell
what I am doing wrong.

Here is what I have so far:
#include "colors.inc"

global_settings {
    assumed_gamma 1
    photons {
 count 10000
 jitter 0.2
 media 100, 2
    }
}

// Fog
box { <-2,-2,-2>, <2,2,2>
    hollow
    texture {
 pigment { colour rgbf 1 }
    }
    interior {
 media {
     scattering { 1, colour Gray50 extinction 1 }
     method 2
     intervals 10 samples 20
 }
    }
}

// Glass block
box {<-0.5,-0.5,-2>, <0.5,0.5,2>
    material {
 texture {
     pigment { colour rgbf 1 }
     finish { ambient 0 diffuse 0 reflection 0 }
 }
 interior {
     ior 1.5
 }
    }
    rotate -30*z
    photons {
 target
 refraction on
 reflection off
    }

}


// Spotlight
light_source { <152, 0, 0>, colour 20*White
    spotlight
    radius 0.01
    falloff 0.02
    point_at <0,0,0>
    photons {
 refraction on
 reflection off
    }
}

camera {
    location <0,0,-8>
    look_at <0,0,0>
    angle 50
}

// End


Post a reply to this message

From: Urs Holzer
Subject: Re: photons and refraction
Date: 17 Aug 2007 13:19:02
Message: <46c5d886@news.povray.org>
Hi

> Hi everyone,
> I'm new to povray and have recently been playing around with media an
d

understand
> how these things work, but I haven't been able to get it to work as I

would
> expect.
> 
> What is supposed to happen, is a narrow beam of light from a spotligh
t
> enters some scattering media so it shows up, enters a glass block at
an
> angle, where it is refracted, and then exits at the other side, where

it
> shows up in the media again.
> 
> What actually happens is it shows up before it strikes the block, but

then

he
> source code of other scenes that do something similar (particularly
the
> advanced/optics.pov scene that comes with povray) but I can't really
tell
> what I am doing wrong.
> 
> Here is what I have so far:
> [...]
> 
> // Glass block
> box {<-0.5,-0.5,-2>, <0.5,0.5,2>















> 
> }

I think you must make the glass block hollow.

> [...]


Post a reply to this message

From: Warp
Subject: Re: photons and refraction
Date: 17 Aug 2007 15:08:12
Message: <46c5f21b@news.povray.org>
Urs Holzer <urs### [at] andonyarcom> wrote:
> I think you must make the glass block hollow.

  Why would that make a difference?

  Yet another case of "hollow" being a catch-all generic solution to all
problems. (Although this is certainly not the weirdest situation where
it has been (wrongly) suggested as a possible solution, though.)
  People should *try* before suggesting.

-- 
                                                          - Warp


Post a reply to this message

From: Urs Holzer
Subject: Re: photons and refraction
Date: 17 Aug 2007 15:18:32
Message: <46c5f487@news.povray.org>
Warp wrote:
> Urs Holzer <urs### [at] andonyarcom> wrote:
>> I think you must make the glass block hollow.
> 
>   Why would that make a difference?
> 
>   Yet another case of "hollow" being a catch-all generic solution to
>   all
> problems. (Although this is certainly not the weirdest situation where
> it has been (wrongly) suggested as a possible solution, though.)
>   People should *try* before suggesting.
> 

You are right, sorry. One only needs to make it hollow if it contained
any media (and he does not want to see the photons inside the glass
block). The hollow keyword does not affect refraction and photons
passing through (if there is no media).


Post a reply to this message

From: Christian Froeschlin
Subject: Re: photons and refraction
Date: 17 Aug 2007 17:52:58
Message: <46c618ba@news.povray.org>
> What actually happens is it shows up before it strikes the block, but then
> does not show up again at the other side.  I have been looking at the
> source code of other scenes that do something similar (particularly the
> advanced/optics.pov scene that comes with povray) but I can't really tell
> what I am doing wrong.

Neither can I, but actually you are not getting any photons at all.
The beam of light you see before the block is not related to photons,
it's the normal interaction of the spotlight with scattering media.
Note that no photons are stored during the render, which probably
implies that the target is blocked. Adding photons {pass_through}
to the box containing the fog at least causes some photons to be
shot and stored, although I'm not sure if this yields the correct
effect and why it should be necessary.


Post a reply to this message

From: Alain
Subject: Re: photons and refraction
Date: 18 Aug 2007 08:32:23
Message: <46c6e6d7$1@news.povray.org>
Oliver nous apporta ses lumieres en ce 2007/08/17 12:21:
> Hi everyone,
> I'm new to povray and have recently been playing around with media and
> photons.  Below is a little test scene I put together to help me understand
> how these things work, but I haven't been able to get it to work as I would
> expect.
> 
> What is supposed to happen, is a narrow beam of light from a spotlight
> enters some scattering media so it shows up, enters a glass block at an
> angle, where it is refracted, and then exits at the other side, where it
> shows up in the media again.
> 
> What actually happens is it shows up before it strikes the block, but then
> does not show up again at the other side.  I have been looking at the
> source code of other scenes that do something similar (particularly the
> advanced/optics.pov scene that comes with povray) but I can't really tell
> what I am doing wrong.
> 
> Here is what I have so far:
> #include "colors.inc"
> 
> global_settings {
>     assumed_gamma 1
>     photons {
>  count 10000
>  jitter 0.2
>  media 100, 2
>     }
> }
> 
> // Fog
> box { <-2,-2,-2>, <2,2,2>
>     hollow
>     texture {
>  pigment { colour rgbf 1 }
>     }
>     interior {
>  media {
>      scattering { 1, colour Gray50 extinction 1 }
>      method 2
>      intervals 10 samples 20
>  }
>     }
> }
> 
> // Glass block
> box {<-0.5,-0.5,-2>, <0.5,0.5,2>
>     material {
>  texture {
>      pigment { colour rgbf 1 }
>      finish { ambient 0 diffuse 0 reflection 0 }
>  }
>  interior {
>      ior 1.5
>  }
>     }
>     rotate -30*z
>     photons {
>  target
>  refraction on
>  reflection off
>     }
> 
> }
> 
> 
> // Spotlight
> light_source { <152, 0, 0>, colour 20*White
>     spotlight
>     radius 0.01
>     falloff 0.02
>     point_at <0,0,0>
>     photons {
>  refraction on
>  reflection off
>     }
> }
> 
> camera {
>     location <0,0,-8>
>     look_at <0,0,0>
>     angle 50
> }
> 
> // End
> 
> 
Found the problem!
You need to add: photons{pass_through} to the media container.
When shooting photons, if there is anything in the way, the photon is not sent. 
Even if that something is perfectly transparent. With pass_through, that object 
is ignored.
Look at it as a no_shadow for photons. In fact, any object with pass_through 
will automaticaly be made no_shadow.

-- 
Alain
-------------------------------------------------
Just remember - if the world didn't suck, we would all fall off.


Post a reply to this message

From: Oliver
Subject: Re: photons and refraction
Date: 18 Aug 2007 08:45:00
Message: <web.46c6e8c0c9143cf273365c0@news.povray.org>
The solution in the end was to increase the number of photons to 100000 (I
was using 10000 before).  Also, it was necessary (but not sufficient) to
either make the box with the fog in it a target or make the photons
pass_through (thanks, Christian), although making it a target didn't really
make that much difference and only slowed things down.

I have a few other questions about this.  It seems that the number of
photons had to be increased because the beam of light was quite narrow.  Is
this actually the case and if so, why?

For the scattering media, I used in the end 'intervals 3 samples 40' because
this seemed to produce acceptable results, but what is the best advice for
choosing samples and intervals?  I read somewhere that increasing intervals
was slower than increasing samples.

Thanks for everyone's help so far.

Regards,
Oliver


Post a reply to this message

From: Alain
Subject: Re: photons and refraction
Date: 18 Aug 2007 10:13:35
Message: <46c6fe8f@news.povray.org>
Oliver nous apporta ses lumieres en ce 2007/08/18 08:40:
> The solution in the end was to increase the number of photons to 100000 (I
> was using 10000 before).  Also, it was necessary (but not sufficient) to
> either make the box with the fog in it a target or make the photons
> pass_through (thanks, Christian), although making it a target didn't really
> make that much difference and only slowed things down.
> 
> I have a few other questions about this.  It seems that the number of
> photons had to be increased because the beam of light was quite narrow.  Is
> this actually the case and if so, why?
> 
> For the scattering media, I used in the end 'intervals 3 samples 40' because
> this seemed to produce acceptable results, but what is the best advice for
> choosing samples and intervals?  I read somewhere that increasing intervals
> was slower than increasing samples.

It depends on the sampling method used.
Using method 1 or 2, increasing intervals have a medium effect in the speed.
Using method 3, the default, increasing intervals have a huge impact on the 
render speed, while increasing samples have a medium to low impact. With method 
3, you need to keep intervals at 1 and increase samples as needed.
Also, with method 3, if you use 2 values for samples, the second will be ignored.

> 
> Thanks for everyone's help so far.
> 
> Regards,
> Oliver
> 
> 
> 
> 


-- 
Alain
-------------------------------------------------
I find that the harder I work, the more luck I seem to have.
Thomas Jefferson


Post a reply to this message

From: Christian Froeschlin
Subject: Re: photons and refraction
Date: 18 Aug 2007 12:44:12
Message: <46c721dc@news.povray.org>
> When shooting photons, if there is anything in the way, the photon is 
> not sent. Even if that something is perfectly transparent. With 
> pass_through, that object is ignored.

That seems to be the behavior, although I think the documentation
should be clearer on this point. The comparison to no_shadow is
misleading, as transparent objects (at least those with ior 1)
don't need that keyword to cast no shadow.


Post a reply to this message

From: Kenneth
Subject: Re: photons and refraction
Date: 2 Oct 2007 02:00:05
Message: <web.4701d953c9143cf5dc8ce470@news.povray.org>
"Oliver" <oli### [at] gmailcom> wrote:

> What is supposed to happen, is a narrow beam of light from a spotlight
> enters some scattering media so it shows up, enters a glass block at an
> angle, where it is refracted, and then exits at the other side, where it
> shows up in the media again.
>
> What actually happens is it shows up before it strikes the block, but then
> does not show up again at the other side.

I happened to be experimenting with a test scene almost identical to yours,
running into problems, then spotted your post. Glad to see that there
wasn't a problem after all.

BUT...it's interesting to note that ATMOSPHERIC media (i.e., not enclosed in
an object) DOES exhibit this problem: When photons are on, the
light source/media interaction is extinguished at the first glass
surface that the light hits...even with hollow on. There doesn't seem to
be any solution to the problem in this case (I've tried every
trick I can think of.)  Perhaps it's a bug. Of course, the
media/photons example given in the  POV docs involves only
object media--which is, in most cases, a more *efficient* way of
doing things anyway.

It would be useful if atmopheric media worked the same way, though.

Ken W.


Post a reply to this message

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