POV-Ray - Prism

last edited: 8/5/11

Veeeery long render this one, over five hours! Very simple scene with a prism, which a light source travels through. By default, light refraction in POV-Ray follows a simple model where light is only composed of one color, so the trajectory of all photons that are thrown to the object are only calculated one time. When interior { dispersion } is activated and its value exceeds 1, the light will be decomposed into several wavelength, for each color, each wavelength having its own refraction index. Thus, the trajectory of every beam of light will have to be calculated many more times, ending with light separation and pretty rainbows. Also, radiosity is on, which means light can bounce off walls and objects, and light up the whole box realistically.

Source code (file available here)

global_settings{ 

  max_trace_level 30
  assumed_gamma 1.0
  photons {
      spacing 0.02
    }
}       

// radiosity (global illumination) settings
#declare rad_on = 0;
#if (rad_on = 1)
#default{ finish{ ambient 0 diffuse 1 }} 

global_settings {
  radiosity {
    pretrace_start 0.08           // start pretrace at this size
    pretrace_end   0.04           // end pretrace at this size
    count 200                      // higher -> higher quality (1..1600) [35]

    nearest_count 5               // higher -> higher quality (1..10) [5]
    error_bound 1.8               // higher -> smoother, less accurate [1.8]
    recursion_limit 3             // how much interreflections are calculated (1..5+) [3]

    low_error_factor .5           // 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]
    brightness 1                  // brightness of radiosity effects (0..1) [1]

    adc_bailout 0.01/2
  }
}
#end
         
#declare enable_dof = 0;         
         
#declare Camera_0 = // front view
camera
{
    perspective angle 90
    location  <3.0 , 1.5 ,-3.0>
    right     x*image_width/image_height
    look_at   <1.3 , 1.0 , 4.0>
    #if (enable_dof = 1)
        focal_point <2.4, 1, .2> blur_samples 20 aperture 0.14 
    #end
}                             
camera { Camera_0 }

light_source
{
    <1.25,0.25,-1.0>
    color rgb 0.4 
    spotlight
    point_at <4, 0.5, 4>  
    //looks_like { sphere { 0*x, 0.1 pigment { rgb <1,1,0> } } } 
    photons {           // photon block for a light source
        refraction on
        reflection on
    } 
    
}           

merge
{
    union
    {                 
        plane { y, 0 }
        plane { y, 2 }
        plane { x, 0 }
        plane { x, 4 }
        plane { z, 4 } 
        
    }                                 
    //box { <-0.001,-0.001,-0.001>, <4.001,2.001,4.001> inverse }    
    pigment { rgb 1 }
    finish
    {
        specular 0.1
        //reflection { 0.01 }
    }
}       
union
{
    prism
    {
        0,1.5,4
        <-1,0>
        <1, 0>
        <0, 2>
        <-1,0> 
        translate <2.2,0.01,0.2>
        scale 0.5
        scale 1.6*x
        scale 1.6*z
        rotate y*3
    }
         /*
    intersection
    {                            
        sphere { <3,0.5,3>, 0.3 }
        sphere { <3.1,0.5,3.1>, 0.3 }
    }  */  
        
    pigment { rgbf <1,1,1,1> }
    //pigment { rgb <1,0,0> }
    finish
    {
        diffuse .6
        ambient 0.1
        specular 0.1   
        phong 0.4
        reflection { 0.3 }
        
    }
    interior
    {   
        ior 1.6 
        fade_power 1001
        fade_distance 0.9
        fade_color 0.7 
        dispersion 1.2
    }   
    photons
    {  //photon block for an object
        target 1.0
        refraction on
        reflection on
    }
}

 

Comments (0)

No comments yet!

Post a comment

 
image
art, music, projects © 2006-11 Tenchi