POV-Ray : Newsgroups : povray.binaries.images : Fresnel Lens Server Time
18 Nov 2024 02:17:45 EST (-0500)
  Fresnel Lens (Message 1 to 2 of 2)  
From: PM 2Ring
Subject: Fresnel Lens
Date: 14 Dec 2005 03:30:00
Message: <web.439fd67bf391b6662b1529d00@news.povray.org>
Inspired by Simon Dyer's lenticular scene, I created a Fresnel lens. The
formula I'm using ignores the lens thickness, but it still gets reasonable
convergence, IMHO.

The attached image needs better parameters for the media, but it takes long
enough to render as it is on this 566MHz machine.


Post a reply to this message


Attachments:
Download 'fresnele0s.jpg' (130 KB)

Preview of image 'fresnele0s.jpg'
fresnele0s.jpg


 

From: PM 2Ring
Subject: Re: Fresnel Lens
Date: 14 Dec 2005 03:40:00
Message: <web.439fd98c9020f8e92b1529d00@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> Inspired by Simon Dyer's lenticular scene, I created a Fresnel lens. The
> formula I'm using ignores the lens thickness, but it still gets reasonable
> convergence, IMHO.

I should have mentioned that that lens is twice its focal length above the
floor.

The following scene was basically derived from scenes/advanced/optics.pov
demo.
This Fresnel lens has a focal length of 3 units.

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

// 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{SphericLens1 translate <2, 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


Attachments:
Download 'opticsc1s.jpg' (62 KB)

Preview of image 'opticsc1s.jpg'
opticsc1s.jpg


 

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