1// This work is licensed under the POV-Ray v3.7 distribution license.
2// To view a copy of this license, visit http://www.povray.org/licences/v3.7/.
3
4// Persistence Of Vision raytracer sample file.
5// POV-Ray scene description for chess board.
6// By Ville Saari
7// Copyright (c) 1991 Ferry Island Pixelboys
8//
9// This scene has 430 primitives in objects and 41 in bounding shapes and
10// it takes over 40 hours to render by standard amiga.
11//
12// If you do some nice modifications or additions to this file, please send
13// me a copy. My Internet address is:  vsaari@niksula.hut.fi
14//
15// -w320 -h240
16// -w800 -h600 +a0.3
17
18// Note : CHESS2.POV was created from Ville Saari's chess.pov
19// -- Dan Farmer 1996
20//  - Cchanged textures
21//  - Added camera blur and changed focal length
22//  - Use sky sphere
23//  - Modularized the code
24//  - Added felt pads to bottom of pieces
25
26// remaining manual bounding commented out by Bob Hughes, August 31, 2001
27
28#version 3.6;
29
30global_settings {
31  assumed_gamma 2.2
32  }
33
34#include "shapes.inc"
35#include "colors.inc"
36#include "textures.inc"
37#include "skies.inc"
38#include "metals.inc"
39#include "woods.inc"
40
41#declare FB_Quality_Off     =  0;
42#declare FB_Quality_Fast    =  1;
43#declare FB_Quality_Default =  2;
44#declare FB_Quality_High    =  3;
45
46#declare FB_Quality= FB_Quality_High;
47
48camera {
49   location <59, 20, -55>
50   direction <0, 0, 2>
51   up <0, 1, 0>
52   right x*image_width/image_height // keep proportions with any aspect ratio
53   look_at <0, -1, 1>
54
55#if(FB_Quality != FB_Quality_Off)
56      aperture 2.25
57      focal_point <0, 0, 0>
58#end
59
60#switch(FB_Quality)
61#case(FB_Quality_Off)
62   aperture 0
63        #debug "\nNo focal blur used...\n"
64#break
65#case (FB_Quality_Fast)
66   blur_samples 7
67   confidence 0.5             // default is 0.9
68   variance 1/64              // default is 1/128 (0.0078125)
69        #debug "\nFast focal blur used...\n"
70#break
71#case(FB_Quality_Default)
72   blur_samples 19
73   confidence 0.90            // default is 0.9
74   variance 1/128             // default is 1/128 (0.0078125)
75        #debug "\nDefault focal blur used...\n"
76#break
77#case(FB_Quality_High)
78   blur_samples 37
79   confidence 0.975           // default is 0.9
80   variance 1/255             // default is 1/128 (0.0078125)
81        #debug "\nHigh Quality focal blur used...\n"
82#break
83#else
84        #debug "\nNo focal blur used...\n"
85#end
86}
87
88light_source { <800, 600, -200> colour White }
89
90#declare PawnBase =
91union {
92    intersection {
93       sphere { <0, 0, 0>, 2.5 }
94       plane { -y, 0 }
95    }
96    cylinder { 0, y*0.35, 2.5 pigment { green 0.65 } }
97}
98
99#declare PieceBase =
100union {
101    intersection {
102       sphere { <0, 0, 0>, 3 }
103       plane { -y, 0 }
104    }
105    cylinder { 0, y*0.35, 3.0 pigment { green 0.65 } }
106}
107
108#declare Pawn = union {
109   sphere { <0, 7, 0>, 1.5 }
110
111   sphere { <0, 0, 0>, 1
112      scale <1.2, 0.3, 1.2>
113      translate 5.5*y
114   }
115
116   intersection {
117      plane { y, 5.5 }
118      object {
119         Hyperboloid_Y
120         translate 5*y
121         scale <0.5, 1, 0.5>
122      }
123      plane { -y, -2.5 }
124   }
125
126   sphere { <0, 0, 0>, 1
127      scale <2, 0.5, 2>
128      translate <0, 2.3, 0>
129   }
130   object { PawnBase }
131}
132
133
134#declare Rook = union {
135   intersection {
136      union {
137         plane { +x, -0.5 }
138         plane { -x, -0.5 }
139         plane { y, 9 }
140      }
141
142      union {
143         plane { +z, -0.5 }
144         plane { -z, -0.5 }
145         plane { y, 9 }
146      }
147
148      plane { y, 10 }
149      object { Cylinder_Y scale <2, 1, 2> }
150      object { Cylinder_Y scale <1.2, 1, 1.2> inverse }
151      plane { -y, -8 }
152   }
153
154   intersection {
155      plane { y, 8 }
156      object { Hyperboloid_Y
157         scale <1, 1.5, 1>
158         translate 5.401924*y
159      }
160      plane { -y, -3 }
161   }
162
163   sphere { <0, 0, 0>, 1
164      scale <2.5, 0.5, 2.5>
165      translate 2.8*y
166   }
167
168   object { PieceBase }
169}
170
171#declare Knight = union {
172   intersection {
173      object { Cylinder_Z
174         scale <17.875, 17.875, 1>
175         translate <-18.625, 7, 0>
176         inverse
177      }
178
179      object { Cylinder_Z
180         scale <17.875, 17.875, 1>
181         translate <18.625, 7, 0>
182         inverse
183      }
184
185      object { Cylinder_X
186         scale <1, 5.1, 5.1>
187         translate <0, 11.2, -5>
188         inverse
189      }
190
191      union {
192         plane { y, 0
193            rotate 30*x
194            translate 9.15*y
195         }
196         plane { z, 0
197            rotate -20*x
198            translate 10*y
199         }
200      }
201
202      union {
203         plane { -y, 0
204            rotate 30*x
205            translate 7.15*y
206         }
207         plane { y, 0
208            rotate 60*x
209            translate 7.3*y
210         }
211      }
212
213      union {
214         plane { y, 0
215            rotate -45*z
216         }
217         plane { y, 0
218            rotate 45*z
219         }
220         translate 9*y
221      }
222
223      object { Cylinder_Y scale <2, 1, 2> }
224      sphere { <0, 7, 0>, 4 }
225   }
226
227   sphere { <0, 0, 0>, 1
228      scale <2.5, 0.5, 2.5>
229      translate <0, 2.8, 0>
230   }
231
232   object { PieceBase }
233}
234
235#declare Bishop = union {
236   sphere { <0, 10.8, 0>, 0.4 }
237
238   intersection {
239      union {
240         plane { -z, -0.25 }
241         plane { +z, -0.25 }
242         plane { y, 0  }
243         rotate 30*x
244         translate 8.5*y
245      }
246
247      sphere { <0, 0, 0>, 1
248         scale <1.4, 2.1, 1.4>
249         translate 8.4*y
250      }
251
252      plane { -y, -7 }
253   }
254
255   sphere { <0, 0, 0>, 1
256      scale <1.5, 0.4, 1.5>
257      translate 7*y
258   }
259
260   intersection {
261      plane { y, 7 }
262      object {
263         Hyperboloid_Y
264         scale <0.6, 1.4, 0.6>
265         translate 7*y
266      }
267      plane { -y, -3 }
268   }
269
270   sphere { <0, 0, 0>, 1
271      scale <2.5, 0.5, 2.5>
272      translate 2.8*y
273   }
274
275   object { PieceBase }
276}
277
278#declare QueenAndKing = union {
279   sphere { <0, 10.5, 0>, 1.5 }
280
281   intersection {
282      union {
283         sphere { <1.75, 12, 0>, 0.9  rotate 150*y }
284         sphere { <1.75, 12, 0>, 0.9  rotate 120*y }
285         sphere { <1.75, 12, 0>, 0.9  rotate 90*y }
286         sphere { <1.75, 12, 0>, 0.9  rotate 60*y }
287         sphere { <1.75, 12, 0>, 0.9  rotate 30*y }
288         sphere { <1.75, 12, 0>, 0.9  }
289         sphere { <1.75, 12, 0>, 0.9  rotate -30*y }
290         sphere { <1.75, 12, 0>, 0.9  rotate -60*y }
291         sphere { <1.75, 12, 0>, 0.9  rotate -90*y }
292         sphere { <1.75, 12, 0>, 0.9  rotate -120*y }
293         sphere { <1.75, 12, 0>, 0.9  rotate -150*y }
294         sphere { <1.75, 12, 0>, 0.9  rotate  180*y }
295         inverse
296      }
297
298      plane { y, 11.5 }
299
300      object { QCone_Y
301         scale <1, 3, 1>
302         translate 5*y
303      }
304
305      plane { -y, -8 }
306   }
307
308   sphere { <0, 0, 0>, 1
309      scale <1.8, 0.4, 1.8>
310      translate 8*y
311   }
312
313   intersection {
314      plane { y, 8 }
315      object { Hyperboloid_Y
316         scale <0.7, 1.6, 0.7>
317         translate 7*y
318      }
319      plane { -y, -3 }
320   }
321
322   sphere { <0, 0, 0>, 1
323      scale <2.5, 0.5, 2.5>
324      translate 2.8*y
325   }
326
327   object { PieceBase }
328}
329
330#declare Queen = union {
331   sphere { <0, 12.3, 0>, 0.4 }
332   object { QueenAndKing }
333}
334
335#declare King = union {
336   intersection {
337      union {
338         intersection {
339            plane { y, 13 }
340            plane { -y, -12.5 }
341         }
342
343         intersection {
344            plane { +x, 0.25 }
345            plane { -x, 0.25 }
346         }
347      }
348
349      plane { +z,  0.25 }
350      plane { -z,  0.25 }
351      plane { +x,  0.75 }
352      plane { -x,  0.75 }
353      plane { +y,  13.5  }
354      plane { -y,  -11.5  }
355   }
356
357   object { QueenAndKing }
358}
359
360#declare WWood = texture {
361    T_Silver_3B
362}
363
364#declare BWood = texture {
365    T_Gold_3C
366}
367
368#declare WPawn = object {
369   Pawn
370
371   // bounded_by { sphere { <0, 4, 0>, 4.72 } }
372
373   texture {
374      WWood
375      pigment { quick_color red 0.95 green 0.62 }
376   }
377}
378
379#declare BPawn = object {
380   Pawn
381
382   // bounded_by { sphere { <0, 4, 0>, 4.72 } }
383
384   texture {
385      BWood
386      pigment { quick_color red 0.4 green 0.2 }
387   }
388}
389
390#declare WRook = object {
391   Rook
392
393   // bounded_by { sphere { <0, 5, 0>, 5.831 } }
394
395   texture {
396      WWood
397      pigment { quick_color red 0.95 green 0.62 }
398   }
399}
400
401#declare BRook = object {
402   Rook
403
404   // bounded_by { sphere { <0, 5, 0>, 5.831 } }
405
406   texture {
407      BWood
408      pigment { quick_color red 0.4 green 0.2 }
409   }
410}
411
412#declare WKnight = object {
413   Knight
414
415   // bounded_by { sphere { <0, 5, 0>, 5.831 } }
416
417   texture {
418      WWood
419      pigment { quick_color red 0.95 green 0.62 }
420   }
421}
422
423#declare BKnight = object {
424   Knight
425   rotate 180*y
426
427   // bounded_by { sphere { <0, 5, 0>, 5.831 } }
428
429   texture {
430      BWood
431      pigment { quick_color red 0.4 green 0.2 }
432   }
433}
434
435#declare WBishop = object {
436   Bishop
437
438   // bounded_by { sphere { <0, 5.5, 0>, 6.265 } }
439
440   texture {
441      WWood
442      pigment { quick_color red 0.95 green 0.62 }
443   }
444}
445
446#declare BBishop = object {
447   Bishop
448   rotate 180*y
449
450   // bounded_by { sphere { <0, 5.5 ,0>, 6.265 } }
451
452   texture {
453      BWood
454      pigment { quick_color red 0.4 green 0.2 }
455   }
456}
457
458#declare WQueen = object {
459   Queen
460/*
461   bounded_by {
462      intersection {
463         sphere { <0, 6, 0>, 6.71 }
464         object { Cylinder_Y scale <3, 1, 3> }
465      }
466   }
467*/
468   texture {
469      WWood
470      pigment { quick_color red 0.95 green 0.62 }
471   }
472}
473
474#declare BQueen = object {
475   Queen
476/*
477   bounded_by {
478      intersection {
479         sphere { <0, 6, 0>, 6.71 }
480         object { Cylinder_Y scale <3, 1, 3> }
481      }
482   }
483*/
484   texture {
485      BWood
486      pigment { quick_color red 0.4 green 0.2 }
487   }
488}
489
490#declare WKing = object {
491   King
492/*
493   bounded_by {
494      intersection {
495         sphere { <0, 6.5, 0>, 7.16 }
496         object { Cylinder_Y scale <3, 1, 3> }
497      }
498   }
499*/
500   texture {
501      WWood
502      pigment { quick_color red 0.95 green 0.62 }
503   }
504}
505
506#declare BKing = object {
507   King
508/*
509   bounded_by {
510      intersection {
511         sphere { <0, 6.5, 0>, 7.16 }
512         object { Cylinder_Y scale <3, 1, 3> }
513      }
514   }
515*/
516   texture {
517      BWood
518      pigment { quick_color red 0.4 green 0.2 }
519   }
520}
521
522/* Sky */
523#declare SkySphere = sky_sphere { S_Cloud1 }
524
525/* Ground */
526#declare Ground =
527plane { y, -80
528   pigment { green 0.65 }
529   finish {
530      ambient 0.25
531      diffuse 0.5
532   }
533}
534
535#declare FarSide =
536union {
537   object { BPawn translate <-28, 0, 20> }
538   object { BPawn translate <-20, 0, 20> }
539   object { BPawn translate <-12, 0, 20> }
540   object { BPawn translate < -4, 0, 20> }
541   object { BPawn translate <  4, 0, 20> }
542   object { BPawn translate < 12, 0, 20> }
543   object { BPawn translate < 20, 0, 20> }
544   object { BPawn translate < 28, 0, 20> }
545
546   object { BRook   translate <-28, 0, 28> }
547   object { BKnight translate <-20, 0, 28> }
548   object { BBishop translate <-12, 0, 28> }
549   object { BQueen  translate < -4, 0, 28> }
550   object { BKing   translate <  4, 0, 28> }
551   object { BBishop translate < 12, 0, 28> }
552   object { BKnight translate < 20, 0, 28> }
553   object { BRook   translate < 28, 0, 28> }
554/*
555  bounded_by {
556      object {
557         Cylinder_X
558         scale <1, 9.56, 9.56>
559         translate <0, 6.5, 24>
560      }
561   }
562*/
563}
564
565#declare NearSide =
566union {
567   object { WPawn translate <-28, 0, -20> }
568   object { WPawn translate <-20, 0, -20> }
569   object { WPawn translate <-12, 0, -20> }
570   object { WPawn translate < -4, 0, -20> }
571   object { WPawn translate <  4, 0, -20> }
572   object { WPawn translate < 12, 0, -20> }
573   object { WPawn translate < 20, 0, -20> }
574   object { WPawn translate < 28, 0, -20> }
575
576   object { WRook   translate <-28, 0, -28> }
577   object { WKnight translate <-20, 0, -28> }
578   object { WBishop translate <-12, 0, -28> }
579   object { WQueen  translate < -4, 0, -28> }
580   object { WKing   translate <  4, 0, -28> }
581   object { WBishop translate < 12, 0, -28> }
582   object { WKnight translate < 20, 0, -28> }
583   object { WRook   translate < 28, 0, -28> }
584
585
586}
587
588#declare Pieces =
589union {
590   object { NearSide }
591   object { FarSide }
592/*
593  bounded_by {
594     intersection {
595         plane { y, 13.5 }
596         sphere { -30*y, 63 }
597      }
598   }
599*/
600}
601
602#declare FramePiece =
603intersection {
604   plane { +y, -0.15 }
605   plane { -y, 3 }
606   plane { -z, 35 }
607   plane { <-1, 0, 1>, 0 }      // 45 degree bevel
608   plane { < 1, 0, 1>, 0 }      // 45 degree bevel
609}
610
611#declare Frame =
612union {
613   union {
614      object { FramePiece }
615      object { FramePiece rotate 180*y }
616      texture {
617         T_Wood20
618         scale 2
619         rotate y*87
620         translate x*1
621         finish {
622            specular 1
623            roughness 0.02
624            ambient 0.35
625          }
626      }
627   }
628
629   union {
630      object { FramePiece rotate -90*y }
631      object { FramePiece rotate  90*y }
632      texture {
633         T_Wood20
634         scale 2
635         rotate y*2
636         finish {
637            specular 1
638            roughness 0.02
639            ambient 0.35
640          }
641      }
642   }
643}
644#declare Board =
645   box { <-32, -1, -32> <32, 0, 32>
646      texture {
647         tiles {
648            texture {
649               pigment {
650                  //marble
651                  wrinkles
652                  turbulence 1.0
653                  colour_map {
654                     [0.0 0.7 colour White
655                              colour White]
656                     [0.7 0.9 colour White
657                              colour red 0.8 green 0.8 blue 0.8]
658                     [0.9 1.0 colour red 0.8 green 0.8 blue 0.8
659                              colour red 0.5 green 0.5 blue 0.5]
660                  }
661                  scale <0.6, 1, 0.6>
662                  rotate -30*y
663               }
664               finish {
665                  specular 1
666                  roughness 0.02
667                  reflection 0.25
668               }
669            } // texture
670            tile2
671            texture {
672               pigment {
673                  granite
674                  scale <0.3, 1, 0.3>
675                  colour_map {
676                     [0 1 colour Black
677                          colour red 0.5 green 0.5 blue 0.5]
678                  }
679               }
680               finish {
681                  specular 1
682                  roughness 0.02
683                  reflection 0.25
684               }
685            }
686         } // texture
687         scale <8, 1, 8>
688      } //texture
689   } // intersection
690
691
692
693/* Table */
694#declare Table =
695union {
696   intersection {
697      plane { +y, -3 }
698      plane { -y,  8 }
699      sphere { <0, -5.5, 0>, 55 }
700   }
701
702   intersection {
703      plane { y, -8 }
704      object {
705         Hyperboloid_Y
706         scale <10, 20, 10>
707         translate -20*y
708      }
709   }
710
711   pigment {
712      granite
713      scale 6
714   }
715   finish {
716      specular 1
717      roughness 0.02
718      reflection 0.3
719   }
720}
721
722object { Pieces }
723object { Board }
724object { Frame }
725object { Ground }
726object { Table }
727sky_sphere { SkySphere }
728