/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : DJ_FieldCam_test.pov Version : 3.8 Description : Testing the use of the FieldCam macro by Doctor John (2005). Date : September 2020 Author : Thomas A. M. de Groot E-mail : Copyright (C) 2020. All rights reserved. Use and/or modification of this scene is free, except for commercial purposes. Commercial distribution is not allowed without written permission from the author. **********************************************************************************/ // Render settings (right-click on a line below): // +w640 +h640 +a0.3 +am2 +bm2 +bs8 +wt6 //-------------------------------------------------------------------------- #version 3.8; global_settings { assumed_gamma 1.0 radiosity { pretrace_start 0.08 // start pretrace at this size pretrace_end 0.01 // end pretrace at this size count 50, 1000 // higher -> higher quality (1..1600) [35] nearest_count 10, 5 // higher -> higher quality (1..10) [5] error_bound 1 // higher -> smoother, less accurate [1.8] recursion_limit 2 // how much interreflections are calculated (1..5+) [2] low_error_factor .3 // reduce error_bound during last pretrace step gray_threshold 0.0 // increase for weakening colors (0..1) [0] minimum_reuse 0.015 // reuse of old radiosity samples [0.015] maximum_reuse 0.1 // new parameter 3.7 [0.2] brightness 1 // brightness of radiosity effects (0..1) [1] adc_bailout 0.01/2 normal off // take surface normals into account [off] media off // take media into account [off] always_sample off // turn sampling in final trace off [on] //max_sample 1.0 // maximum brightness of samples } } //-------------------------------------------------------------------------- #macro FieldCam (CP, CL) #debug "Using Doctor John's Field Camera.\n" #local CD = CL-CP; #debug concat("\nFieldCam: CD = <",vstr(3, CD, ", ", 3, 3),">\n") #if (CD.x != 0 | CD.z != 0) #local HypoXZ = sqrt(pow(CD.x, 2)+pow(CD.z, 2)); #local VCorr = pow(vlength(CD), 2)/pow(HypoXZ, 2); #debug concat("FieldCam: HypoXZ = ",str(HypoXZ, 4,3),"\n") #debug concat("FieldCam: VCorr = ",str(VCorr, 4,3),"\n") #local CosThetaX = CD.x/HypoXZ; #local CosThetaZ = CD.z/HypoXZ; #debug concat("FieldCam: CosThetaX = ",str(CosThetaX, 4,3),"\n") #debug concat("FieldCam: CosThetaZ = ",str(CosThetaZ, 4,3),"\n") #if (CD.x = 0) #local ShearX = 0; #else #local ShearX = (CD.y/CD.x)*pow(CosThetaX, 2); #end #if (CD.z = 0) #local ShearZ = 0; #else #local ShearZ = (CD.y/CD.z)*pow(CosThetaZ, 2); #end #debug concat("FieldCam: ShearX = ",str(ShearX, 4,3),"\n") #debug concat("FieldCam: ShearZ = ",str(ShearZ, 4,3),"\n\n") #declare NoFall = transform { matrix < 1, 0, 0, ShearX, VCorr, ShearZ, 0, 0, 1, 0, 0, 0> } #else #warning "Viewing vector is perpendicular to XZ-plane.\n" #warning "Camera changed to default type.\n" #declare NoFall = transform { matrix <1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0> } #end #end //-------------------------------------------------------------------------- // camera ------------------------------------------------------------------ #declare FC = on; //use of Dr John's FieldCam macro #declare H = 20; //height of ground plane #declare AspectRatio = image_width/image_height; #declare CamZoom = 1.4; #declare CamSky = <0, 1, 0>; #declare CamAng = 50; #declare Test = 2; #switch (Test) #case (1) #declare CamLoc = <0.0, H+1, -40.0>; #declare CamLookAt = <0.0, H+10, 1000.0>; #break #case (2) #declare CamLoc = <2000.0, H+1, -2400.0>; #declare CamLookAt = <2000-100, H+50, -2400+100>; #end #declare Camera = #if (FC) camera { FieldCam (CamLoc, CamLookAt) perspective location CamLoc sky CamSky up CamSky direction z*CamZoom right x*AspectRatio angle CamAng transform {NoFall} look_at CamLookAt } #else camera { perspective location CamLoc sky CamSky up CamSky direction z*CamZoom right x*AspectRatio angle CamAng look_at CamLookAt } #end camera {Camera} // sun --------------------------------------------------------------------- light_source {<-15000,25000,-25000> color 1} // sky --------------------------------------------------------------------- sky_sphere { pigment { gradient <0, 1, 0> color_map { [0.00 rgb <1.0,1.0,1.0>] [0.30 rgb <0.0,0.1,1.0>] [0.70 rgb <0.0,0.1,1.0>] [1.00 rgb <1.0,1.0,1.0>] } scale 2 } } // ground ------------------------------------------------------------------ plane { y, H texture { pigment {srgb <0.825, 0.57, 0.35>} normal {bumps 0.75 scale 0.025 } finish {diffuse 0.8} } } //-------------------------------------------------------------------------- //---------------------------- objects in scene ---------------------------- //-------------------------------------------------------------------------- #local Pillar = union { box {<-1, H, -1>, <1, H+20, 1>} box {<-2, H, -2>, <2, CamLoc.y, 2>} pigment { granite colour_map { [0.0 srgb <0.2, 0.2, 0.8>] [1.0 srgb <0.8, 0.8, 0.2>] } scale 3 } finish { diffuse 0.8 } } #switch (Test) #case (1) object {Pillar rotate 30*y } object {Pillar rotate 50*y translate <-8, 0, 10> } object {Pillar rotate -20*y translate <10, 0, 15> } #break #case (2) union { object {Pillar rotate 30*y } object {Pillar rotate 50*y translate <-8, 0, 10> } object {Pillar rotate -20*y translate <10, 0, 15> } translate } #end