POV-Ray : Newsgroups : povray.text.scene-files : Visualising the POV3.5 'reflectivity' function : Visualising the POV3.5 'reflectivity' function Server Time
1 Jul 2024 03:21:53 EDT (-0400)
  Visualising the POV3.5 'reflectivity' function  
From: Don Barron
Date: 28 Aug 2002 07:25:03
Message: <web.3d6cb2aa2d5cd68d9c0bac10@news.povray.org>
The Version3.5 feature of  reflectance varying with angle is extremely
useful for the work I do in modelling the internals of complex optical
systems.  But the documentation is somewhat sketchy.  For my particular
application I wish to model surfaces which are 'anti-reflection' coated for
rays nearly normal to the surface but the reflectivity increases rapidly
away from some limits.  Typically the reflectivity may be 0.25% for normal
incidence but rises to 1% at 20deg and  50%at 70deg.  So it's a challenge
to find the variables of Reflmin,Reflmax and falloff  which give the best
fit.

Herewith two simple pov scripts.  The first sets up a camera looking into a
'mirror' to see a reflection of a glowing plane behind the camera.  The
scene is animated with the falloff value.  The second script is a viewer
for the images converted to heightfields so one can get an idea of the
values of reflectivity as a function of angle.

Script 1:

/*   Shows the variation of the POV35 'reflection { Min,Max falloff}'
function

We view in a mirror a white glowing screen behind the camera. The reflection
properties of the mirror
are set by the numerical values in

                reflection { Reflmin,Reflmax,Forlofmin,Forlofmax }

In this case we animate the 'falloff' between upper and lower values to
indicate the way it behaves.

We can then make an animated 'graph' by viewing the intensity in the image
in the Vurefl.pov and making an avi
and then an mpeg.

*/

global_settings{hf_gray_16 max_trace_level 2 }
plane { z,-1e3  texture { pigment {  rgb 1 } finish { ambient 1 diffuse 0 }
} }    // a glowing plane behind the window

#declare k = clock;
#declare Reflmin   =0.0025;  #declare Reflmax   = 1.0;
#declare Forlofmin =1.0;     #declare Forlofmax = 80;
box { <-1e4,-1e4,0>,< 1e4,1e4,10>
      pigment { rgbt 1 }
      finish { ambient 0 diffuse 0 reflection { Reflmin,Reflmax falloff
Forlofmin + k*( Forlofmax-Forlofmin)} }
    }

camera { location -z*1e2 look_at 0  angle 178  }


Script 2



 /*  Reads in a sequence of images 'Title1.tga'  and makes height-fields for
animation.  */

#declare Drawgraph = 0;           // 0/1 for solid/line
#declare Title1    = "refl"
#declare Nframes   = 99.0;
#declare k2        = clock;
#declare Num       = floor((Nframes-1.0)*k2+1.0);
#declare View      = 1;

#switch ( Nframes )
 #range(2,9)
     #declare N2  = str(Num,0,0)
     #declare N3  = concat ( Title1,N2,".tga")
 #break
 #range (10,99)
   #switch( Num )
     #range( 1,9)
         #declare N2  = str(int(Num),0,0)
         #declare N3  = concat ( Title1,"0",N2,".tga")
     #break
     #range(10,100)
         #declare N2  = str(int(Num),0,0)
         #declare N3  = concat ( Title1,N2,".tga")
     #break
   #end
 #break
#end

intersection { box {<-0.5,0,-0.5>,<0.5,10,0.5> }
               height_field { tga  #switch ( Nframes)
                              #case (1)  Title1    #break
                                #else      N3      #break
                              #end
                              translate <-0.5,-0.0001,-0.5> rotate y*90
scale 1
                              pigment { rgb <1,1,0.5> } finish { ambient 0.1
diffuse 0.7 }
                            }
               #if(Drawgraph = 1) height_field { tga  #switch ( Nframes)
                                                 #case (1)  Title1    #break
                                                   #else      N3      #break
                                                 #end
                                                 translate <-0.5,-0.01,-0.5>
rotate y*90 scale 1
                                                 pigment { rgb <1,1,0.5> }
finish { ambient 0.1 diffuse 0.7 }
                                                 inverse
                                               }
               #end
               plane { z,0.0001     pigment { rgb 0} }
               plane { z,0 inverse  pigment { rgb 0} }
               pigment { rgb <1,0,0> } finish { ambient 1 diffuse 0 }
               #declare  Vsc = 1; scale <1,Vsc,1>
             }


box { <-0.01,0,0>,<0.01,1,0.01> pigment { gradient y color_map{ [0.00 rgb 1]
                                                                [0.95 rgb 1]
                                                                [0.95 rgb 0]
                                                                [1.00 rgb 0]
                                                              }
                                           scale 0.1
                                        }
                                finish { ambient 1 }
    }

background { rgb <1,1,0>}
camera { up y right x location <0,0.5,-10> look_at y*0.5 angle 7 }


Post a reply to this message

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