POV-Ray : Newsgroups : povray.text.scene-files : Projector with media photons ... Server Time
1 Nov 2024 05:20:21 EDT (-0400)
  Projector with media photons ... (Message 1 to 1 of 1)  
From: Michael Andrews
Subject: Projector with media photons ...
Date: 29 May 2001 07:19:50
Message: <3B1386D1.37B7E242@reading.ac.uk>
// Persistence of Vision Ray Tracer Scene Description File
// File: projector.pov
// Vers: 3.1
// Desc: Slide projector
// Auth: Ingo Janssen
//       Modified by Mike Andrews to show media photons
//       25th May 2001
//

#version unofficial MegaPov 0.7;
#include "glass.inc"

#macro create_spectrum(nelems,bright)

#local elem=1;

color_map{

#while(elem<=nelems)

  /* h goes from 0 at red end to 1.0 at blue end */
  #local h = (elem-1)/(nelems-1);

  /* co-h goes from 1.0 at red end to 0.0 at blue end */
  #local coh = 1.0 - h; 
  
  #local Huered = 0.9 - (h/0.5);
  #local Hueblue = 1.0 - (coh/0.6);
  
  #if (Huered < 0.0) #local Huered = 0.0; #end
  #if (Hueblue < 0.0)  #local Hueblue = 0.0; #end

  #local Huered=1.0 - (1.0-Huered)*(1.0-Huered);  
  #local Hueblue=1.0 - (1.0-Hueblue)*(1.0-Hueblue);

  #local Huegreen = 1.0 - Huered - Hueblue;

/*
  #if (h>0.85)
    #local Huered = 4*(h-0.85);
  #end
*/
  
  #local ybulge =  -4.0*(h-0.1)*(h-0.6);
  #if (ybulge<0) #local ybulge=0; #end
  
  #local Huered = Huered+ybulge;// * 0.5; // added * 0.5
  #local Huegreen = Huegreen+ybulge;
  
  [bright, color rgb<Huered,Huegreen,Hueblue>]
  //#debug
concat("<",str(Huered,0,3),",",str(Huegreen,0,3),",",str(Hueblue,0,3),">\n")
  
  
  #local elem=elem+1;
#end // while
}
#end // macro

global_settings {
   assumed_gamma 1.0
   max_trace_level 10
  photons {
	  spacing 0.01
    gather 60, 100
    media 25, 1
    autostop 0
    jitter 1
	  media on
	}
}

background{rgb 0.25}

camera {
  location  < 5, 2,-15.0>*7
  look_at   <-5, 0, 0.0>
  angle 25
}

light_source{
   <14, 0, 0>
  color <1,1,1>*6
  area_light y*0.1, z*0.1, 7, 7
  circular
  fade_distance 5
  fade_power 2
  create_spectrum(8,6)
}

#declare S = 8;
#declare X = 2*(10/6)/S;
#declare Y = sqrt(sqr(X)-sqr(X-.1));
#declare Lens = intersection {  // f=5 units
   sphere{-(X-.1)*x,X}
   sphere{(X-.1)*x,X}
   texture{T_Glass1}
   interior{ior 1.5 dispersion 1.05}
   bounded_by { box {-<.1,Y,Y>,<.1,Y,Y>} }
   scale S
}   

#declare C = 4;
object {  //condensor
   Lens
   photons {
      target 1.0
      refraction on
      ignore_photons
   }
   translate <C,0,0>
}

#declare P = -6;
object {    // projection lens
   Lens
   photons {
      refraction on
      ignore_photons
   }
   translate <P,0,0>
}

#declare L = -<30,8,6>;
#declare H = <15,8,6>;
#declare R = 0.15;

box { L-R*x, <L.x+R,H.y,H.z>
   pigment {rgb 1}
}

union {
  // frame
  sphere { <L.x,L.y,L.z>, R }
  sphere { <L.x,L.y,H.z>, R }
  sphere { <L.x,H.y,H.z>, R }
  sphere { <L.x,H.y,L.z>, R }
  sphere { <H.x,H.y,L.z>, R }
  sphere { <H.x,H.y,H.z>, R }
  sphere { <H.x,L.y,H.z>, R }
  sphere { <H.x,L.y,L.z>, R }
  cylinder { <L.x,L.y,L.z>, <L.x,L.y,H.z>, R }
  cylinder { <L.x,L.y,L.z>, <L.x,H.y,L.z>, R }
  cylinder { <L.x,L.y,L.z>, <H.x,L.y,L.z>, R }
  cylinder { <L.x,L.y,H.z>, <L.x,H.y,H.z>, R }
  cylinder { <L.x,L.y,H.z>, <H.x,L.y,H.z>, R }
  cylinder { <L.x,H.y,L.z>, <L.x,H.y,H.z>, R }
  cylinder { <L.x,H.y,L.z>, <H.x,H.y,L.z>, R }
  cylinder { <H.x,L.y,L.z>, <H.x,L.y,H.z>, R }
  cylinder { <H.x,L.y,L.z>, <H.x,H.y,L.z>, R }
  cylinder { <L.x,H.y,H.z>, <H.x,H.y,H.z>, R }
  cylinder { <H.x,L.y,H.z>, <H.x,H.y,H.z>, R }
  cylinder { <H.x,H.y,L.z>, <H.x,H.y,H.z>, R }
  // lens mounts
  torus { Y*S, R rotate 90*z translate 4*x }
  torus { Y*S, R rotate 90*z translate -6*x }
  cylinder { <C,Y*S,0>, <C,H.y,0>, R }
  cylinder { <C,-Y*S,0>, <C,L.y,0>, R }
  cylinder { <C,H.y,L.z>, <C,H.y,H.z>, R }
  cylinder { <C,L.y,L.z>, <C,L.y,H.z>, R }
  cylinder { <P,Y*S,0>, <P,H.y,0>, R }
  cylinder { <P,-Y*S,0>, <P,L.y,0>, R }
  cylinder { <P,H.y,L.z>, <P,H.y,H.z>, R }
  cylinder { <P,L.y,L.z>, <P,L.y,H.z>, R }
  cylinder { <H.x,L.y,0>, <H.x,H.y,0>, R }
  // light mount
  difference {
    cylinder { <H.x-1,0,0>, <H.x,0,0>, R*5 }
    sphere { <H.x-1,0,0>, R }
  }
  torus { R*3, R*2 rotate 90*z translate (H.x-1)*x }
  
  pigment { rgb <1,.8,.6>*0.6 }
  normal { dents 0.5 scale 0.5}
  finish { 
    ambient 0 diffuse 0.4 
    specular 0.8 metallic 
    brilliance 10 roughness 0.01 
    reflection_min 0.2 
    reflection_max 0.8
    reflect_metallic 
    conserve_energy 
  } 
  photons { ignore_photons }
}

box {L, H 
   pigment { rgbt 1 }
   finish { ambient 0 diffuse 0 }
  interior{
    media{
    intervals 1
    scattering { 4, rgb 0.04*<.1,.5,1> extinction 2}
    samples 50, 50
    method 3
    aa_threshold .1
    aa_level 2
    jitter .4
    }
  }
  hollow
  photons { ignore_photons pass_through}
}


Post a reply to this message

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