POV-Ray : Newsgroups : povray.general : media question : Re: media question Server Time
31 Jul 2024 16:25:08 EDT (-0400)
  Re: media question  
From: MichaelC
Date: 18 Dec 2006 16:55:01
Message: <web.45870d99bbf3e05a4599c17c0@news.povray.org>
Thanks for the reply Dennis ... Here is my code below ... and after looking
at your cool media/photon/radiosity project .... I have to say ... don't
laugh.

The media object and the media "switch" are at the end of the code

Thanks,
Michael



// ==== Standard POV-Ray Includes ====
#include "colors.inc"   // Standard Color definitions
#include "textures.inc"   // Standard Texture definitions
#include "functions.inc"  // internal functions usable in user defined
functions

global_settings { max_trace_level 100   ambient_light color White }
#declare Glass_Interior = interior { fade_distance 6 fade_power 2 }

// Draw Outside Object Switches
#declare dgrass    = 0;   #declare dsky   = 1;    #declare outsidelight = 1;

// Draw Wall Object Switches
#declare dceiling  = 1;   #declare dNwall = 1;    #declare dEwall = 1;
#declare dfloor    = 1;   #declare dSwall = 1;    #declare dWwall = 1;

#declare detail    = 0;

// Set Room Units
#declare inches = 1;      #declare foot = 12*inches;

#declare Rlen = 30*foot;  #declare Chei = 20*foot;    #declare Wthi =
10*inches;
#declare Rwid = 20*foot;  #declare Fhei = 1*inches;

// Define Cameras
#declare Cam1 = camera { perspective
                         location <0.000, 5.000, -10.000>
                         angle 70.000   // FovX < Zoom >
                         look_at < 0.000, 0.000, 0.000 >
                       }

#declare NorthCam    = camera { location <   0, (Chei-Fhei)/2,Rwid-(20*foot)
>  look_at < 30, (Chei-Fhei)/4, Rwid > angle 70 }
#declare SouthCam    = camera { location <   0, 30, 100 > look_at < 0, 30, 0
> }
#declare EastCam     = camera { location <-100, 30,   0 > look_at < 0, 30, 0
> }
#declare WestCam     = camera { location < 100, 30,   0 > look_at < 0, 30, 0
> }
//#declare TopCam      = camera { location <   0, Chei-1,  0 > look_at < 0,
0, 0 > angle Rwid }
#declare TopCam      = camera { location <   -Rlen+5, Chei/2,  0 > look_at <
0,  0, 0 > } //angle 120 }

camera { NorthCam } // Edit this line to change cameras

// END Standard declares ******************************
// START Outside **************************************

background { Blue-.5 }
#if ( dgrass ) plane { y, -1 pigment { Green } }  #end

#if ( dsky )
        #declare EarthRadius  = 6379439.6; // in meters (thus, 1 pov unit
=~= 1 m)
        #declare CloudHeight1 = 1500.0;    // in meters, still
        #declare CloudPigment = pigment { bozo
                                          turbulence 0.65
                                          octaves 6
                                          omega 0.7
                                          lambda 2
                                          color_map { [0.0 0.1 color rgb
<0.85, 0.85, 0.85> color rgb <0.75, 0.75, 0.75>]
                                                      [0.1 0.5 color rgb
<0.75, 0.75, 0.75> color rgbt <1,1,1,1>]
                                                      [0.5 1.0 color rgbt
<1,1,1,1> color rgbt <1,1,1,1>]
                                                    }
                                        }
        // Low clouds
        sphere { < 0, -EarthRadius, 0 > EarthRadius+CloudHeight1
                 pigment { CloudPigment scale 1000 }
                 finish { ambient 1 }
                 hollow
               }
        // High clouds
        sphere { < 0, -EarthRadius, 0 > EarthRadius+2*CloudHeight1
                 pigment { CloudPigment scale < 10000, 10000 ,20000 > rotate
< 310, 69, 10 > }
                 finish { ambient 1 }
                 hollow
               }
        // Fog
        fog { color Grey
              fog_type 2
              fog_alt  100
              distance 1000
            }
#end

// END Ouside *****************************************
// START Room Textures ********************************

#declare WallPigment    = pigment { brick
                                    color Grey/5,          // color of
mortar
                                    color White            // color of brick
                                    //brick_size <2*foot,1*foot,1>   // size
of brick    (optional)
                                    //mortar     1           // width of
mortar  (optional)
                                    scale 4
                                  }
#declare CeilingPigment = pigment { Yellow + Red + Tan*2 + White*2 }

#declare FloorTexture   = texture { #if ( detail )
                                          pigment { bozo
                                                    frequency .5
                                                    color_map {
                                                                [0.0 color
Gray/3 ]
                                                                [0.1 color
Gray/2 ]
                                                             //   [0.2 color
Gray ]
                                                             //   [0.6 color
Gray*2 ]
                                                                [1.0 color
White ]
                                                              }
                                                    scale 50
                                                  }
                                          normal  { bumps 8
                                                    bump_size .06
                                                    accuracy 0.2

                                                    turbulence 5
                                                  }
                                          finish  { ambient .3
                                                    diffuse 0.7
                                                    //brilliance 6
                                                    reflection 0.06
                                                    //phong 0.75
                                                    //phong_size 80
                                                    irid {
 // Iridescence (Newton's thin film interference)
                                                           0.15
 // intensity
                                                           thickness 0.25
 // film's thickness [0.0]
                                                           turbulence 0.1
 // film's thickness turbulence
                                                         }
                                                  }
                                    #else
                                          pigment { Gray }
                                    #end
                                  }

// END Room Textures **********************************
// START Drawing Room *********************************

#if (dceiling)
    box { <-Rlen-Wthi, Chei, -Rwid>, <Rlen, Chei+Wthi, Rwid>   pigment {
CeilingPigment }   }  //normal  { CeilingNormal  }     }
#end
#if (dfloor)
    box { <-Rlen, 0, -Rwid>, <Rlen, Fhei, Rwid>  texture { FloorTexture }
}
#end
#if (dSwall)
    box { < -Rlen -Wthi, Fhei, -Rwid >, < Rlen+Wthi, Chei, -Rwid-Wthi >
pigment { WallPigment }   }  //normal  { WallNormal }  }
#end
#if (dWwall)
    box { < -Rlen, Fhei, -Rwid - Wthi >, < -Rlen -Wthi, Chei, Rwid >
pigment { WallPigment }  }  //normal  { WallNormal }  }
#end
#if (dEwall)
    box { < Rlen, Fhei, Rwid >, < Rlen+Wthi, Chei, -Rwid-Wthi >    pigment {
WallPigment }   }  //normal  { WallNormal }    }
#end
#if (dNwall)
    difference { box { < -Rlen-Wthi,  Fhei, Rwid >, <Rlen+Wthi, Chei,
Rwid+Wthi >   pigment { WallPigment }  } //normal  { WallNormal }     }

                 // Cut Windows
                 box { <-1.5*foot,  2*foot, Rwid - Wthi - 1 >  < 1.5*foot,
15*foot, Rwid + Wthi + 1 >  }
             //    box { <-1.5*foot,  2*foot, Rwid - Wthi - 1 >  < 1.5*foot,
15*foot, Rwid + Wthi + 1 >    translate x*(12*foot)    }
             //    box { <-1.5*foot,  2*foot, Rwid - Wthi - 1 >  < 1.5*foot,
15*foot, Rwid + Wthi + 1 >    translate -x*(12*foot)   }
               }
#end

// END Drawing Room *************************************


//*****************************************************************************
// Define & Draw Stained Glass
//*****************************************************************************

#declare MainGlass = box { < -17.500, -80.000, -0.120 >, < 17.500, 80.000,
0.120 > }
#declare CircleGlass =  cylinder { -0.125*y,0.125*y,16.000  rotate
<90.000,0.000,0.000>   translate <0.000,10.000,0.000> }
#declare CrossGlass = merge { box { < -15.500, -3.000, -0.125 >, < 15.500,
3.000, 0.125 > translate <0.000,10.500,0.000> }
                              box { < -3.000, -25.000, -0.125 >, < 3.000,
25.000, 0.125 > }
                            }

#declare SG1 =  // Stained Glass Object
union { difference { box { < -18.000, -80.000, -0.250 >, < 18.000, 80.000,
0.250 > } // Frame
                     box { < -15.500, -77.500, -0.300 >, < 15.500, 77.500,
0.300 > }
                   }
         // Cross and Circle Frame
        union { torus { 16.000,0.300                 rotate
<90.000,0.000,0.000>  translate <0.000,10.000,0.000>  }
                cylinder { -25.000*y,25.000*y,0.300  translate
<-3.000,0.000,0.000>  }
                cylinder { -25.000*y,25.000*y,0.300  translate
<3.000,0.000,0.000>   }
                cylinder { -16.000*y,16.000*y,0.300  rotate
<0.000,0.000,90.000>  translate <0.000,7.500,0.000>    }
                cylinder { -16.000*y,16.000*y,0.300  rotate
<0.000,0.000,90.000>  translate <0.000,13.500,0.000>   }
                cylinder { -3.000*y,3.000*y,0.300    rotate
<0.000,0.000,90.000>  translate <0.000,25.000,0.000>   }
                cylinder { -3.000*y,3.000*y,0.300    rotate
<0.000,0.000,90.000>  translate <0.000,-25.000,0.000>  }
              }
        // Cut Cross Glass
        object { CrossGlass
                 texture { pigment { color Brown
                                     transmit .5
                                     filter .8
                                   }
                           finish  { ambient 0.5
                                     diffuse 0.5
                                     reflection 0.05
                                     specular 0.25 roughness 0.01
                                   }
                         }
               }
        // Cut Main Glass
        difference { object { MainGlass }
                     object { CircleGlass }
                     object { CrossGlass }
                     texture { pigment { color Violet
                                         transmit .3
                                         filter .8
                                       }
                               finish  { ambient 0.5
                                         diffuse 0.5
                                         reflection 0.05
                                         specular 0.25 roughness 0.01
                                       }
                             }
                   }
        // Cut Circle Glass
        difference { object { CircleGlass }
                     object { CrossGlass }
                     texture { pigment { color Yellow
                                         transmit .5
                                         filter .8
                                       }
                               finish  { ambient 0.5
                                         diffuse 0.5
                                         reflection 0.05
                                         specular 0.25 roughness 0.01
                                       }
                             }
                   }
      }  // End union SG1

object { SG1 translate <0,105,Rwid+Wthi/2> }

//*****************************************************************************
// Define Light Source and Media
//*****************************************************************************

#if (outsidelight)
    light_source { <-300000,390000,250000> White*0.5
                   area_light x*1.5,z*1.5,4,4 adaptive 1
                   circular
                   media_attenuation 1
                   media_interaction 1
                 }
#end

light_source { <0, Chei-20, -Rwid+Wthi   > .1     // small interior light
               media_attenuation 0
               media_interaction 0
             }


#declare dmedia    = 1;         // <<<<<<< MEDIA SWITCH

#if ( dmedia )                                    // haze media
      box { < -Rlen, Fhei, 0   >< Rlen, Chei, Rwid+Wthi/2   >
            pigment  { rgbt 1 }
            hollow
            interior { media { //absorption .4
                               scattering { 1, 0.07
                                            extinction 0.01
                                          }
                               samples 80,100      //30,100
                             }
                     }
          }
#end


Post a reply to this message

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