1// This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 2// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a 3// letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 4 5// Persistence of Vision Ray Tracer Scene Description File 6// File: grenadine.pov 7// Desc: Glass with liquid 8// Date: 1999/06/04 9// Auth: Ingo Janssen 10// Updated: 2013/02/15 for 3.7 11// 12// -w320 -h240 13// -w800 -h600 +a0.3 14 15#version 3.7; 16 17#include "glass.inc" 18 19 20global_settings { 21 assumed_gamma 1.0 22 max_trace_level 5 23 photons { 24 spacing 0.01 // higher value 'lower' quality, faster parsing. 25 autostop 0 26 jitter 0.5 27 max_trace_level 15 28 } 29} 30 31light_source { 32 <500, 550, -100> 33 rgb <1, 1, 1> 34 spotlight 35 radius 1 36 falloff 1.1 37 tightness 1 38 point_at <-19,-4,7> 39} 40 41camera { 42 location <-0.5, 2.5, -7.0> 43 right x*image_width/image_height // keep proportions with any aspect ratio 44 look_at <-0.5, 0.5, 0.0> 45} 46 47sky_sphere { 48 pigment { 49 gradient y 50 color_map { [0.0 rgb <0.2,0,1>] [1.0 color rgb 1] } 51 } 52} 53 54union { //plane & background 55 difference { 56 box {<-20,-1,0>,<20,13,13>} 57 cylinder{<-21,13,0>,<21,13,0>,13} 58 } 59 plane {y, 0} 60 translate <0,-1.9999,7> 61 pigment {rgb .5} 62 finish {diffuse .5 ambient 0} 63} 64 65//====== The Lemon ====== 66#declare SS=seed(7); 67#declare R_uit= 3; 68#declare R_in=2.9; 69 70#declare Ring = difference { 71 cylinder {< 0 , 0, 0>, <1 , 0, 0>, R_uit} 72 cylinder {<-0.1, 0, 0>, <1.1, 0, 0>, R_in} 73} 74 75#declare R2_uit= 0.8; 76#declare R2_in=0.7; 77 78#declare Ring2 = difference { 79 cylinder {< 0 , 0, 0>, < 1 , 0, 0>, R2_uit} 80 cylinder {<-0.1, 0, 0>, < 1.1, 0, 0>, R2_in} 81} 82 83#declare LemonOut= intersection { 84 merge { 85 difference { 86 merge { 87 object {Ring translate < 0.01, 0, (R_uit+R_in)/2>} 88 object {Ring translate <-1.01, 0,-(R_uit+R_in)/2>} 89 } 90 box {<-1.1, 0.1,-1>, <1.1, 2, 1>} 91 } 92 difference { 93 box {<-1, 0,-(R_uit-R_in)/2>, < 1, 1.1, (R_uit-R_in)/2>} 94 box { 95 <-2.5, 0,-1>, <2.5, 2, 1> 96 translate <0, 0.5, 0> 97 rotate <0, 0,-20> 98 } 99 } 100 difference{ 101 object { 102 Ring2 103 translate <-0.5, 0, 0> 104 scale <2.2, 1, 1> 105 translate < 0, 0, (R2_uit+R2_in)/2> 106 } 107 box {<-2.1, 0,-1>,<2.1,-3, 1>} 108 translate <0, 0.499999, 0> 109 rotate <0, 0,-20> 110 } 111 } 112 merge { 113 cylinder {<0, 0,-0.5>, <0, 0, 0.5>, 0.8} 114 torus {0.8, 0.2 scale <1, 1.1, 1> rotate <90, 0, 0>} 115 } 116} 117 118#declare BS1= array[24] { 119 < 24.8, 49.8>, < 13.0, 31.4>, < 4.0, 8.8>, < 0.1, 9.4> 120 < 0.1, 9.4>, <- 7.4, 10.7>, <-12.5, 30.4>, <-21.1, 49.8> 121 <-21.1, 49.8>, <-33.3, 76.9>, <-39.8, 87.0>, <-29.2, 91.4> 122 <-29.2, 91.4>, <-20.0, 95.3>, <-10.0, 95.9>, < 0.0, 95.9> 123 < 0.0, 95.9>, < 10.0, 95.9>, < 21.3, 95.8>, < 30.0, 90.7> 124 < 30.0, 90.7>, < 41.3, 84.0>, < 45.1, 86.5>, < 24.8, 49.8> 125} 126 127#declare BS2= array[24] { 128 < 24.8, 55.8>, < 13.0, 31.4>, < 4.0, 8.8>, < 0.1, 15.0> 129 < 0.1, 15.0>, <- 7.4, 10.7>, <-12.5, 30.4>, <-21.1, 49.8> 130 <-21.1, 49.8>, <-33.3, 76.9>, <-39.8, 87.0>, <-29.2, 91.4> 131 <-29.2, 91.4>, <-20.0, 95.3>, <-10.0, 95.9>, < 0.0, 95.9> 132 < 0.0, 95.9>, < 10.0, 95.9>, < 21.3, 95.8>, < 30.0, 90.7> 133 < 30.0, 90.7>, < 41.3, 84.0>, < 45.1, 86.5>, < 24.8, 55.8> 134} 135 136 137#declare BS3= array[24] { 138 < 23.0, 49.8>, < 13.0, 31.4>, < 4.0, 8.8>, < 0.1, 6.0> 139 < 0.1, 6.0>, <- 7.4, 10.7>, <-12.5, 30.4>, <-21.1, 49.8> 140 <-21.1, 49.8>, <-33.3, 76.9>, <-39.8, 87.0>, <-29.2, 91.4> 141 <-29.2, 91.4>, <-20.0, 95.3>, <-10.0, 95.9>, < 0.0, 95.9> 142 < 0.0, 95.9>, < 10.0, 95.9>, < 21.3, 95.8>, < 30.0, 90.7> 143 < 30.0, 90.7>, < 41.3, 84.0>, < 45.1, 85.0>, < 23.0, 49.8> 144} 145 146 147#declare BS4= array[24] { 148 < 24.8, 49.8>, < 13.0, 31.4>, < 4.0, 11.8>, < 0.1, 9.0> 149 < 0.1, 9.0>, <- 7.4, 13.7>, <-12.5, 30.4>, <-21.1, 49.8> 150 <-21.1, 49.8>, <-33.3, 76.9>, <-39.8, 87.0>, <-21.2, 91.4> 151 <-21.2, 91.4>, <-20.0, 95.3>, <-10.0, 95.9>, < 0.0, 95.9> 152 < 0.0, 95.9>, < 10.0, 95.9>, < 21.3, 95.8>, < 30.0, 90.7> 153 < 30.0, 90.7>, < 41.3, 84.0>, < 45.1, 86.5>, < 24.8, 49.8> 154} 155 156#declare J=0; 157#declare Part1= prism { 158 bezier_spline 159 -0.5, 0.5, 24, 160 #while (J<24) 161 #declare P= BS1[J]; 162 P 163 #declare J=J+1; 164 #end 165 scale < 0.0095, 1, 0.0095> 166} 167 168#declare J=0; 169#declare Part2= prism { 170 bezier_spline 171 -0.5, 0.5, 24, 172 #while (J<24) 173 #declare P= BS2[J]; 174 P 175 #declare J=J+1; 176 #end 177 scale < 0.0095, 1, 0.0095> 178} 179 180#declare J=0; 181#declare Part3= prism { 182 bezier_spline 183 -0.5, 0.5, 24, 184 #while (J<24) 185 #declare P= BS3[J]; 186 P 187 #declare J=J+1; 188 #end 189 scale < 0.0095, 1, 0.0095> 190} 191 192#declare J=0; 193#declare Part4= prism { 194 bezier_spline 195 -0.5, 0.5, 24, 196 #while (J<24) 197 #declare P= BS4[J]; 198 P 199 #declare J=J+1; 200 #end 201 scale < 0.0095, 1, 0.0095> 202} 203 204#declare LemonTex= texture { 205 pigment { 206 granite 207 scale <0.2,5,1> 208 colour_map { 209 [0.4 rgbf <1,0.65,0,0.4>] 210 [0.6 rgbf <1,0.8,0,0.4>] 211 [0.7 rgbf <1,0.9,0,0.6>] 212 [0.9 rgb <1,0.7,0>*1.5 ] 213 } 214 } 215 normal {granite -0.1 turbulence 0.3 scale <0.2,5,1>} 216 finish { 217 specular .9 218 roughness 0.01 219 } 220} 221 222#declare Parts= union { 223 object {Part1 } 224 object {Part2 rotate <0, 360/7 ,0>} 225 object {Part3 rotate <0,2*(360/7),0>} 226 object {Part4 rotate <0,3*(360/7),0>} 227 object {Part1 rotate <0,4*(360/7),0>} 228 object {Part2 rotate <0,5*(360/7),0>} 229 object {Part3 rotate <0,6*(360/7),0>} 230 rotate <90,0,0> 231} 232 233#declare LemonSlice = union { 234 intersection { 235 object {LemonOut} 236 object {Part1 rotate <90,0,0>} 237 texture {LemonTex rotate <90,0,0> translate rand(SS)*5} 238 } 239 intersection { 240 object {LemonOut} 241 object {Part2 rotate <0,360/7,0> rotate <90,0,0>} 242 texture {LemonTex rotate <0,360/7,0> rotate <90,0,0> translate rand(SS)*5} 243 } 244 intersection { 245 object {LemonOut} 246 object {Part3 rotate <0,2*(360/7),0> rotate <90,0,0>} 247 texture {LemonTex rotate <0,2*(360/7),0> rotate <90,0,0> translate rand(SS)*5} 248 } 249 intersection { 250 object {LemonOut} 251 object {Part4 rotate <0,3*(360/7),0> rotate <90,0,0>} 252 texture {LemonTex rotate <0,3*(360/7),0> rotate <90,0,0> translate rand(SS)*5} 253 } 254 intersection { 255 object {LemonOut} 256 object {Part1 rotate <0,4*(360/7),0> rotate <90,0,0>} 257 texture {LemonTex rotate <0,4*(360/7),0> rotate <90,0,0> translate rand(SS)*5} 258 } 259 intersection { 260 object {LemonOut} 261 object {Part2 rotate <0,5*(360/7),0> rotate <90,0,0>} 262 texture {LemonTex rotate <0,5*(360/7),0> rotate <90,0,0> translate rand(SS)*5} 263 } 264 intersection { 265 object {LemonOut} 266 object {Part3 rotate <0,6*(360/7),0> rotate <90,0,0>} 267 texture {LemonTex rotate <0,6*(360/7),0> rotate <90,0,0> translate rand(SS)*5} 268 } 269 270 difference { //outside 271 object {LemonOut} 272 object {Parts} 273 texture { 274 cylindrical 275 rotate <90,0,0> 276 texture_map { 277 [0.05, pigment {rgb <1,0.8,0>} 278 normal {granite .1 scale 0.1} 279 finish {phong 0.8 phong_size 20} 280 ] 281 [0.06, pigment {rgb <1,0.9,0.7>} 282 normal {granite .07 scale 0.5} 283 ] 284 } 285 } 286 } 287} 288 289//====== The Glass ====== 290 291#declare Ri=0.95; 292 293#declare Glass= merge { 294 difference { 295 cylinder { -y*2,y*2,1 } 296 sphere {-y*0.8,Ri} 297 cylinder { -y*0.8,y*2.01,Ri} 298 sphere {-y*1.9,0.1} 299 } 300 torus {0.975, 0.026 translate <0,2,0>} 301 // texture {T_Glass1} 302 // interior {ior 1.5} 303 // converted to material 26Sep2008 (jh) 304 material { 305 texture { 306 pigment {color rgbf<1.0, 1.0, 1.0, 0.7>} 307 finish {F_Glass1} 308 } 309 interior {ior 1.5} 310 } 311} 312 313 314//====== The bubbles and the juce ====== 315 316#declare Bubble= difference { 317 sphere {0,0.1} 318 sphere {0,0.09999999} 319} 320 321#declare S= seed(7); 322#declare I=0; 323#declare Bubbles= intersection { 324 union { 325 #while (I<60) 326 object { 327 Bubble 328 scale rand(S) 329 scale <1,0.7,1> 330 translate <1,0.6,0> 331 rotate <0,360*rand(S),0> 332 } 333 object { 334 Bubble 335 scale rand(S)*0.5 336 translate <rand(S),0.58,0> 337 rotate <0,360*rand(S),0> 338 } 339 #declare I=I+1; 340 #end //while 341 } 342 cylinder{y*0.5,y*0.85,Ri+0.00000001} 343} 344 345#declare Liquid= merge { 346 sphere {-y*0.8,Ri+0.00000001} 347 cylinder {-y*0.8,y*0.6,Ri+0.00000001} 348 object {Bubbles} 349 pigment {rgbf <0.9, 0.1, 0.2, 0.95>} 350 finish {reflection 0.3} 351 interior{ior 1.2} 352} 353 354//====== The glass and juice ===== 355union { 356 object {Glass} 357 object {Liquid} 358 photons { 359 target 360 refraction on 361 reflection on 362 collect off 363 } 364} 365 366object { 367 LemonSlice 368 scale <0.8,0.8,1> 369 translate <-0.99,0,0> 370 rotate <0,-30,0> 371 translate <0,2,0> 372 photons { 373 pass_through 374 } 375}