POV-Ray : Newsgroups : povray.newusers : Fresnel Lens example Server Time
23 Nov 2024 17:57:45 EST (-0500)
  Fresnel Lens example (Message 1 to 7 of 7)  
From: ptsneves
Subject: Fresnel Lens example
Date: 30 Mar 2012 16:00:01
Message: <web.4f760ff9e35bc513a12770b50@news.povray.org>
Hi
I found on Google a scene exemplifying the use of one fresnel lens. I have tried
to change the scene to put another fresnel lens in front of the converged light
coming from the fresnel lens. The problem is that light does not pass across
this second fresnel lens and just "stops" there with no effect. I would be
grateful if somebody pointed me out why is this simple addition not working or
at least point to the concept which i am misunderstanding.

Below is the scene file.
Thanks
Paulo Neves


The newsgroup link is here:
http://news.povray.org/povray.binaries.images/message/%3Cweb.439fd98c9020f8e92b1529d00%40news.povray.org%3E/#%3Cweb.439
fd98c9020f8e92b1529d00%40news.povray.org%3E


//-------------------------------------------------------------

// Persistence Of Vision raytracer version 3.5 sample file.
// File: optics.pov
// Author: Christopher J. Huff
//
// Modified by PM 2Ring. Show convergence of a Fresnel lens.
//
// -w320 -h240
// -w800 -h600 +a0.3

#version 3.5;

global_settings {
    assumed_gamma 1
    //max_trace_level 10
    #if(1)
    photons {
        count 175000
        media 100,2
    }
    #end
}

#declare CamPos = 18*y;
//#declare CamPos = <3, 5, 0> * 2.5;
camera {
    location CamPos
    look_at 0
    angle 35
}

//Fill light
#if(1)
light_source {CamPos, rgb .25
    photons {refraction off reflection off}
    media_interaction off
}
#end

#if(1)
light_source {<-150, 0.5, 0> rgb < 1.2, 1, 1.5>
    spotlight radius 0.3 falloff 0.35 point_at < 0, 0.5, 0>
    photons {refraction on reflection on}
}
#end

//---textures----------------------------------------------------------

#default {finish {ambient 0}}

#declare GlassTex1 =
texture {
    pigment { rgb 1 filter 0.99}
    finish {ambient 0 diffuse 0 reflection 0.01}
}

#declare GlassTex2 =
texture {
    pigment { rgb 1 filter 0.99}
    finish{
        ambient 0 diffuse 0.1
        specular 0.5 roughness 1e-3
        reflection {0,1 fresnel}
        conserve_energy
    }
}

#declare GlassIOR = 1.5;
#declare GlassInt1 = interior {ior GlassIOR}

#macro PhotonTarget(Reflect, Refract, IgnorePhotons)
    photons {
        target
        reflection Reflect
        refraction Refract
        #if(IgnorePhotons) collect off #end
    }
#end

//---objects----------------------------------------------------------

#macro Block(From, To)
    union {
        cylinder {From, To*(x+z), 0.1 scale < 1, 10*To.y, 1>
            texture {
                pigment {checker rgb .90, rgb .70
                    scale 0.1
                }
                finish {brilliance 0.5}
            }
        }
        cylinder {From, To*(x+z), 0.025
            translate y*To
            texture {
                pigment { rgb < 1, 0.7, 0.2>}
                finish {ambient 0.8}
            }
        }
    }
#end

//light baffle
union {
    difference {
        object {Block(<-4, 0,-3>, <-4, 1.5, 3>)}
        box {<-5, 0.25,-0.5>, < -3, 0.75, 0.5>}
    }
    cylinder {<-4, 0, 0>, <-4, 1.5, 0>, 0.1 translate z*0.15}
    cylinder {<-4, 0, 0>, <-4, 1.5, 0>, 0.1 translate -z*0.15}
    texture {pigment { rgb 1}}
}

//media box
box {<-7,-0.1,-3>, < 6, 1, 4> hollow
    texture {pigment { rgbf 1}}
    interior {
        media {
            scattering {1, rgb 1 extinction 0}
            method 3
            intervals 1 samples 4
        }
    }
    photons {
      target
      pass_through
    }
}

//checkered floor/background
box {<-100,-1.1,-100>, < 100, -1, 100>
    texture {
        pigment {checker rgb .90, rgb < 0.2, 0, 0.4>}
        finish {brilliance 0.25}
    }
}

//---lenses----------------------------------------------------------
#declare T = 0.475;
#declare R = 1.0;
#declare SphericLens1 =
intersection {
    sphere {<-R, 0, 0>, R translate x*T}
    sphere {< R, 0, 0>, R translate -x*T}
    texture {GlassTex1}
    interior {GlassInt1}
    PhotonTarget(no, yes, yes)
}

// ---Fresnel lens-------------------------------------
#declare Rings = 360;
#declare Height = 1;
#declare FocalLen = 3;             //Focal length
#declare IOR = GlassIOR;

#declare FLEN = Rings*FocalLen;    //scale up focal length
#declare F2 = FLEN * FLEN;

//Calculate prism slope.
#macro fres(X)
  #local R = sqrt(X*X + F2);
  (X / (IOR * R - FLEN))
#end

//Lens profile is a series of right prisms. Each prism has a base of 1 unit,
so height = slope.
// For right triangle ABC, C is the right angle, BC is horizontal with
length 1 unit,
// AC is the height, which is calculated to give correct refraction at the
midpoint of BC
#declare SFresnelLens =
lathe{
  linear_spline
  2*Rings+5,

  <0, -Height>           //Give the whole disc a flat base
  <0, 0>
  #declare I = 1;
  #while(I<=Rings)
    <I-.5, 0>            //Point 'C' of this triangle and point 'B' of the
previous
    <I-.5, fres(I)>      //Point 'A'
    #declare I = I + 1;
  #end
  <I-.5, 0>
  <I, 0>                 //Give the disc a rim
  <0, -Height>           //close off base

  rotate -90*z           //rotate so flat base faces towards the spotlight
  scale 1/Rings
}

#declare FresnelLens =
object{
  SFresnelLens
  //pigment{radial rotate 90*z}
  texture {GlassTex2}
  interior {GlassInt1}
  PhotonTarget(yes, yes, yes)
}

// ----The scene--------------------------------------------------------

object{FresnelLens translate <-2, 0.5, 0>}
object{FresnelLens translate <3, 0.5, 0>}

#if(0)
  #declare Spot=sphere{-y, .1 pigment{rgb 1}finish{ambient .3 diffuse .9}}
  object{Spot translate<-2, 0, 1>}
  object{Spot translate<-2, 0, -1>}
  object{Spot translate<FocalLen-2, 0, 1>}
  object{Spot translate<FocalLen-2, 0, -1>}
#end


Post a reply to this message

From: James Holsenback
Subject: Re: Fresnel Lens example
Date: 30 Mar 2012 17:45:39
Message: <4f762983@news.povray.org>
On 03/30/2012 03:56 PM, ptsneves wrote:
> Hi
> I found on Google a scene exemplifying the use of one fresnel lens. I have tried
> to change the scene to put another fresnel lens in front of the converged light
> coming from the fresnel lens. The problem is that light does not pass across
> this second fresnel lens and just "stops" there with no effect. I would be
> grateful if somebody pointed me out why is this simple addition not working or
> at least point to the concept which i am misunderstanding.
>
> Below is the scene file.
> Thanks
> Paulo Neves

There's a thread in povray.beta-test ... "Photons not working as 
expected?" I saw the header "optics.pov" at the top of your scene file, 
and wonder if this might be the problem? Early after the last release a 
bug was found, reported and fixed! What version are you using? v3.7 RC4 
and RC5 have the problem.


Post a reply to this message

From: ptsneves
Subject: Re: Fresnel Lens example
Date: 30 Mar 2012 18:40:01
Message: <web.4f76323e7270910ca12770b50@news.povray.org>
James Holsenback <nom### [at] nonecom> wrote:
> There's a thread in povray.beta-test ... "Photons not working as
> expected?" I saw the header "optics.pov" at the top of your scene file,
> and wonder if this might be the problem? Early after the last release a
> bug was found, reported and fixed! What version are you using? v3.7 RC4
> and RC5 have the problem.

I can confirm the problem is reproducible also in 3.6. Also the removal of the
header dint have any impact on the end result, which was the same. Have you
tried to reproduce this scene?

Thanks


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Fresnel Lens example
Date: 30 Mar 2012 21:04:48
Message: <4f765830@news.povray.org>
ptsneves wrote:

> I can confirm the problem is reproducible also in 3.6. Also the removal of the
> header dint have any impact on the end result, which was the same. Have you
> tried to reproduce this scene?

It seems to work in 3.6 with max_trace_level 10 (which
is already contained in your code but commented out).

Also in 3.7 RC 5 it works without the setting. This is probably
because I recall some change as to which cases actually count as
increase in trace level, but I didn't find it in the change log.


Post a reply to this message

From: Alain
Subject: Re: Fresnel Lens example
Date: 30 Mar 2012 22:22:30
Message: <4f766a66@news.povray.org>

> Hi
> I found on Google a scene exemplifying the use of one fresnel lens. I have tried
> to change the scene to put another fresnel lens in front of the converged light
> coming from the fresnel lens. The problem is that light does not pass across
> this second fresnel lens and just "stops" there with no effect. I would be
> grateful if somebody pointed me out why is this simple addition not working or
> at least point to the concept which i am misunderstanding.
>
> Below is the scene file.
> Thanks
> Paulo Neves
>
>
> The newsgroup link is here:
>
http://news.povray.org/povray.binaries.images/message/%3Cweb.439fd98c9020f8e92b1529d00%40news.povray.org%3E/#%3Cweb.439
> fd98c9020f8e92b1529d00%40news.povray.org%3E
>
>
> //-------------------------------------------------------------
>
> // Persistence Of Vision raytracer version 3.5 sample file.
> // File: optics.pov
> // Author: Christopher J. Huff
> //
> // Modified by PM 2Ring. Show convergence of a Fresnel lens.
> //
> // -w320 -h240
> // -w800 -h600 +a0.3
>
> #version 3.5;
>
> global_settings {
>      assumed_gamma 1
>      //max_trace_level 10

Did you try uncommenting this line?

My diagnostic follow:
Trace level 1 at the media box. (should not count if you use version 3.7)
Trace level 2 at the front face of the first lense.
Trace level 3 at the back face of the first lense.
Trace level 4 at the front face of the second lense.
Trace level 5 at the back face of the second lense: tracing STOP here 
before exiting that lense.

max_trace_level default to 5.
You need at least max_trace_level 6 for your case, some more if there is 
any other transparent or reflectife surfaces to concider.

Another solution would be to extend the media box to include the 
light_source.

Whatever the version, that requirement will not change. In version 3.7, 
the trace level is not increased ONLY if there is no reflection NOR 
refraction. This means NO ior in the interior, and no reflection term in 
the finish.
Not sure how it work if the object contains any media.



Alain


Post a reply to this message

From: ptsneves
Subject: Re: Fresnel Lens example
Date: 31 Mar 2012 08:15:01
Message: <web.4f76f43b7270910ca12770b50@news.povray.org>
Thank you all for the replies as it indeed seems that the problem was
"max_trace_level" Thank you also for the diagnostic and concepts, which i will
now investigate with more care.

The max_trace_level was in the code i found on the news group link and there
were things that i didn't know what were for, namely this parameter.

Thank you a lot
Paulo Neves


Post a reply to this message

From: Alain
Subject: Re: Fresnel Lens example
Date: 31 Mar 2012 16:47:32
Message: <4f776d64$1@news.povray.org>

> Thank you all for the replies as it indeed seems that the problem was
> "max_trace_level" Thank you also for the diagnostic and concepts, which i will
> now investigate with more care.
>
> The max_trace_level was in the code i found on the news group link and there
> were things that i didn't know what were for, namely this parameter.
>
> Thank you a lot
> Paulo Neves
>
>

When you use the Windows version, simply click on a parameter / keyword 
and press the F1 key. This will start the help on that word and give you 
it's purpose, how to use it and the syntaxe to use.



Alain


Post a reply to this message

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