|
![](/i/fill.gif) |
Dear Josh,
I've been fascinated by your idea of having two IOR values in the lens.
I've also been trying to catch your implemetation of this scene files in the
binaries.images. Well, I could not find it so far. I'll appreciate it if you
could possibly where I could find the image.
One more favor to ask of you:
I seem to have minor errors when I run your scene file IOR.POV.
Is there any clues to this?
Thank you again,
Jong
"Josh English" <eng### [at] spiritone com> wrote in message
news:3C4D967A.1A0CB16D@spiritone.com...
> This file shows the path of light as it passes through mediums with
> different index of refractions. There are three lenses that I've written
> into the file, and the variables mu1 and mu2 are the index of
> refractions for the "open area" and the lens.
>
> Josh English
> eng### [at] spiritone com
> http://www.spiritone.com/~english
----------------------------------------------------------------------------
----
> // Persistence of Vision Ray Tracer Scene Description File
> // File: ?.pov
> // Vers: 3.5
> // Desc: Basic Scene Example
> // Date: mm/dd/yy
> // Auth: ?
> //
>
> #version 3.5;
>
> #include "colors.inc"
> #include "math.mcr"
>
> global_settings {
> assumed_gamma 1.0
> }
>
> // ----------------------------------------
>
> camera {
> location <-0.0, 7.5, -0.001>
> direction 1*z
> right x*image_width/image_height
> look_at <0.0, 0.0, 0.0>
>
> }
>
> sky_sphere {
> pigment {
> gradient y
> color_map {
> [0.0 rgb <0.6,0.7,1.0>]
> [0.7 rgb <0.0,0.1,0.8>]
> }
> }
> }
>
> light_source {
> <0, 0, 0> // light's position (translated below)
> color rgb <1, 1, 1> // light's color
> translate <-30, 30, -30>
> }
>
> // ----------------------------------------
>
> #macro Snell(Vi,N,m1,m2)
> #local ang = VAng(Vi,N);
> #if ((ang = 0 ) | (ang = 180))
> #local t3 = vnormalize(Vi);
> #else
> #local uv = vnormalize(vcross(Vi,N));
> #debug vstr(3,uv," : ",0,1)
> #local sinr = (m1/m2)*sin(ang);
> #debug concat ("Angle of incoming ray is " , str(degrees(ang),4,4))
> #debug concat ("Sine of Refracted ray is " , str(sinr,4,4))
> #if (abs(sinr) > 1)
> #debug "Critical Angle?"
> #local t3 = <0,0,0>;
> #else
> #local ang2 = degrees(asin(sinr));
> #debug concat ("Angle of Refracted ray is " , str(ang2,4,4))
> #local t3 = vaxis_rotate(vnormalize(-N),uv,ang2);
> //sphere { t3 0.06 pigment { blue 1 } }
> #end
> #end
> t3
> #end
>
> plane {
> y, -1
> pigment { color rgb <0.7,0.5,0.3> }
> }
>
> // Three different Lens shapes for testing
> #declare Lens0 =
> box { <-1,-1,-4> <1,1,4>
> pigment { rgbt <0.5,0.5,1,0.6> }
> rotate 15*y
> translate 1*x }
>
> #declare Lens2 =
> difference {
> cylinder { <7,-1,0> <7,1,0> 9 }
> cylinder { <-7,-1.1,0> <-7,1.1,0> 8 }
> pigment { rgbt <0.5,0.5,1,0.6> }
> rotate 15*y}
>
>
> #declare Lens1 =
> difference {
> sphere { <3,0,0> 4 }
> sphere { <2,0,0> 2.5 }
> box { <1,-5,-5> <8,5,5> }
> box { <-2,0.5,-5> <3,5.1,5> }
> pigment { rgbt <0.5,0.5,1,0.7> } }
>
> #declare Lens = object { Lens0 translate <0,0,0.1> }
>
> object { Lens }
>
> #declare CrownGlass = <1.52,1.526,1.531>;
>
> #declare mu1 = 1; // IOR value for "open area"
> #declare mu2 = 1.9; // IOR value for lens
>
> #declare zp = -2;
> #while (zp < 2 )
> #declare light_start = <-10,0,zp>;
> #declare light_direction = <1,0,0>;
>
> #declare norm = <0,0,0>;
> #declare p1 = trace(Lens,light_start,light_direction,norm);
> #declare miss = VNull(norm);
> #if (miss)
> #debug "Missed"
> cylinder { light_start, (light_start + light_direction*10) 0.05
> pigment { red 1 } }
> #else
> cylinder { light_start, p1 0.05 pigment { rgb 1 } }
> #declare Refr = Snell(-light_direction,norm,mu1,mu2);
> #if (VNull(Refr))
> #debug "Problem"
> #else
> #declare norm = <0,0,0>;
> #declare p2 = trace(Lens,p1,Refr,norm);
> #declare exit = VNull(norm);
> #if (exit)
> #debug "Trapped"
> cylinder { p1, p1 + Refr * 2 0.05 pigment { red 1 } }
> #else
> #declare Refr2 = Snell(-Refr,-norm,mu2,mu1);
> #if (VNull(Refr2))
>
> #else
> cylinder { p1, p2 0.05 pigment { rgb <0,1,0> } }
> cylinder { p2, p2 + Refr2 * 6, 0.05 pigment { rgb 1 } }
> #end
> #end
> #end
> #end
> #declare zp = zp+0.5;
> #end
>
Post a reply to this message
|
![](/i/fill.gif) |