home *** CD-ROM | disk | FTP | other *** search
/ Freelog 38 / Freelog038.iso / Graphisme3D / Pov / Dos / povmsdos.exe / POVMSDOS.ZIP / POVUSER.TXT < prev    next >
Text File  |  1999-05-13  |  862KB  |  20,809 lines

  1.                Persistence of Vision (tm) Ray-Tracer
  2.                                 
  3.                      POV-Ray (tm) Version 3.1g
  4.                                 
  5.                       User's Documentation
  6.                             May 1999
  7.                                 
  8.                     Copyright 1999 POV-Team (tm)
  9.                                 
  10. POV-Ray (tm) is based on DKBTrace 2.12 by David K. Buck and Aaron A.
  11.                             Collins.
  12.                                 
  13.    POV-Ray, POV-Help, POV-Team, and Persistence of Vision are
  14.                    trademarks of the POV-Team.
  15.  
  16.  
  17. 1  Introduction
  18.  1.1  Program Description
  19.  1.2  What is Ray-Tracing?
  20.  1.3  What is POV-Ray?
  21.  1.4  How Do I Begin?
  22.  1.5  Notation and Basic Assumptions
  23.  1.6  What's New in POV-Ray 3.1?
  24.   1.6.1  Media Replaces Halo & Atmosphere
  25.   1.6.2  New #macro Feature
  26.   1.6.3  Arrays Added
  27.   1.6.4  File I/O and other Directives
  28.   1.6.5  Additional New Features
  29.  
  30. 2  Beginning Tutorial
  31.  2.1  Our First Image
  32.   2.1.1  Understanding POV-Ray's Coordinate System
  33.   2.1.2  Adding Standard Include Files
  34.   2.1.3  Adding a Camera
  35.   2.1.4  Describing an Object
  36.   2.1.5  Adding Texture to an Object
  37.   2.1.6  Defining a Light Source
  38.  2.2  Simple Shapes
  39.   2.2.1  Box Object
  40.   2.2.2  Cone Object
  41.   2.2.3  Cylinder Object
  42.   2.2.4  Plane Object
  43.  2.3  CSG Objects
  44.   2.3.1  What is CSG?
  45.   2.3.2  CSG Union
  46.   2.3.3  CSG Intersection
  47.   2.3.4  CSG Difference
  48.   2.3.5  CSG Merge
  49.   2.3.6  CSG Pitfalls
  50.     2.3.6.1  Coincidence Surfaces
  51.  2.4  Advanced Shapes
  52.   2.4.1  Bicubic Patch Object
  53.   2.4.2  Blob Object
  54.     2.4.2.1  Component Types and Other New Features
  55.     2.4.2.2  Complex Blob Constructs and Negative Strength
  56.   2.4.3  Height Field Object
  57.   2.4.4  Lathe Object
  58.     2.4.4.1  Understanding The Concept of Splines
  59.   2.4.5  Mesh Object
  60.   2.4.6  Polygon Object
  61.   2.4.7  Prism Object
  62.     2.4.7.1  Teaching An Old Spline New Tricks
  63.     2.4.7.2  Smooth Transitions
  64.     2.4.7.3  Multiple Sub-Shapes
  65.     2.4.7.4  Conic Sweeps And The Tapering Effect
  66.   2.4.8  Superquadric Ellipsoid Object
  67.   2.4.9  Surface of Revolution Object
  68.   2.4.10  Text Object
  69.   2.4.11  Torus Object
  70.  2.5  The Light Source
  71.   2.5.1  The Pointlight Source
  72.   2.5.2  The Spotlight Source
  73.   2.5.3  The Cylindrical Light Source
  74.   2.5.4  The Area Light Source
  75.   2.5.5  The Ambient Light Source
  76.   2.5.6  Light Source Specials
  77.     2.5.6.1  Using Shadowless Lights
  78.     2.5.6.2  Assigning an Object to a Light Source
  79.     2.5.6.3  Using Light Fading
  80.  2.6  Simple Texture Options
  81.   2.6.1  Surface Finishes
  82.   2.6.2  Adding Bumpiness
  83.   2.6.3  Creating Color Patterns
  84.   2.6.4  Pre-defined Textures
  85.  2.7  Advanced Texture Options
  86.   2.7.1  Pigments
  87.     2.7.1.1  Using Color List Pigments
  88.     2.7.1.2  Using Pigment and Patterns
  89.     2.7.1.3  Using Pattern Modifiers
  90.     2.7.1.4  Using Transparent Pigments and Layered Textures
  91.     2.7.1.5  Using Pigment Maps
  92.   2.7.2  Normals
  93.     2.7.2.1  Using Basic Normal Modifiers
  94.     2.7.2.2  Blending Normals
  95.   2.7.3  Finishes
  96.     2.7.3.1  Using Ambient
  97.     2.7.3.2  Using Surface Highlights
  98.     2.7.3.3  Using Reflection and Metallic
  99.     2.7.3.4  Using Iridescence
  100.   2.7.4  Working With Pigment Maps
  101.   2.7.5  Working With Normal Maps
  102.   2.7.6  Working With Texture Maps
  103.   2.7.7  Working With List Textures
  104.   2.7.8  What About Tiles?
  105.   2.7.9  Average Function
  106.   2.7.10  Working With Layered Textures
  107.     2.7.10.1  Declaring Layered Textures
  108.     2.7.10.2  Another Layered Textures Example
  109.   2.7.11  When All Else Fails: Material Maps
  110.   2.7.12  Limitations Of Special Textures
  111.  2.8  Using the Camera
  112.   2.8.1  Using Focal Blur
  113.  2.9  Using Atmospheric Effects
  114.   2.9.1  The Background
  115.   2.9.2  The Sky Sphere
  116.     2.9.2.1  Creating a Sky with a Color Gradient
  117.     2.9.2.2  Adding the Sun
  118.     2.9.2.3  Adding Some Clouds
  119.   2.9.3  The Fog
  120.     2.9.3.1  A Constant Fog
  121.     2.9.3.2  Setting a Minimum Translucency
  122.     2.9.3.3  Creating a Filtering Fog
  123.     2.9.3.4  Adding Some Turbulence to the Fog
  124.     2.9.3.5  Using Ground Fog
  125.     2.9.3.6  Using Multiple Layers of Fog
  126.     2.9.3.7  Fog and Hollow Objects
  127.   2.9.4  The Rainbow
  128.     2.9.4.1  Starting With a Simple Rainbow
  129.     2.9.4.2  Increasing the Rainbow's Translucency
  130.     2.9.4.3  Using a Rainbow Arc
  131.   2.9.5  Animation
  132.     2.9.5.1  The Clock Variable: Key To It All
  133.     2.9.5.2  Clock Dependant Variables And Multi-Stage
  134.                Animations
  135.     2.9.5.3  The Phase Keyword
  136.     2.9.5.4  Do Not Use Jitter Or Crand
  137.     2.9.5.5  INI File Settings
  138.  
  139. 3  POV-Ray Options
  140.  3.1  Setting POV-Ray Options
  141.   3.1.1  Command Line Switches
  142.   3.1.2  Using INI Files
  143.   3.1.3  Using the POVINI Environment Variable
  144.  3.2  Options Reference
  145.   3.2.1  Animation Options
  146.     3.2.1.1  External Animation Loop
  147.     3.2.1.2  Internal Animation Loop
  148.     3.2.1.3  Subsets of Animation Frames
  149.     3.2.1.4  Cyclic Animation
  150.     3.2.1.5  Field Rendering
  151.   3.2.2  Output Options
  152.     3.2.2.1  General Output Options
  153.      3.2.2.1.1  Height and Width of Output
  154.      3.2.2.1.2  Partial Output Options
  155.      3.2.2.1.3  Interrupting Options
  156.      3.2.2.1.4  Resuming Options
  157.     3.2.2.2  Display Output Options
  158.      3.2.2.2.1  Display Hardware Settings
  159.      3.2.2.2.2  Display Related Settings
  160.      3.2.2.2.3  Mosaic Preview
  161.     3.2.2.3  File Output Options
  162.      3.2.2.3.1  Output File Type
  163.      3.2.2.3.2  Output File Name
  164.      3.2.2.3.3  Output File Buffer
  165.     3.2.2.4  CPU Utilization Histogram
  166.      3.2.2.4.1  File Type
  167.      3.2.2.4.2  File Name
  168.      3.2.2.4.3  Grid Size
  169.   3.2.3  Scene Parsing Options
  170.     3.2.3.1  Input File Name
  171.     3.2.3.2  Library Paths
  172.     3.2.3.3  Language Version
  173.   3.2.4  Shell-out to Operating System
  174.     3.2.4.1  String Substitution in Shell Commands
  175.     3.2.4.2  Shell Command Sequencing
  176.     3.2.4.3  Shell Command Return Actions
  177.   3.2.5  Text Output
  178.     3.2.5.1  Text Streams
  179.     3.2.5.2  Console Text Output
  180.     3.2.5.3  Directing Text Streams to Files
  181.     3.2.5.4  Help Screen Switches
  182.   3.2.6  Tracing Options
  183.     3.2.6.1  Quality Settings
  184.     3.2.6.2  Radiosity Setting
  185.     3.2.6.3  Automatic Bounding Control
  186.     3.2.6.4  Removing User Bounding
  187.     3.2.6.5  Anti-Aliasing Options
  188.  
  189. 4  Scene Description Language
  190.  4.1  Language Basics
  191.   4.1.1  Identifiers and Keywords
  192.   4.1.2  Comments
  193.   4.1.3  Float Expressions
  194.     4.1.3.1  Float Literals
  195.     4.1.3.2  Float Identifiers
  196.     4.1.3.3  Float Operators
  197.     4.1.3.4  Built-in Float Identifiers
  198.     4.1.3.5  Boolean Keywords
  199.     4.1.3.6  Float Functions
  200.   4.1.4  Vector Expressions
  201.     4.1.4.1  Vector Literals
  202.     4.1.4.2  Vector Identifiers
  203.     4.1.4.3  Vector Operators
  204.     4.1.4.4  Operator Promotion
  205.     4.1.4.5  Built-in Vector Identifiers
  206.     4.1.4.6  Vector Functions
  207.   4.1.5  Specifying Colors
  208.     4.1.5.1  Color Vectors
  209.     4.1.5.2  Color Keywords
  210.     4.1.5.3  Color Identifiers
  211.     4.1.5.4  Color Operators
  212.     4.1.5.5  Common Color Pitfalls
  213.   4.1.6  Strings
  214.     4.1.6.1  String Literals
  215.     4.1.6.2  String Identifiers
  216.     4.1.6.3  String Functions
  217.   4.1.7  Array Identifiers
  218.     4.1.7.1  Declaring Arrays
  219.     4.1.7.2  Array Initalizers
  220.  4.2  Language Directives
  221.   4.2.1  Include Files and the #include Directive.
  222.   4.2.2  The #declare and #local Directives
  223.     4.2.2.1  Declaring identifiers
  224.     4.2.2.2  #declare vs. #local
  225.     4.2.2.3  Identifier Name Collisions
  226.     4.2.2.4  Destroying Identifiers with #undef
  227.   4.2.3  File I/O Directives
  228.     4.2.3.1  The #fopen Directive
  229.     4.2.3.2  The #fclose Directive
  230.     4.2.3.3  The #read Directive
  231.     4.2.3.4  The #write Directive
  232.   4.2.4  The #default Directive
  233.   4.2.5  The #version Directive
  234.   4.2.6  Conditional Directives
  235.     4.2.6.1  The #if...#else...#end Directives
  236.     4.2.6.2  The #ifdef and #ifndef Directives
  237.     4.2.6.3  The #switch, #case, #range and #break Directives
  238.     4.2.6.4  The #while...#end Directive
  239.   4.2.7  User Message Directives
  240.     4.2.7.1  Text Message Streams
  241.     4.2.7.2  Text Formatting
  242.   4.2.8  User Defined Macros
  243.     4.2.8.1  The #macro Directive
  244.     4.2.8.2  Invoking Macros
  245.     4.2.8.3  Are POV-Ray Macros a Function or a Macro?
  246.     4.2.8.4  Returning a Value Like a Function
  247.     4.2.8.5  Returning Values Via Parameters
  248.  4.3  POV-Ray Coordinate System
  249.   4.3.1  Transformations
  250.     4.3.1.1  Translate
  251.     4.3.1.2  Scale
  252.     4.3.1.3  Rotate
  253.     4.3.1.4  Matrix Keyword
  254.   4.3.2  Transformation Order
  255.   4.3.3  Transform Identifiers
  256.   4.3.4  Transforming Textures and Objects
  257.  4.4  Camera
  258.   4.4.1  Placing the Camera
  259.     4.4.1.1  Location and Look_At
  260.     4.4.1.2  The Sky Vector
  261.     4.4.1.3  Angle
  262.     4.4.1.4  The Direction Vector
  263.     4.4.1.5  Up and Right Vectors
  264.      4.4.1.5.1  Aspect Ratio
  265.      4.4.1.5.2  Handedness
  266.     4.4.1.6  Transforming the Camera
  267.   4.4.2  Types of Projection
  268.   4.4.3  Focal Blur
  269.   4.4.4  Camera Ray Perturbation
  270.   4.4.5  Camera Identifiers
  271.  4.5  Objects
  272.   4.5.1  Finite Solid Primitives
  273.     4.5.1.1  Blob
  274.     4.5.1.2  Box
  275.     4.5.1.3  Cone
  276.     4.5.1.4  Cylinder
  277.     4.5.1.5  Height Field
  278.     4.5.1.6  Julia Fractal
  279.     4.5.1.7  Lathe
  280.     4.5.1.8  Prism
  281.     4.5.1.9  Sphere
  282.     4.5.1.10  Superquadric Ellipsoid
  283.     4.5.1.11  Surface of Revolution
  284.     4.5.1.12  Text
  285.     4.5.1.13  Torus
  286.   4.5.2  Finite Patch Primitives
  287.     4.5.2.1  Bicubic Patch
  288.     4.5.2.2  Disc
  289.     4.5.2.3  Mesh
  290.     4.5.2.4  Polygon
  291.     4.5.2.5  Triangle and Smooth Triangle
  292.   4.5.3  Infinite Solid Primitives
  293.     4.5.3.1  Plane
  294.     4.5.3.2  Poly, Cubic and Quartic
  295.     4.5.3.3  Quadric
  296.   4.5.4  Constructive Solid Geometry
  297.     4.5.4.1  Inside and Outside
  298.     4.5.4.2  Union
  299.     4.5.4.3  Intersection
  300.     4.5.4.4  Difference
  301.     4.5.4.5  Merge
  302.   4.5.5  Light Sources
  303.     4.5.5.1  Point Lights
  304.     4.5.5.2  Spotlights
  305.     4.5.5.3  Cylindrical Lights
  306.     4.5.5.4  Area Lights
  307.     4.5.5.5  Shadowless Lights
  308.     4.5.5.6  Looks_like
  309.     4.5.5.7  Light Fading
  310.     4.5.5.8  Atmospheric Media Interaction
  311.     4.5.5.9  Atmospheric Attenuation
  312.   4.5.6  Object Modifiers
  313.     4.5.6.1  Clipped_By
  314.     4.5.6.2  Bounded_By
  315.     4.5.6.3  Material
  316.     4.5.6.4  Inverse
  317.     4.5.6.5  Hollow
  318.     4.5.6.6  No_Shadow
  319.     4.5.6.7  Sturm
  320.  4.6  Interior
  321.   4.6.1  Why are Interior and Media Necessary?
  322.   4.6.2  Empty and Solid Objects
  323.   4.6.3  Refraction
  324.   4.6.4  Attenuation
  325.   4.6.5  Faked Caustics
  326.   4.6.6  Object Media
  327.  4.7  Textures
  328.   4.7.1  Pigment
  329.     4.7.1.1  Solid Color Pigments
  330.     4.7.1.2  Color List Pigments
  331.     4.7.1.3  Color Maps
  332.     4.7.1.4  Pigment Maps and Pigment Lists
  333.     4.7.1.5  Image Maps
  334.      4.7.1.5.1  Specifying an Image Map
  335.      4.7.1.5.2  The Filter and Transmit Bitmap Modifiers
  336.      4.7.1.5.3  Using the Alpha Channel
  337.     4.7.1.6  Quick Color
  338.   4.7.2  Normal
  339.     4.7.2.1  Slope Maps
  340.     4.7.2.2  Normal Maps and Normal Lists
  341.     4.7.2.3  Bump Maps
  342.      4.7.2.3.1  Specifying a Bump Map
  343.      4.7.2.3.2  Bump_Size
  344.      4.7.2.3.3  Use_Index and Use_Color
  345.   4.7.3  Finish
  346.     4.7.3.1  Ambient
  347.     4.7.3.2  Diffuse Reflection Items
  348.      4.7.3.2.1  Diffuse
  349.      4.7.3.2.2  Brilliance
  350.      4.7.3.2.3  Crand Graininess
  351.     4.7.3.3  Highlights
  352.      4.7.3.3.1  Phong Highlights
  353.      4.7.3.3.2  Specular Highlight
  354.      4.7.3.3.3  Metallic Highlight Modifier
  355.     4.7.3.4  Specular Reflection
  356.     4.7.3.5  Iridescence
  357.   4.7.4  Halo
  358.   4.7.5  Patterned Textures
  359.     4.7.5.1  Texture Maps
  360.     4.7.5.2  Tiles
  361.     4.7.5.3  Material Maps
  362.      4.7.5.3.1  Specifying a Material Map
  363.   4.7.6  Layered Textures
  364.   4.7.7  Patterns
  365.     4.7.7.1  Agate
  366.     4.7.7.2  Average
  367.     4.7.7.3  Boxed
  368.     4.7.7.4  Bozo
  369.     4.7.7.5  Brick
  370.     4.7.7.6  Bumps
  371.     4.7.7.7  Checker
  372.     4.7.7.8  Crackle
  373.     4.7.7.9  Cylindrical
  374.     4.7.7.10  Density_File
  375.     4.7.7.11  Dents
  376.     4.7.7.12  Gradient
  377.     4.7.7.13  Granite
  378.     4.7.7.14  Hexagon
  379.     4.7.7.15  Leopard
  380.     4.7.7.16  Mandel
  381.     4.7.7.17  Marble
  382.     4.7.7.18  Onion
  383.     4.7.7.19  Planar
  384.     4.7.7.20  Quilted
  385.     4.7.7.21  Radial
  386.     4.7.7.22  Ripples
  387.     4.7.7.23  Spherical
  388.     4.7.7.24  Spiral1
  389.     4.7.7.25  Spiral2
  390.     4.7.7.26  Spotted
  391.     4.7.7.27  Waves
  392.     4.7.7.28  Wood
  393.     4.7.7.29  Wrinkles
  394.   4.7.8  Pattern Modifiers
  395.     4.7.8.1  Transforming Patterns
  396.     4.7.8.2  Frequency and Phase
  397.     4.7.8.3  Waveforms
  398.     4.7.8.4  Turbulence
  399.     4.7.8.5  Octaves
  400.     4.7.8.6  Lambda
  401.     4.7.8.7  Omega
  402.     4.7.8.8  Warps
  403.      4.7.8.8.1  Black Hole Warp
  404.      4.7.8.8.2  Repeat Warp
  405.      4.7.8.8.3  Turbulence Warp
  406.     4.7.8.9  Bitmap Modifiers
  407.      4.7.8.9.1  The once Option
  408.      4.7.8.9.2  The map_type Option
  409.      4.7.8.9.3  The interpolate Option
  410.  4.8  Media
  411.   4.8.1  Media Types
  412.     4.8.1.1  Absorption
  413.     4.8.1.2  Emission
  414.     4.8.1.3  Scattering
  415.   4.8.2  Sampling Parameters
  416.   4.8.3  Density
  417.     4.8.3.1  General Density Modifiers
  418.     4.8.3.2  Density with color_map
  419.     4.8.3.3  Density Maps and Density Lists
  420.     4.8.3.4  Multiple Density vs. Multiple Media
  421.  4.9  Atmospheric Effects
  422.   4.9.1  Atmospheric Media
  423.   4.9.2  Background
  424.   4.9.3  Fog
  425.   4.9.4  Sky Sphere
  426.   4.9.5  Rainbow
  427.  4.10  Global Settings
  428.   4.10.1  ADC_Bailout
  429.   4.10.2  Ambient Light
  430.   4.10.3  Assumed_Gamma
  431.     4.10.3.1  Monitor Gamma
  432.     4.10.3.2  Image File Gamma
  433.     4.10.3.3  Scene File Gamma
  434.   4.10.4  HF_Gray_16
  435.   4.10.5  Irid_Wavelength
  436.   4.10.6  Max_Trace_Level
  437.   4.10.7  Max_Intersections
  438.   4.10.8  Number_Of_Waves
  439.   4.10.9  Radiosity
  440.     4.10.9.1  How Radiosity Works
  441.     4.10.9.2  Adjusting Radiosity
  442.      4.10.9.2.1  brightness
  443.      4.10.9.2.2  count
  444.      4.10.9.2.3  distance_maximum
  445.      4.10.9.2.4  error_bound
  446.      4.10.9.2.5  gray_threshold
  447.      4.10.9.2.6  low_error_factor
  448.      4.10.9.2.7  minimum_reuse
  449.      4.10.9.2.8  nearest_count
  450.      4.10.9.2.9  recursion_limit
  451.     4.10.9.3  Tips on Radiosity
  452.  
  453. 5  APPENDICES
  454.  5.1  Copyright, Legal Information and License -- POVLEGAL.DOC
  455.   5.1.1  General License Agreement -- POVLEGAL.DOC
  456.   5.1.2  Usage Provisions
  457.   5.1.3  General Rules For All Distribution
  458.   5.1.4  Definition Of "Full Package"
  459.   5.1.5  Conditions For CD-ROM or Shareware/Freeware
  460.            Distribution
  461.   5.1.6  Conditions For On-Line Services And Bbs's Including
  462.            Internet
  463.   5.1.7  Online Or Remote Execution Of POV-Ray
  464.   5.1.8  Permitted Modification And Custom Versions
  465.   5.1.9  Conditions For Distribution Of Custom Versions
  466.   5.1.10  Conditions For Commercial Bundling
  467.   5.1.11  POV-Team Endorsement Prohibitions
  468.   5.1.12  Retail Value Of This Software
  469.   5.1.13  Other Provisions
  470.   5.1.14  Revocation Of License
  471.   5.1.15  Disclaimer
  472.   5.1.16  Technical Support
  473.  5.2  Authors
  474.   5.2.1  Contacting the Authors
  475.  5.3  What to do if you don't have POV-Ray
  476.   5.3.1  Which Version of POV-Ray should you use?
  477.     5.3.1.1  Microsoft Windows 95/98/NT
  478.     5.3.1.2  MS-Dos & Windows 3.x
  479.     5.3.1.3  Linux for Intel x86
  480.     5.3.1.4  Apple Macintosh
  481.     5.3.1.5  Amiga
  482.     5.3.1.6  SunOS
  483.     5.3.1.7  Generic Unix
  484.     5.3.1.8  All Versions
  485.   5.3.2  Where to Find POV-Ray Files
  486.     5.3.2.1  World Wide Website www.povray.org
  487.     5.3.2.2  Books, Magazines and CD-ROMs
  488.  5.4  Compiling POV-Ray
  489.   5.4.1  Directory Structure
  490.   5.4.2  Configuring POV-Ray Source
  491.   5.4.3  Conclusion
  492.  5.5  Suggested Reading
  493.  
  494.  
  495.  
  496.  
  497. 1.0    Introduction
  498. This document details the use of the Persistence of Vision (tm) Ray-
  499. Tracer (POV-Ray (tm)). It is divided into five parts:
  500.  
  501.   1)This introduction which explains what POV-Ray is and what
  502.      ray-tracing is. It gives a brief overview of how to create
  503.      ray-traced images.
  504.   2)A "Beginning Tutorial" which explains step by step how to
  505.      use the different features of POV-Ray.
  506.   3)A complete reference on "Scene Description Language" in
  507.      which you describe the scene.
  508.   4)A complete reference on "POV-Ray Options" which explains
  509.      options (set either by command line switches or by INI file
  510.      keywords) that tell POV-Ray how to render the scenes.
  511.   5)And in our "APPENDICES" you will find some tips and hints,
  512.      where to get the latest version and versions for other
  513.      platforms, information on compiling custom versions of POV-
  514.      Ray, suggested reading, contact addresses and legal
  515.      information.
  516. POV-Ray runs on MS-Dos, Windows 3.x, Windows for Workgroups 3.11,
  517. Windows 95, Windows NT, Apple Macintosh 68k, Macintosh Power PC,
  518. Amiga, Linux, Sun-OS, UNIX and other platforms.
  519.  
  520. We assume that if you are reading this document then you already
  521. have POV-Ray installed and running.  However the POV-Team does
  522. distribute this file by itself in various formats including
  523. online on the internet.  If you don't have POV-Ray or aren't sure
  524. you have the official version or the latest version, see appendix
  525. "What to do if you don't have POV-Ray".
  526.  
  527. This document covers only the generic parts of the program which
  528. are common to each version.  Each version has platform-specific
  529. documentation not included here.  We recommend you finish reading
  530. this introductory section then read the platform-specific
  531. information before trying the tutorial here.
  532.  
  533. The platform-specific docs will show you how to render a sample
  534. scene and will give you detailed description of the platform-
  535. specific features.
  536.  
  537. The MS-Dos version documentation contains a plain text file
  538. POVMSDOS.DOC which contains its specific docs.  It can be found
  539. in the main directory where you installed POV-Ray such as
  540. C:\POVRAY3.
  541.  
  542. The Windows version documentation is available on the POV-Ray
  543. program's Help menu or press the F1 key while in the program.
  544.  
  545. The Mac platform documentation consists of a self-displaying
  546. document called "POV-Ray MacOS Read Me" which contains
  547. information specific to the Mac version of POV-Ray. It is best to
  548. read this document first, to learn how to set up and start using
  549. the Mac version of POV-Ray. This document is in the
  550. "Documentation" folder in the main "POV-Ray 3" folder.
  551.  
  552. The Amiga version documentation is made up of Html documents,
  553. stored in the same place of general POV-Ray docs; the 'root'
  554. document is "POVRAY3:POV-Reference/AmigaPOV.html" when the
  555. program is installed following the instruction given.  Amiga
  556. specific documentation and POV-Ray general docs are available
  557. pressing Help key in the POV-Gui program; this feature is
  558. available in POV-Gui since version 2.1
  559.  
  560. The Linux version documentation contains a plain text file
  561. povlinux.doc which contains its specific docs.  It can be found
  562. in the main directory where you installed POV-Ray such as
  563. /usr/povray3.
  564.  
  565. The SunOS version documentation contains a plain text file
  566. povsunos.doc which contains its specific docs.  It can be found
  567. in the main directory where you installed POV-Ray such as
  568. /usr/povray3.
  569.  
  570. The generic Unix version documentation contains a plain text file
  571. povunix.doc which contains its specific docs.  It can be found in
  572. the main directory where you installed POV-Ray such as
  573. /usr/povray3.
  574.  
  575.  
  576. 1.1  Program Description
  577. The Persistence of Vision(tm) Ray-Tracer creates three-dimensional,
  578. photo-realistic images using a rendering technique called ray-
  579. tracing. It reads in a text file containing information
  580. describing the objects and lighting in a scene and generates an
  581. image of that scene from the view point of a camera also
  582. described in the text file. Ray-tracing is not a fast process by
  583. any means, but it produces very high quality images with
  584. realistic reflections, shading, perspective and other effects.
  585.  
  586.  
  587. 1.2  What is Ray-Tracing?
  588. Ray-tracing is a rendering technique that calculates an image of
  589. a scene by simulating the way rays of light travel in the real
  590. world.  However it does its job backwards.  In the real world,
  591. rays of light are emitted from a light source and illuminate
  592. objects.  The light reflects off of the objects or passes through
  593. transparent objects.  This reflected light hits our eyes or
  594. perhaps a camera lens.  Because the vast majority of rays never
  595. hit an observer, it would take forever to trace a scene.
  596.  
  597. Ray-tracing programs like POV-Ray start with their simulated
  598. camera and trace rays backwards out into the scene.  The user
  599. specifies the location of the camera, light sources, and objects
  600. as well as the surface texture properties of objects, their
  601. interiors (if transparent) and any atmospheric media such as fog,
  602. haze, or fire.
  603.  
  604. For every pixel in the final image one or more viewing rays are
  605. shot from the camera, into the scene to see if it intersects with
  606. any of the objects in the scene. These "viewing rays" originate
  607. from the viewer, represented by the camera, and pass through the
  608. viewing window (representing the final image).
  609.  
  610. Every time an object is hit, the color of the surface at that
  611. point is calculated. For this purpose rays are sent backwards to
  612. each light source to determine the amount of light coming from
  613. the source. These "shadow rays" are tested to tell whether the
  614. surface point lies in shadow or not. If the surface is reflective
  615. or transparent new rays are set up and traced in order to
  616. determine the contribution of the reflected and refracted light
  617. to the final surface color.
  618.  
  619. Special features like inter-diffuse reflection (radiosity),
  620. atmospheric effects and area lights make it necessary to shoot a
  621. lot of additional rays into the scene for every pixel.
  622.  
  623.  
  624. 1.3  What is POV-Ray?
  625. The Persistence of Vision (tm) Ray-Tracer was developed from
  626. DKBTrace 2.12 (written by David K. Buck and Aaron A. Collins) by
  627. a bunch of people, called the POV-Team (tm), in their spare time.
  628. The headquarters of the POV-Team is on the internet at
  629. http://www.povray.org (see "Where to Find POV-Ray Files" for more
  630. details).
  631.  
  632. The POV-Ray (tm) package includes detailed instructions on using the
  633. ray-tracer and creating scenes. Many stunning scenes are included
  634. with POV-Ray so you can start creating images immediately when
  635. you get the package. These scenes can be modified so you don't
  636. have to start from scratch.
  637.  
  638. In addition to the pre-defined scenes, a large library of pre-
  639. defined shapes and materials is provided.  You can include these
  640. shapes and materials in your own scenes by just including the
  641. library file name at the top of your scene file, and by using the
  642. shape or material name in your scene.
  643.  
  644. Here are some highlights of POV-Ray's features:
  645.  
  646.   * Easy to use scene description language.
  647.   * Large library of stunning example scene files.
  648.   * Standard include files that pre-define many shapes, colors
  649.   and textures.
  650.   * Very high quality output image files (up to 48-bit color).
  651.   * 15 and 24 bit color display on many computer platforms using
  652.   appropriate hardware.
  653.   * Create landscapes using smoothed height fields.
  654.   * Many camera types, including perspective, panorama,
  655.   orthographic, fisheye, etc.
  656.   * Spotlights, cylindrical lights and area lights for
  657.   sophisticated  lighting.
  658.   * Phong and specular highlighting for more realistic-looking
  659.   surfaces.
  660.   * Inter-diffuse reflection (radiosity) for more realistic
  661.   lighting.
  662.   * Atmospheric effects like atmosphere, ground-fog and rainbow.
  663.   * Particle media to model effects like clouds, dust, fire and
  664.   steam.
  665.   * Several image file output formats including Targa, PNG and
  666.   PPM.
  667.   * Basic shape primitives such as ... spheres, boxes, quadrics,
  668.   cylinders, cones, triangles and planes.
  669.   * Advanced shape primitives such as ... Torii (donuts), bezier
  670.   patches, height fields (mountains), blobs, quartics, smooth
  671.   triangles, text, fractals, superquadrics, surfaces of
  672.   revolution, prisms, polygons, lathes and fractals.
  673.   * Shapes can easily be combined to create new complex shapes
  674.   using Constructive Solid Geometry (CSG). POV-Ray supports
  675.   unions, merges, intersections and differences.
  676.   * Objects are assigned materials called textures (a texture
  677.   describes the coloring and surface properties of a shape) and
  678.   interior properties such as index of refraction and particle
  679.   media (formerly known as "halos").
  680.   * Built-in color and normal patterns: Agate, Bozo, Bumps,
  681.   Checker, Crackle, Dents, Granite, Gradient, Hexagon, Leopard,
  682.   Mandel, Marble, Onion, Quilted, Ripples, Spotted, Spiral,
  683.   Radial, Waves, Wood, Wrinkles and image file mapping.
  684.   * Users can create their own textures or use pre-defined
  685.   textures such as ... Brass, Chrome, Copper, Gold, Silver,
  686.   Stone, Wood.
  687.   * Combine textures using layering of semi-transparent textures
  688.   or tiles of textures or material map files.
  689.   * Display preview of image while rendering (not available on
  690.   all platforms).
  691.   * Halt and save a render part way through, and continue
  692.   rendering the halted partial render later.
  693.  
  694. 1.4  How Do I Begin?
  695. POV-Ray scenes are described in a special text language called a
  696. "scene description language".  You will type commands into a
  697. plain text file and POV-Ray will read it to create the image.
  698. The process of running POV-Ray is a little different on each
  699. platform or operating system.  You should read the platform-
  700. specific documentation as suggested earlier in this introduction.
  701. It will tell you how to command POV-Ray to turn your text scene
  702. description into an image.  You should try rendering several
  703. sample images before attempting to create your own.
  704.  
  705. Once you know how to run POV-Ray on your computer and your
  706. operating system, you can proceed with the tutorial which
  707. follows.  The tutorial explains how to describe the scene using
  708. the POV-Ray language.
  709.  
  710.  
  711. 1.5  Notation and Basic Assumptions
  712. Throughout the tutorial and reference section of this document,
  713. the following notation is used to mark keywords of the scene
  714. description language, command line switches, INI file keywords
  715. and file names.
  716.      keyword       mono-spaced bold    POV-Ray keywords and
  717.                                        punctuation
  718.      +W640 +H480   mono-spaced bold    command-line switches
  719.      C:\MYFILE.PO  mono-spaced         file names,
  720.      V                                 directories, paths
  721.      SYNTAX_ITEM   italics, all caps   required syntax item
  722.      [SYNTAX_ITEM  italics, all caps,  optional syntax item
  723.      ]             braces
  724.      SYNTAX_ITEM.  italics, all caps,  one or more syntax
  725.      ..            ellipsis            items
  726.      [SYNTAX_ITEM  italics, all caps,  zero or more syntax
  727.      ...]          braces, ellipsis    items
  728.      Value_1       italics, mixed      a float value or
  729.                    case                expression
  730.      <Value_1>     italics, mixed      a vector value or
  731.                    case, angle braces  expression
  732.      [ ITEM ]      bold square braces  ITEM enclosed in
  733.                                        required braces
  734.      ITEM1   |     vertical bar        choice of ITEM1 or
  735.      ITEM2                             ITEM2
  736.  
  737.  
  738. In the plain ASCII version of the document there is no visible
  739. difference between the different notations.
  740.  
  741. Note that POV-Ray is a command-line program on MS-Dos, Unix and
  742. other text-based operating system and is menu-driven on Windows
  743. and Macintosh platforms.  Some of these operating systems use
  744. folders to store files while others use directories.  Some
  745. separate the folders and sub-folders with a slash character (/),
  746. back-slash character (\), or others.  We have tried to make this
  747. documentation as generic as possible but sometimes we have to
  748. refer to folders, files, options etc. and there's no way to
  749. escape it. Here are some assumptions we make...
  750.  
  751. 1) You installed POV-Ray in the "C:\POVRAY3" directory.  For MS-
  752. Dos this is probably true but for Unix it might be
  753. "/usr/povray3", or for Windows it might be "C:\Program Files\POV-
  754. Ray for Windows", for Mac it might be "MyHD:Apps:POV-Ray 3:", or
  755. you may have used some other drive or directory.  So if we tell
  756. you that "Include files are stored in the \povray3\include
  757. directory,"  we assume you can translate that to something like
  758. "::POVRAY3:INCLUDE" or "C:\Program Files\POV-Ray for
  759. Windows\include" or whatever is appropriate for your platform,
  760. operating system and installation.
  761.  
  762. 2) POV-Ray uses command-line switches and INI files to choose
  763. options in all versions but Windows and Mac also use dialog boxes
  764. or menu choices to set options.  We will describe options
  765. assuming you are using switches or INI files when describing what
  766. the options do. We have taken care to use the same terminology in
  767. designing menus and dialogs as we use in describing switches or
  768. INI keywords. See your version-specific documentation on menu and
  769. dialogs.
  770.  
  771. 3) Some of you are reading this using a help-reader, built-in
  772. help, web-browser, formatted printout, or plain text file.  We
  773. assume you know how to get around in which ever medium you're
  774. using.  We'll say "See the chapter on "Setting POV-Ray Option" we
  775. assume you can click, scroll, browse, flip pages or whatever to
  776. get there.
  777.  
  778.  
  779. 1.6  What's New in POV-Ray 3.1?
  780. Here is an overview of what is new in POV-Ray 3.1 since version
  781. 3.0.
  782.  
  783.  
  784. 1.6.1     Media Replaces Halo & Atmosphere
  785. The keywords halo and atmosphere have been totally eliminated
  786. with no backwards compatibility of any kind provided. They have
  787. been replaced by a new feature called media.  At the scene level,
  788. media acts as atmospheric media for fog, haze, dust, etc.  On
  789. objects, media is not part of texture like halo was. Object media
  790. is now part of a new feature called interior.  Media is not just
  791. a rename for halo.  It is a new model with some similar features
  792. of halo.  BECAUSE POV-Ray 3.1 DISCONTINUES SOME 3.0 FEATURES YOU
  793. MAY WISH TO KEEP 3.0 TO RENDER OLDER SCENES.
  794.  
  795. Any pattern type (bozo, wood, dents, etc.) may be used as a
  796. density function for media.
  797.  
  798. New patterns spherical, cylindrical, planar, and boxed added for
  799. pigment, normal, texture, and density.
  800.  
  801. New wave types cubic_wave and poly_wave Float have been added.
  802.  
  803. New object modifier interior{...}.  Interior contains information
  804. about the interior of the object which was formerly contained in
  805. the finish and halo parts of a texture. Interior items are no
  806. longer part of the texture.  Instead, they attach directly to the
  807. objects. The finish items moved are ior, caustic, fade_power, and
  808. fade_distance.  The refraction keyword is no longer necessary.
  809. Any ior other than 1.0 turns on refraction.  These 5 finish
  810. keywords which are now part of interior will still work in finish
  811. but will generate warnings.  Some obscure texture_map statements
  812. with varying ior will not work.
  813.  
  814. Added reflection_exponent Float to finish to give more realistic
  815. reflection of very bright objects.
  816.  
  817.  
  818. 1.6.2     New #macro Feature
  819. Add fully recursive and parameterized #macro directive.  Define
  820. like this...
  821.  
  822.   #macro MyMacro (P1,P2,P3)   ...  #end
  823. Invoke like this...
  824.  
  825.   MyMacro (5,x*5,MyTexture)
  826. Note no '#' sign precedes invocation.  Macros can be invoked
  827. almost anywhere. Parameters must be identifiers or any item that
  828. can be declared, MyMacro(pigment{Green},MyObject) for example.
  829.  
  830. Added #local IDENTIFIER= STATEMENT as alternative to #declare to
  831. create temporary local identifier in macros or include files.
  832.  
  833.  
  834. 1.6.3     Arrays Added
  835. Added multi-dimension arrays
  836.  
  837.   #declare MyArray=array[20]
  838.  or
  839.  
  840.   #local PrivateArray=array[30]
  841.  or
  842.  
  843.   #declare Rows=5; #declare Cols=4;
  844.   #declare Table=array[Rows][Cols]
  845. Added optional initializer syntax for arrays.
  846.  
  847.  #declare MyArray=array[2][3]{{1,2,3},{4,5,6}}
  848. Subscripts start at 0.  Anything that can be declared may be in
  849. an array. Arrays are initialized as null.  You must later fill
  850. each element with values.
  851.  
  852. Added float functions for arrays.  Given #declare MyArray =
  853. array[4][5] then dimensions(MyArray) is 2 and
  854. dimension_size(MyArray,2) is 5.
  855.  
  856.  
  857. 1.6.4     File I/O and other Directives
  858. Added #fopen, #fclose, #read, and #write directives for user text
  859. files.
  860.  
  861. Added #undef identifier directive.  Un-declares previously
  862. declared identifier.  Works on locals or globals.
  863.  
  864. Added requirement that any directive which can end in a float or
  865. expression must be terminated by a semi-colon.  Specifically this
  866. means any #declare or #local of float, vector or color or the
  867. #version directive.
  868.  
  869.  
  870. 1.6.5     Additional New Features
  871. Added Bezier splines to lathe and prism. The spline is made of
  872. segments having four points each. Thus there are always four
  873. times the number of  segments in a prism or lathe. A four point
  874. Bezier spline uses 3rd order Bernstein blending functions which
  875. are sufficient for smooth curves.
  876.  
  877. Added float constant clock_delta returns time between frames.
  878.  
  879.  
  880.  
  881.  
  882. 2.0    Beginning Tutorial
  883. The beginning tutorial explains step by step how to use POV-Ray's
  884. scene description language to create own your scenes. The use of
  885. almost every feature of POV-Ray's language is explained in
  886. detail. We will learn basic things like placing cameras and light
  887. sources. We will also learn how to create a large variety of
  888. objects and how to assign different textures to them. The more
  889. sophisticated features like radiosity, interior, media and
  890. atmospheric effects will be explained in detail.
  891.  
  892.  
  893. 2.1  Our First Image
  894. We will create the scene file for a simple picture. Since ray-
  895. tracers thrive on spheres, that is what we will render first.
  896.  
  897.  
  898. 2.1.1     Understanding POV-Ray's Coordinate System
  899. First, we have to tell POV-Ray where our camera is and where it
  900. is looking. To do this, we use 3D coordinates. The usual
  901. coordinate system for POV-Ray has the positive y-axis pointing
  902. up, the positive x-axis pointing to the right, and the positive z-
  903. axis pointing into the screen as follows:
  904.  
  905.  
  906.  
  907.  The left-handed coordinate system (the z-axis is pointing away)
  908.                                 
  909. This kind of coordinate system is called a left-handed coordinate
  910. system. If we use our left hand's fingers we can easily see why
  911. it is called left-handed. We just point our thumb in the
  912. direction of the positive x-axis (to the right), the index finger
  913. in the direction of the positive y-axis (straight up) and the
  914. middle finger in the positive z-axis direction (forward). We can
  915. only do this with our left hand. If we had used our right hand we
  916. would not have been able to point the middle finger in the
  917. correct direction.
  918.  
  919. The left hand can also be used to determine rotation directions.
  920. To do this we must perform the famous "Computer Graphics
  921. Aerobics" exercise. We hold up our left hand and point our thumb
  922. in the positive direction of the axis of rotation. Our fingers
  923. will curl in the positive direction of rotation. Similarly if we
  924. point our thumb in the negative direction of the axis our fingers
  925. will curl in the negative direction of rotation.
  926.  
  927.  
  928.  
  929. "Computer Graphics Aerobics" to determine the rotation direction.
  930.                                 
  931. In the above illustration, the left hand is curling around the x-
  932. axis. The thumb points in the positive x direction and the
  933. fingers curl over in the positive rotation direction.
  934.  
  935. If we want to use a right-handed system, as some CAD systems and
  936. modelers do, the right vector in the camera specification needs
  937. to be changed. See the detailed description in "Handedness". In a
  938. right-handed system we use our right hand for the "Aerobics".
  939.  
  940. There is some controversy over whether POV-Ray's method of doing
  941. a right-handed system is really proper. To avoid problems we
  942. stick with the left-handed system which is not in dispute.
  943.  
  944.  
  945. 2.1.2     Adding Standard Include Files
  946. Using our personal favorite text editor, we create a file called
  947. demo.pov. Note some versions of POV-Ray come with their own built-
  948. in text editor which may be easier to use. We then type in the
  949. following text. The input is case sensitive, so we have to be
  950. sure to get capital and lowercase letters correct.
  951.  
  952.   #include "colors.inc"    // The include files contain
  953.   #include "stones.inc"    // pre-defined scene elements
  954. The first include statement reads in definitions for various
  955. useful colors. The second include statement reads in a collection
  956. of stone textures.
  957.  
  958. POV-Ray comes with many standard include files.  Others of
  959. interest are:
  960.  
  961.   #include "textures.inc"    // pre-defined scene elements
  962.   #include "shapes.inc"
  963.   #include "glass.inc"
  964.   #include "metals.inc"
  965.   #include "woods.inc"
  966. They read pre-defined textures, shapes, glass, metal, and wood
  967. textures. It is a good idea to have a look through them to see a
  968. few of the many possible shapes and textures available.
  969.  
  970. We should only include files we really need in our scene. Some of
  971. the include files coming with POV-Ray are quite large and we
  972. should better save the parsing time and memory if we don't need
  973. them. In the following examples we will only use the colors.inc,
  974. and stones.inc include files.
  975.  
  976. We may have as many include files as needed in a scene file.
  977. Include files may themselves contain include files, but we are
  978. limited to declaring includes nested only ten levels deep.
  979.  
  980. Filenames specified in the include statements will be searched
  981. for in the current directory first. If it fails to find your .Inc
  982. files in the current directory, POV-Ray searches any "library
  983. paths" that you have specified.  Library paths are options set by
  984. the +L command-line switch or Library_Path option. See the
  985. chapter "Setting POV-Ray Options" for more information on library
  986. paths.
  987.  
  988. Because it is more useful to keep include files in a separate
  989. directory, standard installation of POV-Ray place these files in
  990. the \povray3\include directory.  If you get an error message
  991. saying that POV-Ray cannot open "colors.inc" or other include
  992. files, make sure that you specify the library path properly.
  993.  
  994.  
  995. 2.1.3     Adding a Camera
  996. The camera statement describes where and how the camera sees the
  997. scene. It gives x-, y- and z-coordinates to indicate the position
  998. of the camera and what part of the scene it is pointing at.  We
  999. describe the coordinates using a three-part vector. A vector is
  1000. specified by putting three numeric values between a pair of angle
  1001. brackets and separating the values with commas.
  1002.  
  1003. We add the following camera statement to the scene.
  1004.  
  1005.   camera {
  1006.     location <0, 2, -3>
  1007.     look_at  <0, 1,  2>
  1008.   }
  1009. Briefly, location <0,2,-3> places the camera up two units and
  1010. back three units from the center of the ray-tracing universe
  1011. which is at <0,0,0>. By default +z is into the screen and -z is
  1012. back out of the screen.
  1013.  
  1014. Also look_at <0,1,2> rotates the camera to point at the
  1015. coordinates <0,1,2>. A point 1 unit up from the origin and 2
  1016. units away from the origin.  This makes it 5 units in front of
  1017. and 1 unit lower than the camera. The look_at point should be the
  1018. center of attention of our image.
  1019.  
  1020.  
  1021. 2.1.4     Describing an Object
  1022. Now that the camera is set up to record the scene, let's place a
  1023. yellow sphere into the scene. We add the following to our scene
  1024. file:
  1025.  
  1026.   sphere {
  1027.     <0, 1, 2>, 2
  1028.     texture {
  1029.       pigment { color Yellow }
  1030.     }
  1031.   }
  1032. The first vector specifies the center of the sphere. In this
  1033. example the x coordinate is zero so it is centered left and
  1034. right. It is also at y=1 or one unit up from the origin. The z
  1035. coordinate is 2 which is five units in front of the camera, which
  1036. is at z=-3. After the center vector is a comma followed by the
  1037. radius which in this case is two units. Since the radius is half
  1038. the width of a sphere, the sphere is four units wide.
  1039.  
  1040.  
  1041. 2.1.5     Adding Texture to an Object
  1042. After we have defined the location and size of the sphere, we
  1043. need to describe the appearance of the surface. The texture
  1044. statement specifies these parameters. Texture blocks describe the
  1045. color, bumpiness and finish properties of an object. In this
  1046. example we will specify the color only. This is the minimum we
  1047. must do. All other texture options except color will use default
  1048. values.
  1049.  
  1050. The color we define is the way we want an object to look if fully
  1051. illuminated. If we were painting a picture of a sphere we would
  1052. use dark shades of a color to indicate the shadowed side and
  1053. bright shades on the illuminated side. However ray-tracing takes
  1054. care of that for you. We only need to pick the basic color
  1055. inherent in the object and POV-Ray brightens or darkens it
  1056. depending on the lighting in the scene. Because we are defining
  1057. the basic color the object actually has rather than how it looks
  1058. the parameter is called pigment.
  1059.  
  1060. Many types of color patterns are available for use in a pigment
  1061. statement. The keyword color specifies that the whole object is
  1062. to be one solid color rather than some pattern of colors. We can
  1063. use one of the color identifiers previously defined in the
  1064. standard include file colors.inc.
  1065.  
  1066. If no standard color is available for our needs, we may define
  1067. our own color by using the color keyword followed by red, green,
  1068. and blue keywords specifying the amount of red, green and blue to
  1069. be mixed. For example a nice shade of pink can be specified by:
  1070.  
  1071.   color red 1.0 green 0.8 blue 0.8
  1072. The values after each keyword should be in the range from 0.0 to
  1073. 2.0. Any of the three components not specified will default to 0.
  1074. A shortcut notation may also be used. The following produces the
  1075. same shade of pink:
  1076.  
  1077.   color rgb <1.0, 0.8, 0.8>
  1078. Colors are explained in more detail in section "Specifying
  1079. Colors".
  1080.  
  1081.  
  1082. 2.1.6     Defining a Light Source
  1083. One more detail is needed for our scene. We need a light source.
  1084. Until we create one, there is no light in this virtual world.
  1085. Thus we add the line
  1086.  
  1087. Thus we add the line
  1088.  
  1089.   light_source { <2, 4, -3> color White}
  1090. to the scene file to get our first complete POV-Ray scene file as
  1091. shown below.
  1092.  
  1093.   #include "colors.inc"
  1094.   background { color Cyan }
  1095.   camera {
  1096.     location <0, 2, -3>
  1097.     look_at  <0, 1,  2>
  1098.   }
  1099.   sphere {
  1100.     <0, 1, 2>, 2
  1101.     texture {
  1102.       pigment { color Yellow }
  1103.     }
  1104.   }
  1105.   light_source { <2, 4, -3> color White}
  1106. The vector in the light_source statement specifies the location
  1107. of the light as two units to our right, four units above the
  1108. origin and three units back from the origin. The light source is
  1109. an invisible tiny point that emits light.  It has no physical
  1110. shape, so no texture is needed.
  1111.  
  1112. That's it! We close the file and render a small picture of it
  1113. using whatever methods you used for your particular platform.  If
  1114. you specified a preview display it will appear on your screen.
  1115. If you specified an output file (the default is file output on),
  1116. then POV-Ray also created a file.  Note that if you do not have
  1117. high color or true color display hardware then the preview image
  1118. may look poor but the full detail is written to the image file
  1119. regardless of the type of display.
  1120.  
  1121. The scene we just traced isn't quite state of the art but we will
  1122. have to start with the basics before we soon get to much more
  1123. fascinating features and scenes.
  1124.  
  1125.  
  1126. 2.2  Simple Shapes
  1127. So far we have just used the sphere shape. There are many other
  1128. types of shapes that can be rendered by POV-Ray. The following
  1129. sections will describe how to use some of the more simple objects
  1130. as a replacement for the sphere used above.
  1131.  
  1132.  
  1133. 2.2.1     Box Object
  1134. The box is one of the most common objects used. We try this
  1135. example in place of the sphere:
  1136.  
  1137.   box {
  1138.     <-1, 0,   -1>,  // Near lower left corner
  1139.     < 1, 0.5,  3>   // Far upper right corner
  1140.     texture {
  1141.       T_Stone25     // Pre-defined from stones.inc
  1142.       scale 4       // Scale by the same amount in all
  1143.                     // directions
  1144.     }
  1145.     rotate y*20     // Equivalent to "rotate <0,20,0>"
  1146.   }
  1147. In the example we can see that a box is defined by specifying the
  1148. 3D coordinates of its opposite corners. The first vector is
  1149. generally  the minimum x-, y- and z-coordinates and the 2nd
  1150. vector should be the maximum x-, y- and z-values however any two
  1151. opposite corners may be used. Box objects can only be defined
  1152. parallel to the axes of the world coordinate system. We can later
  1153. rotate them to any angle. Note that we can perform simple math on
  1154. values and vectors. In the rotate parameter we multiplied the
  1155. vector identifier y by 20. This is the same as <0,1,0>*20 or
  1156. <0,20,0>.
  1157.  
  1158.  
  1159. 2.2.2     Cone Object
  1160. Here's another example showing how to use a cone:
  1161.  
  1162.   cone {
  1163.     <0, 1, 0>, 0.3    // Center and radius of one end
  1164.     <1, 2, 3>, 1.0    // Center and radius of other end
  1165.     texture { T_Stone25 scale 4 }
  1166.   }
  1167. The cone shape is defined by the center and radius of each end.
  1168. In this example one end is at location <0,1,0> and has a radius
  1169. of 0.3 while the other end is centered at <1,2,3> with a radius
  1170. of 1. If we want the cone to come to a sharp point we must use
  1171. radius=0. The solid end caps are parallel to each other and
  1172. perpendicular to the cone axis. If we want an open cone with no
  1173. end caps we have to add the keyword open after the 2nd radius
  1174. like this:
  1175.  
  1176.   cone {
  1177.     <0, 1, 0>, 0.3    // Center and radius of one end
  1178.     <1, 2, 3>, 1.0    // Center and radius of other end
  1179.     open              // Removes end caps
  1180.     texture { T_Stone25 scale 4 }
  1181.   }
  1182.  
  1183. 2.2.3     Cylinder Object
  1184. We may also define a cylinder like this:
  1185.  
  1186.   cylinder {
  1187.     <0, 1, 0>,     // Center of one end
  1188.     <1, 2, 3>,     // Center of other end
  1189.     0.5            // Radius
  1190.     open           // Remove end caps
  1191.     texture { T_Stone25 scale 4 }
  1192.   }
  1193.  
  1194. 2.2.4     Plane Object
  1195. Let's try out a computer graphics standard "The Checkered Floor".
  1196. We add the following object to the first version of the demo.pov
  1197. file, the one including the sphere.
  1198.  
  1199.   plane { <0, 1, 0>, -1
  1200.     pigment {
  1201.       checker color Red, color Blue
  1202.     }
  1203.   }
  1204. The object defined here is an infinite plane. The vector <0,1,0>
  1205. is the surface normal of the plane (i.e. if we were standing on
  1206. the surface, the normal points straight up). The number afterward
  1207. is the distance that the plane is displaced along the normal from
  1208. the origin -- in this case, the floor is placed at y=-1 so that
  1209. the sphere at y=1, radius=2, is resting on it.
  1210.  
  1211. We note that even though there is no texture statement there is
  1212. an implied texture here. We might find that continually typing
  1213. statements that are nested like texture {pigment} can get to be
  1214. tiresome so POV-Ray let's us leave out the texture statement
  1215. under many circumstances. In general we only need the texture
  1216. block surrounding a texture identifier (like the T_Stone25
  1217. example above), or when creating layered textures (which are
  1218. covered later).
  1219.  
  1220. This pigment uses the checker color pattern and specifies that
  1221. the two colors red and blue should be used.
  1222.  
  1223. Because the vectors <1,0,0>, <0,1,0> and <0,0,1> are used
  1224. frequently, POV-Ray has three built-in vector identifiers x, y
  1225. and z respectively that can be used as a shorthand. Thus the
  1226. plane could be defined as:
  1227.  
  1228.   plane { y, -1
  1229.     pigment { ... }
  1230.   }
  1231. Note that we do not use angle brackets around vector identifiers.
  1232.  
  1233. Looking at the floor, we notice that the ball casts a shadow on
  1234. the floor. Shadows are calculated very accurately by the ray-
  1235. tracer, which creates precise, sharp shadows. In the real world,
  1236. penumbral or "soft" shadows are often seen. Later we will learn
  1237. how to use extended light sources to soften the shadows.
  1238.  
  1239.  
  1240. 2.3  CSG Objects
  1241. Constructive Solid Geometry, or CSG, is a powerful tool to
  1242. combine primitive objects to create more complex objects as shown
  1243. in the following sections.
  1244.  
  1245.  
  1246. 2.3.1     What is CSG?
  1247. CSG stands for Constructive Solid Geometry. POV-Ray allows us to
  1248. construct complex solids by combining primitive shapes in four
  1249. different ways. In the union statement, two or more shapes are
  1250. added together. With the intersection statement, two or more
  1251. shapes are combined to make a new shape that consists of the area
  1252. common to both shapes. The difference statement, an initial shape
  1253. has all subsequent shapes subtracted from it. And last not least
  1254. merge, which is like a union where the surfaces inside the union
  1255. are removed (useful in transparent CSG objects). We will deal
  1256. with each of these in detail in the next few sections.
  1257.  
  1258. CSG objects can be extremely complex. They can be deeply nested.
  1259. In other words there can be unions of differences or
  1260. intersections of merges or differences of intersections or even
  1261. unions of intersections of differences of merges... ad infinitum.
  1262. CSG objects are (almost always) finite objects and thus respond
  1263. to auto-bounding and can be transformed like any other POV
  1264. primitive shape.
  1265.  
  1266.  
  1267. 2.3.2     CSG Union
  1268. Let's try making a simple union. Create a file called csgdemo.pov
  1269. and edit it as follows:
  1270.  
  1271.   #include "colors.inc"
  1272.   camera {
  1273.     location <0, 1, -10>
  1274.     look_at 0
  1275.     angle 36
  1276.   }
  1277.   light_source { <500, 500, -1000> White }
  1278.   plane { y, -1.5
  1279.     pigment { checker Green White }
  1280.   }
  1281. Let's add two spheres each translated 0.5 units along the x-axis
  1282. in each direction. We color one blue and the other red.
  1283.  
  1284.   sphere { <0, 0, 0>, 1
  1285.     pigment { Blue }
  1286.     translate -0.5*x
  1287.   }
  1288.   sphere { <0, 0, 0>, 1
  1289.     pigment { Red }
  1290.     translate 0.5*x
  1291.   }
  1292. We trace this file and note the results. Now we place a union
  1293. block around the two spheres. This will create a single CSG union
  1294. out of the two objects.
  1295.  
  1296.   union{
  1297.     sphere { <0, 0, 0>, 1
  1298.       pigment { Blue }
  1299.       translate -0.5*x
  1300.     }
  1301.     sphere { <0, 0, 0>, 1
  1302.       pigment { Red }
  1303.       translate 0.5*x
  1304.     }
  1305.   }
  1306. We trace the file again. The union will appear no different from
  1307. what each sphere looked like on its own, but now we can give the
  1308. entire union a single texture and transform it as a whole. Let's
  1309. do that now.
  1310.  
  1311.   union{
  1312.     sphere { <0, 0, 0>, 1
  1313.       translate -0.5*x
  1314.     }
  1315.     sphere { <0, 0, 0>, 1
  1316.       translate 0.5*x
  1317.     }
  1318.     pigment { Red }
  1319.     scale <1, .25, 1>
  1320.     rotate <30, 0, 45>
  1321.   }
  1322. We trace the file again. As we can see, the object has changed
  1323. dramatically. We experiment with different values of scale and
  1324. rotate and try some different textures.
  1325.  
  1326. There are many advantages of assigning only one texture to a CSG
  1327. object instead of assigning the texture to each individual
  1328. component. First, it is much easier to use one texture if our CSG
  1329. object has a lot of components because changing the objects
  1330. appearance involves changing only one single texture. Second, the
  1331. file parses faster because the texture has to be parsed only
  1332. once. This may be a great factor when doing large scenes or
  1333. animations. Third, using only one texture saves memory because
  1334. the texture is only stored once and referenced by all components
  1335. of the CSG object. Assigning the texture to all n components
  1336. means that it is stored n times.
  1337.  
  1338.  
  1339. 2.3.3     CSG Intersection
  1340. Now let's use these same spheres to illustrate the next kind of
  1341. CSG object, the intersection. We change the word union to
  1342. intersection and delete the scale and rotate statements:
  1343.  
  1344.   intersection {
  1345.     sphere { <0, 0, 0>, 1
  1346.       translate -0.5*x
  1347.     }
  1348.     sphere { <0, 0, 0>, 1
  1349.       translate 0.5*x
  1350.     }
  1351.     pigment { Red }
  1352.   }
  1353. We trace the file and will see a lens-shaped object instead of
  1354. the two spheres. This is because an intersection consists of the
  1355. area shared by both shapes, in this case the lens-shaped area
  1356. where the two spheres overlap. We like this lens-shaped object so
  1357. we will use it to demonstrate differences.
  1358.  
  1359.  
  1360. 2.3.4     CSG Difference
  1361. We rotate the lens-shaped intersection about the y-axis so that
  1362. the broad side is facing the camera.
  1363.  
  1364.   intersection{
  1365.     sphere { <0, 0, 0>, 1
  1366.       translate -0.5*x
  1367.     }
  1368.     sphere { <0, 0, 0>, 1
  1369.       translate 0.5*x
  1370.     }
  1371.     pigment { Red }
  1372.     rotate 90*y
  1373.   }
  1374. Let's create a cylinder and stick it right in the middle of the
  1375. lens.
  1376.  
  1377.   cylinder { <0, 0, -1> <0, 0, 1>, .35
  1378.     pigment { Blue }
  1379.   }
  1380. We render the scene to see the position of the cylinder. We will
  1381. place a difference block around both the lens-shaped intersection
  1382. and the cylinder like this:
  1383.  
  1384.   difference {
  1385.     intersection {
  1386.       sphere { <0, 0, 0>, 1
  1387.         translate -0.5*x
  1388.       }
  1389.       sphere { <0, 0, 0>, 1
  1390.         translate 0.5*x
  1391.       }
  1392.       pigment { Red }
  1393.       rotate 90*y
  1394.     }
  1395.     cylinder { <0, 0, -1> <0, 0, 1>, .35
  1396.       pigment { Blue }
  1397.     }
  1398.   }
  1399. We render the file again and see the lens-shaped intersection
  1400. with a neat hole in the middle of it where the cylinder was. The
  1401. cylinder has been subtracted from the intersection. Note that the
  1402. pigment of the cylinder causes the surface of the hole to be
  1403. colored blue. If we eliminate this pigment the surface of the
  1404. hole will be red.
  1405.  
  1406. OK, let's get a little wilder now. Let's declare our perforated
  1407. lens object to give it a name. Let's also eliminate all textures
  1408. in the declared object because we will want them to be in the
  1409. final union instead.
  1410.  
  1411.   #declare Lens_With_Hole = difference {
  1412.     intersection {
  1413.       sphere { <0, 0, 0>, 1
  1414.         translate -0.5*x
  1415.       }
  1416.       sphere { <0, 0, 0>, 1
  1417.         translate 0.5*x
  1418.       }
  1419.       rotate 90*y
  1420.     }
  1421.     cylinder { <0, 0, -1> <0, 0, 1>, .35 }
  1422.   }
  1423. Let's use a union to build a complex shape composed of copies of
  1424. this object.
  1425.  
  1426.   union {
  1427.     object { Lens_With_Hole translate <-.65, .65, 0> }
  1428.     object { Lens_With_Hole translate <.65, .65, 0> }
  1429.     object { Lens_With_Hole translate <-.65, -.65, 0> }
  1430.     object { Lens_With_Hole translate <.65, -.65, 0> }
  1431.     pigment { Red }
  1432.   }
  1433. We render the scene. An interesting object to be sure. But let's
  1434. try something more. Let's make it a partially-transparent object
  1435. by adding some filter to the pigment block.
  1436.  
  1437.   union {
  1438.     object { Lens_With_Hole translate <-.65, .65, 0> }
  1439.     object { Lens_With_Hole translate <.65, .65, 0> }
  1440.     object { Lens_With_Hole translate <-.65, -.65, 0> }
  1441.     object { Lens_With_Hole translate <.65, -.65, 0> }
  1442.     pigment { Red filter .5 }
  1443.   }
  1444. We render the file again. This looks pretty good... only... we
  1445. can see parts of each of the lens objects inside the union! This
  1446. is not good.
  1447.  
  1448.  
  1449. 2.3.5     CSG Merge
  1450. This brings us to the fourth kind of CSG object, the merge.
  1451. Merges are the same as unions, but the geometry of the objects in
  1452. the CSG that is inside the merge is not traced. This should
  1453. eliminate the problem with our object. Let's try it.
  1454.  
  1455.   merge {
  1456.     object { Lens_With_Hole translate <-.65, .65, 0> }
  1457.     object { Lens_With_Hole translate <.65, .65, 0> }
  1458.     object { Lens_With_Hole translate <-.65, -.65, 0> }
  1459.     object { Lens_With_Hole translate <.65, -.65, 0> }
  1460.     pigment { Red filter .5 }
  1461.   }
  1462. Sure enough, it does!
  1463.  
  1464.  
  1465. 2.3.6     CSG Pitfalls
  1466. There is a severe pitfall in the CSG code that we have to be
  1467. aware of.
  1468.  
  1469.  
  1470. 2.3.6.1   Coincidence Surfaces
  1471. POV-Ray uses inside/outside tests to determine the points at
  1472. which a ray intersects a CSG object. A problem arises when the
  1473. surfaces of two different shapes coincide because there is no way
  1474. (due to numerical problems) to tell whether a point on the
  1475. coincident surface belongs to one shape or the other.
  1476.  
  1477. Look at the following example where a cylinder is used to cut a
  1478. hole in a larger box.
  1479.  
  1480.   difference {
  1481.     box { -1, 1 pigment { Red } }
  1482.     cylinder { -z, z, 0.5 pigment { Green } }
  1483.   }
  1484. Note that the vectors -1 and 1 in the box definition expand to <-
  1485. 1,-1,-1> and <1,1,1> respectively.
  1486.  
  1487. If we trace this object we see red speckles where the hole is
  1488. supposed to be. This is caused by the coincident surfaces of the
  1489. cylinder and the box. One time the cylinder's surface is hit
  1490. first by a viewing ray, resulting in the correct rendering of the
  1491. hole, and another time the box is hit first, leading to a wrong
  1492. result where the hole vanishes and red speckles appear.
  1493.  
  1494. This problem can be avoided by increasing the size of the
  1495. cylinder to get rid of the coincidence surfaces. This is done by:
  1496.  
  1497.   difference {
  1498.     box { -1, 1 pigment { Red } }
  1499.     cylinder { -1.001*z, 1.001*z, 0.5 pigment { Green } }
  1500.   }
  1501. In general we have to make the subtracted object a little bit
  1502. larger in a CSG difference. We just have to look for coincident
  1503. surfaces and increase the subtracted object appropriately to get
  1504. rid of those surfaces.
  1505.  
  1506. The same problem occurs in CSG intersections and is also avoided
  1507. by scaling some of the involved objects.
  1508.  
  1509.  
  1510. 2.4  Advanced Shapes
  1511. After we have gained some experience with the simpler shapes
  1512. available in POV-Ray it is time to go on to the more advanced,
  1513. thrilling shapes.
  1514.  
  1515. We should be aware that the shapes described below are not
  1516. trivial to understand. We needn't be worried though if we do not
  1517. know how to use them or how they work. We just try the examples
  1518. and play with the features described in the reference chapter.
  1519. There is nothing better than learning by doing.
  1520.  
  1521. You may wish to skip to the chapter "Simple Texture Options"
  1522. before proceeding with these advanced shapes.
  1523.  
  1524.  
  1525. 2.4.1     Bicubic Patch Object
  1526. Bicubic or Bezier patches are useful surface representations
  1527. because they allow an easy definition of surfaces using only a
  1528. few control points. The control points serve to determine the
  1529. shape of the patch. Instead of defining the vertices of
  1530. triangles, we simply give the coordinates of the control points.
  1531. A single patch has 16 control points, one at each corner, and the
  1532. rest positioned to divide the patch into smaller sections. For
  1533. ray-tracing (or rendering) the patches are approximated using
  1534. triangles.
  1535.  
  1536. Bezier patches are almost always created using a third party
  1537. modeler so for this tutorial, we will use moray (any other
  1538. modeler that supports Bezier patches and POV-Ray can also be
  1539. used).  We will use moray only to create the patch itself, not
  1540. the other elements of the scene.
  1541.  
  1542. Note that moray is not included with POV-Ray.  It is a separate
  1543. shareware program that currently only runs on MS-Dos and Win95/NT
  1544. but this tutorial assumes you are using the MS-Dos version.  If
  1545. you do not have moray or are not on MS-Dos, you can still render
  1546. the sample scene described below, even though you cannot see how
  1547. moray created it. Simply type in the bicubic_patch declaration
  1548. listed below.
  1549.  
  1550. Bezier patches are actually very useful and, with a little
  1551. practice, some pretty amazing things can be created with them.
  1552. For our first tutorial, let's make a sort of a teepee/tent shape
  1553. using a single sheet patch.
  1554.  
  1555. First, we start moray and, from the main edit screen, we click on
  1556. "CREATE". We Name our object Teepee. The "CREATE BEZIER PATCH"
  1557. dialogue box will appear. We have to make sure that "SHEET" is
  1558. depressed. We click on "OK, CREATE". At the bottom of the main
  1559. edit screen, we click on "EXTENDED EDIT".
  1560.  
  1561. We hold the cursor over the "TOP" view and right click to make
  1562. the pop-up menu appear. We click on "MAXIMIZE". We [ALT]-drag to
  1563. zoom in a little. We click on "MARK ALL", and under the
  1564. transformation mode box, "UFRM SCL". We drag the mouse to scale
  1565. the patch until it is approximately four units wide. We click on
  1566. "TRANSLATE", and move the patch so that its center is over the
  1567. origin. We right click "MINIMIZE" and "UNMARK ALL".
  1568.  
  1569. We [SHIFT]-drag a box around the lower right control point to
  1570. mark it. We [ALT]-zoom into the "FRONT" view so that we can see
  1571. the patch better.  In the "FRONT" view, we "TRANSLATE" that point
  1572. 10 units along the negative z-axis (we note that in MORAY z is
  1573. up). We "UNMARK ALL". We repeat this procedure for each of the
  1574. other three corner points. We make sure we remember to "UNMARK
  1575. ALL" once each point has been translated. We should have a shape
  1576. that looks as though it is standing on four pointed legs. We
  1577. "UNMARK ALL".
  1578.  
  1579. Working once again in the "TOP" view, we [SHIFT]-drag a box
  1580. around the four center control points to mark them. We right-
  1581. click over the "TOP" view and "MAXIMIZE". We click on "UFRM SCL"
  1582. and drag the mouse to scale the four points close together. We
  1583. [ALT]-drag to zoom closer and get them as close together as we
  1584. can. We [ALT]-drag to zoom out, right click and "MINIMIZE".
  1585.  
  1586. In the "FRONT" view, we "TRANSLATE" the marked points 10 units
  1587. along the positive z-axis. We "UNMARK ALL". The resulting shape
  1588. is quite interesting, was simple to model, and could not be
  1589. produced using CSG primitives. Now let's use it in a scene.
  1590.  
  1591. We click on "DONE" to return to the main edit screen. We note
  1592. that u_steps and v_steps are both set to 3 and flatness is set to
  1593. 0.01. We leave them alone for now. We click on "FILES" and then
  1594. "SAVE SEL" (save selection). We name our new file teepee1.mdl. We
  1595. press [F3] and open teepee1.mdl. There is no need to save the
  1596. original file. When teepee1 is open, we create a quick "dummy"
  1597. texture (moray will not allow us to export data without a
  1598. texture). We use white with default finish and name it TeePeeTex.
  1599. We apply it to the object, save the file and press [CTRL-F9].
  1600. moray will create two files: teepee1.inc and teepee1.pov.
  1601.  
  1602. We exit moray and copy teepee1.inc and teepee1.pov into our
  1603. working directory where we are doing these tutorials.  We create
  1604. a new file called bezdemo.pov and edit it as follows:
  1605.  
  1606.   #include "colors.inc"
  1607.   camera {
  1608.     location <0, .1, -60>
  1609.     look_at 0
  1610.     angle 40
  1611.   }
  1612.   background { color Gray25 }  //to make the patch easier to see
  1613.   light_source { <300, 300, -700> White }
  1614.   plane { y, -12
  1615.     texture {
  1616.       pigment {
  1617.         checker
  1618.         color Green
  1619.         color Yellow
  1620.       }
  1621.     }
  1622.   }
  1623. Using a text editor, we create and declare a simple texture for
  1624. our teepee object:
  1625.  
  1626.   #declare TeePeeTex = texture {
  1627.     pigment {
  1628.       color rgb <1, 1, 1,>
  1629.     }
  1630.     finish {
  1631.       ambient .2
  1632.       diffuse .6
  1633.     }
  1634.   }
  1635. We paste in the bezier patch data from teepee1.pov (the
  1636. additional object keywords added by moray were removed):
  1637.  
  1638.   bicubic_patch {
  1639.     type 1 flatness 0.0100 u_steps 3 v_steps 3,
  1640.     <-5.174134, 5.528420, -13.211995>,
  1641.     <-1.769023, 5.528420, 0.000000>,
  1642.     <1.636088, 5.528420, 0.000000>,
  1643.     <5.041199, 5.528420, -13.003932>,
  1644.     <-5.174134, 1.862827, 0.000000>,
  1645.     <0.038471, 0.031270, 18.101474>,
  1646.     <0.036657, 0.031270, 18.101474>,
  1647.     <5.041199, 1.862827, 0.000000>,
  1648.     <-5.174134, -1.802766, 0.000000>,
  1649.     <0.038471, 0.028792, 18.101474>,
  1650.     <0.036657, 0.028792, 18.101474>,
  1651.     <5.041199, -1.802766, 0.000000>,
  1652.     <-5.174134, -5.468359, -13.070366>,
  1653.     <-1.769023, -5.468359, 0.000000>,
  1654.     <1.636088, -5.468359, 0.000000>,
  1655.     <4.974128, -5.468359, -12.801446>
  1656.     texture {
  1657.       TeePeeTex
  1658.     }
  1659.     rotate -90*x  // to orient the object to LHC
  1660.     rotate 25*y   // to see the four "legs" better
  1661.   }
  1662. We add the above rotations so that the patch is oriented to POV-
  1663. Ray's left-handed coordinate system (remember the patch was made
  1664. in moray in a right handed coordinate system), so we can see all
  1665. four legs. Rendering this at 200x150 -a we see pretty much what
  1666. we expect, a white teepee over a green and yellow checkered
  1667. plane. Let's take a little closer look. We render it again, this
  1668. time at 320x200.
  1669.  
  1670. Now we see that something is amiss. There appears to be sharp
  1671. angling, almost like facing, especially near the top. This is
  1672. indeed a kind of facing and is due to the u_steps and v_steps
  1673. parameters. Let's change these from 3 to 4 and see what happens.
  1674.  
  1675. That's much better, but it took a little longer to render. This
  1676. is an unavoidable tradeoff. If we want even finer detail, we must
  1677. use a u_steps and v_steps value of 5 and set flatness to 0. But
  1678. we must expect to use lots of memory and an even longer tracing
  1679. time.
  1680.  
  1681. Well, we can't just leave this scene without adding a few items
  1682. just for interest. We declare the patch object and scatter a few
  1683. of them around the scene:
  1684.  
  1685.   #declare TeePee = bicubic_patch {
  1686.     type 1 flatness 0.0100 u_steps 3 v_steps 3,
  1687.     <-5.174134, 5.528420, -13.211995>,
  1688.     <-1.769023, 5.528420, 0.000000>,
  1689.     <1.636088, 5.528420, 0.000000>,
  1690.     <5.041199, 5.528420, -13.003932>,
  1691.     <-5.174134, 1.862827, 0.000000>,
  1692.     <0.038471, 0.031270, 18.101474>,
  1693.     <0.036657, 0.031270, 18.101474>,
  1694.     <5.041199, 1.862827, 0.000000>,
  1695.     <-5.174134, -1.802766, 0.000000>,
  1696.     <0.038471, 0.028792, 18.101474>,
  1697.     <0.036657, 0.028792, 18.101474>,
  1698.     <5.041199, -1.802766, 0.000000>,
  1699.     <-5.174134, -5.468359, -13.070366>,
  1700.     <-1.769023, -5.468359, 0.000000>,
  1701.     <1.636088, -5.468359, 0.000000>,
  1702.     <4.974128, -5.468359, -12.801446>
  1703.     texture {
  1704.       TeePeeTex
  1705.      }
  1706.      rotate -90*x // to orient the object to LHC
  1707.      rotate 25*y  // to see the four "legs" better
  1708.   }
  1709.   object { TeePee }
  1710.   object { TeePee translate <8, 0, 8> }
  1711.   object { TeePee translate <-9, 0, 9> }
  1712.   object { TeePee translate <18, 0, 24> }
  1713.   object { TeePee translate <-18, 0, 24> }
  1714. That looks good. Let's do something about that boring gray
  1715. background. We delete the background declaration and replace it
  1716. with:
  1717.  
  1718.   plane { y, 500
  1719.     texture {
  1720.       pigment { SkyBlue }
  1721.       finish { ambient 1 diffuse 0}
  1722.      }
  1723.      texture {
  1724.        pigment {
  1725.          bozo
  1726.          turbulence .5
  1727.          color_map {
  1728.            [0 White]
  1729.            [1 White filter 1]
  1730.          }
  1731.        }
  1732.        finish { ambient 1 diffuse 0 }
  1733.        scale <1000, 250, 250>
  1734.        rotate <5, 45, 0>
  1735.     }
  1736.   }
  1737. This adds a pleasing cirrus-cloud filled sky. Now, let's change
  1738. the checkered plane to rippled sand dunes:
  1739.  
  1740.   plane {y,-12
  1741.     texture {
  1742.       pigment {
  1743.         color <.85, .5, .15>
  1744.       }
  1745.       finish {
  1746.         ambient .25
  1747.         diffuse .6
  1748.         crand .5
  1749.       }
  1750.       normal {
  1751.         ripples .35
  1752.         turbulence .25
  1753.         frequency 5
  1754.       }
  1755.       scale 10
  1756.       translate 50*x
  1757.     }
  1758.   }
  1759. We render this. Not bad! Let's just add one more element.  Let's
  1760. place a golden egg under each of the teepees. And since this is a
  1761. bezier patch tutorial, let's make the eggs out of bezier patches.
  1762.  
  1763. We return to moray and create another bezier patch. We name it
  1764. Egg1 and select "CYLINDRICAL 2 - PATCH" from the "CREATE BEZIER
  1765. PATCH" dialogue box. We click on "EXTENDED EDIT". We "MARK ALL"
  1766. and rotate the patch so that the cylinder lays on its side. We
  1767. "UNMARK ALL". In the "FRONT" view, we [SHIFT]-drag a box around
  1768. the four points on the right end to mark them. In the "SIDE"
  1769. view, we right click and "MAXIMIZE".  We [ALT]-drag to zoom in a
  1770. little closer. We "UFRM SCL" the points together as close as
  1771. possible. We zoom in closer to get them nice and tight. We zoom
  1772. out, right click and "MINIMIZE".
  1773.  
  1774. We click on "TRANSLATE" and drag the points to the left so that
  1775. they are aligned on the z-axis with the next group of four
  1776. points. This should create a blunt end to the patch. We repeat
  1777. this procedure for the other end. We "UNMARK ALL".
  1778.  
  1779. In the "FRONT" view, the control grid should be a rectangle now
  1780. and the patch should be an ellipsoid. We [SHIFT]-drag a box
  1781. around the upper right corner of the control grid to mark those
  1782. points. We then [SHIFT]-drag a box around the lower right corner
  1783. to mark those points as well. In the "SIDE" view, we "UFRM SCL"
  1784. the points apart a little to make that end of the egg a little
  1785. wider than the other. We "UNMARK ALL".
  1786.  
  1787. The egg may need a little proportional adjustment. We should be
  1788. able to "MARK ALL" and "LOCAL SCL" in the three views until we
  1789. get it to look like an egg. When we are satisfied that it does,
  1790. we "UNMARK ALL" and click on done. Learning from our teepee
  1791. object, we now go ahead and change u_steps and v_steps to 4.
  1792.  
  1793. We create a dummy texture, white with default finish, name it
  1794. EggTex and apply it to the egg. From the FILES menu, we "SAVE
  1795. SEL" to filename egg1.mdl. We load this file and export ([CTRL
  1796. F9]). We exit moray and copy the files egg1.inc and egg1.pov into
  1797. our working directory.
  1798.  
  1799. Back in bezdemo.pov, we create a nice, shiny gold texture:
  1800.  
  1801.   #declare EggTex = texture {
  1802.     pigment { BrightGold }
  1803.     finish {
  1804.       ambient .1
  1805.       diffuse .4
  1806.       specular 1
  1807.       roughness 0.001
  1808.       reflection .5
  1809.       metallic
  1810.     }
  1811.   }
  1812. And while we're at it, let's dandy up our TeePeeTex texture:
  1813.  
  1814.   #declare TeePeeTex = texture {
  1815.     pigment { Silver }
  1816.     finish {
  1817.       ambient .1
  1818.       diffuse .4
  1819.       specular 1
  1820.       roughness 0.001
  1821.       reflection .5
  1822.       metallic
  1823.     }
  1824.   }
  1825. Now we paste in our egg patch data and declare our egg:
  1826.  
  1827.   #declare Egg = union { // Egg1
  1828.     bicubic_patch {
  1829.       type 1 flatness 0.0100 u_steps 4 v_steps 4,
  1830.       <2.023314, 0.000000, 4.355987>,
  1831.       <2.023314, -0.000726, 4.355987>,
  1832.       <2.023312, -0.000726, 4.356867>,
  1833.       <2.023312, 0.000000, 4.356867>,
  1834.       <2.032037, 0.000000, 2.734598>,
  1835.       <2.032037, -1.758562, 2.734598>,
  1836.       <2.027431, -1.758562, 6.141971>,
  1837.       <2.027431, 0.000000, 6.141971>,
  1838.       <-1.045672, 0.000000, 3.281572>,
  1839.       <-1.045672, -1.758562, 3.281572>,
  1840.       <-1.050279, -1.758562, 5.414183>,
  1841.       <-1.050279, 0.000000, 5.414183>,
  1842.       <-1.044333, 0.000000, 4.341816>,
  1843.       <-1.044333, -0.002947, 4.341816>,
  1844.       <-1.044341, -0.002947, 4.345389>,
  1845.       <-1.044341, 0.000000, 4.345389>
  1846.     }
  1847.     bicubic_patch {
  1848.       type 1 flatness 0.0100 u_steps 4 v_steps 4,
  1849.       <2.023312, 0.000000, 4.356867>,
  1850.       <2.023312, 0.000726, 4.356867>,
  1851.       <2.023314, 0.000726, 4.355987>,
  1852.       <2.023314, 0.000000, 4.355987>,
  1853.       <2.027431, 0.000000, 6.141971>,
  1854.       <2.027431, 1.758562, 6.141971>,
  1855.       <2.032037, 1.758562, 2.734598>,
  1856.       <2.032037, 0.000000, 2.734598>,
  1857.       <-1.050279, 0.000000, 5.414183>,
  1858.       <-1.050279, 1.758562, 5.414183>,
  1859.       <-1.045672, 1.758562, 3.281572>,
  1860.       <-1.045672, 0.000000, 3.281572>,
  1861.       <-1.044341, 0.000000, 4.345389>,
  1862.       <-1.044341, 0.002947, 4.345389>,
  1863.       <-1.044333, 0.002947, 4.341816>,
  1864.       <-1.044333, 0.000000, 4.341816>
  1865.     }
  1866.     texture { EggTex }
  1867.     translate <0.5, 0, -5>  // centers the egg around the origin
  1868.     translate -9.8*y        // places the egg on the ground
  1869.   }
  1870. We now place a copy of the egg under each teepee. This should
  1871. require only the x- and z-coordinates of each teepee to be
  1872. changed:
  1873.  
  1874.   object { Egg }
  1875.   object { Egg translate <8, 0, 8> }
  1876.   object { Egg translate <-9, 0, 9> }
  1877.   object { Egg translate <18, 0, 24> }
  1878.   object { Egg translate <-18, 0, 24> }
  1879.                                 
  1880.                                 
  1881.            Scene build with different Bezier patches.
  1882.                                 
  1883. We render this at low resolution such as 320x240. Everything
  1884. looks good so we run it again at 640x480.  Now we see that there
  1885. is still some facing near the top of the teepees and on the eggs
  1886. as well. The only solution is to raise u_steps and v_steps from 4
  1887. to 5 and set flatness to 0 for all our bezier objects. We make
  1888. the changes and render it again at 640x480.  The facets are gone.
  1889.  
  1890.  
  1891. 2.4.2     Blob Object
  1892. Blobs are described as spheres and cylinders covered with "goo"
  1893. which stretches to smoothly join them (see section "Blob"). Ideal
  1894. for modeling atoms and molecules, blobs are also powerful tools
  1895. for creating many smooth flowing "organic" shapes.
  1896.  
  1897. A slightly more mathematical way of describing a blob would be to
  1898. say that it is one object made up of two or more component
  1899. pieces. Each piece is really an invisible field of force which
  1900. starts out at a particular strength and falls off smoothly to
  1901. zero at a given radius. Where ever these components overlap in
  1902. space, their field strength gets added together (and yes, we can
  1903. have negative strength which gets subtracted out of the total as
  1904. well). We could have just one component in a blob, but except for
  1905. seeing what it looks like there is little point, since the real
  1906. beauty of blobs is the way the components interact with one
  1907. another.
  1908.  
  1909. Let us take a simple example blob to start. Now, in fact there
  1910. are a couple different types of components but we will look at
  1911. them a little later. For the sake of a simple first example, let
  1912. us just talk about spherical components. Here is a sample POV-Ray
  1913. code showing a basic camera, light, and a simple two component
  1914. blob (this scene is called blobdem1.pov):
  1915.  
  1916.   #include "colors.inc"
  1917.   background{White}
  1918.   camera {
  1919.     angle 15
  1920.     location <0,2,-10>
  1921.     look_at <0,0,0>
  1922.   }
  1923.   light_source { <10, 20, -10> color White }
  1924.   blob {
  1925.     threshold .65
  1926.     sphere { <.5,0,0>, .8, 1 pigment {Blue} }
  1927.     sphere { <-.5,0,0>,.8, 1 pigment {Pink} }
  1928.     finish { phong 1 }
  1929.   }
  1930.                                 
  1931.                                 
  1932.                     A simple, two-part blob.
  1933.                                 
  1934. The threshold is simply the overall strength value at which the
  1935. blob becomes visible. Any points within the blob where the
  1936. strength matches the threshold exactly form the surface of the
  1937. blob shape. Those less than the threshold are outside and those
  1938. greater than are inside the blob.
  1939.  
  1940. We note that the spherical component looks a lot like a simple
  1941. sphere object. We have the sphere keyword, the vector
  1942. representing the location of the center of the sphere and the
  1943. float representing the radius of the sphere. But what is that
  1944. last float value? That is the individual strength of that
  1945. component. In a spherical component, that is how strong the
  1946. component's field is at the center of the sphere. It will fall
  1947. off in a linear progression until it reaches exactly zero at the
  1948. radius of the sphere.
  1949.  
  1950. Before we render this test image, we note that we have given each
  1951. component a different pigment. POV-Ray allows blob components to
  1952. be given separate textures. We have done this here to make it
  1953. clearer which parts of the blob are which. We can also texture
  1954. the whole blob as one, like the finish statement at the end,
  1955. which applies to all components since it appears at the end,
  1956. outside of all the components. We render the scene and get a
  1957. basic kissing spheres type blob.
  1958.  
  1959. The image we see shows the spheres on either side, but they are
  1960. smoothly joined by that bridge section in the center. This bridge
  1961. represents where the two fields overlap, and therefore stay above
  1962. the threshold for longer than elsewhere in the blob. If that is
  1963. not totally clear, we add the following two objects to our scene
  1964. and re-render (see file blobdem2.pov). We note that these are
  1965. meant to be entered as separate sphere objects, not more
  1966. components in the blob.
  1967.  
  1968.   sphere { <.5,0,0>, .8
  1969.     pigment { Yellow transmit .75 }
  1970.   }
  1971.   sphere { <-.5,0,0>, .8
  1972.     pigment { Green transmit .75 }
  1973.   }
  1974.                                 
  1975.                                 
  1976.              The spherical components made visible.
  1977.                                 
  1978. Now the secrets of the kissing spheres are laid bare. These semi-
  1979. transparent spheres show where the components of the blob
  1980. actually are. If we have not worked with blobs before, we might
  1981. be surprised to see that the spheres we just added extend way
  1982. farther out than the spheres that actually show up on the blobs.
  1983. That of course is because our spheres have been assigned a
  1984. starting strength of one, which gradually fades to zero as we
  1985. move away from the sphere's center. When the strength drops below
  1986. the threshold (in this case 0.65) the rest of the sphere becomes
  1987. part of the outside of the blob and therefore is not visible.
  1988.  
  1989. See the part where the two transparent spheres overlap? We note
  1990. that it exactly corresponds to the bridge between the two
  1991. spheres. That is the region where the two components are both
  1992. contributing to the overall strength of the blob at that point.
  1993. That is why the bridge appears: that region has a high enough
  1994. strength to stay over the threshold, due to the fact that the
  1995. combined strength of two spherical components is overlapping
  1996. there.
  1997.  
  1998.  
  1999. 2.4.2.1   Component Types and Other New Features
  2000. The shape shown so far is interesting, but limited. POV-Ray has a
  2001. few extra tricks that extend its range of usefulness however. For
  2002. example, as we have seen, we can assign individual textures to
  2003. blob components, we can also apply individual transformations
  2004. (translate, rotate and scale) to stretch, twist, and squash
  2005. pieces of the blob as we require. And perhaps most interestingly,
  2006. the blob code has been extended to allow cylindrical components.
  2007.  
  2008. Before we move on to cylinders, it should perhaps be mentioned
  2009. that the old style of components used in previous versions of POV-
  2010. Ray still work. Back then, all components were spheres, so it was
  2011. not necessary to say sphere or cylinder. An old style component
  2012. had the form:
  2013.  
  2014.   component Strength, Radius, <Center>
  2015. This has the same effect as a spherical component, just as we
  2016. already saw above. This is only useful for backwards
  2017. compatibility. If we already have POV-Ray files with blobs from
  2018. earlier versions, this is when we would need to recognize these
  2019. components. We note that the old style components did not put
  2020. braces around the strength, radius and center, and of course, we
  2021. cannot independently transform or texture them.  Therefore if we
  2022. are modifying an older work into a new version, it may arguably
  2023. be of benefit to convert old style components into spherical
  2024. components anyway.
  2025.  
  2026. Now for something new and different: cylindrical components. It
  2027. could be argued that all we ever needed to do to make a roughly
  2028. cylindrical portion of a blob was string a line of spherical
  2029. components together along a straight line. Which is fine, if we
  2030. like having extra to type, and also assuming that the cylinder
  2031. was oriented along an axis.  If not, we would have to work out
  2032. the mathematical position of each component to keep it is a
  2033. straight line. But no more! Cylindrical components have arrived.
  2034.  
  2035. We replace the blob in our last example with the following and re-
  2036. render. We can get rid of the transparent spheres too, by the
  2037. way.
  2038.  
  2039.   blob {
  2040.     threshold .65
  2041.     cylinder { <-.75,-.75,0>, <.75,.75,0>, .5, 1 }
  2042.     pigment { Blue }
  2043.     finish { phong 1 }
  2044.   }
  2045. We only have one component so that we can see the basic shape of
  2046. the cylindrical component. It is not quite a true cylinder - more
  2047. of a sausage shape, being a cylinder capped by two hem-spheres.
  2048. We think of it as if it were an array of spherical components all
  2049. closely strung along a straight line.
  2050.  
  2051. As for the component declaration itself: simple, logical, exactly
  2052. as we would expect it to look (assuming we have been awake so
  2053. far): it looks pretty much like the declaration of a cylinder
  2054. object, with vectors specifying the two endpoints and a float
  2055. giving the radius of the cylinder. The last float, of course, is
  2056. the strength of the component. Just as with spherical components,
  2057. the strength will determine the nature and degree of this
  2058. component's interaction with its fellow components. In fact, next
  2059. let us give this fellow something to interact with, shall we?
  2060.  
  2061.  
  2062. 2.4.2.2   Complex Blob Constructs and Negative Strength
  2063. Beginning a new POV-Ray file called blobdem3.pov, we enter this
  2064. somewhat more complex example:
  2065.  
  2066.   #include "colors.inc"
  2067.   background{White}
  2068.   camera {
  2069.     angle 20
  2070.     location<0,2,-10>
  2071.     look_at<0,0,0>
  2072.   }
  2073.   light_source { <10, 20, -10> color White }
  2074.   blob {
  2075.     threshold .65
  2076.     sphere { <-.23,-.32,0>,.43, 1 scale <1.95,1.05,.8> }   //palm
  2077.     sphere { <+.12,-.41,0>,.43, 1 scale <1.95,1.075,.8> }  //palm
  2078.     sphere { <-.23,-.63,0>, .45, .75 scale <1.78, 1.3,1> }
  2079. //midhand
  2080.     sphere { <+.19,-.63,0>, .45, .75 scale <1.78, 1.3,1> }
  2081. //midhand
  2082.     sphere { <-.22,-.73,0>, .45, .85 scale <1.4, 1.25,1> } //heel
  2083.     sphere { <+.19,-.73,0>, .45, .85 scale <1.4, 1.25,1> } //heel
  2084.     cylinder { <-.65,-.28,0>, <-.65,.28,-.05>, .26, 1 }
  2085. //lower pinky
  2086.     cylinder { <-.65,.28,-.05>, <-.65, .68,-.2>, .26, 1 }
  2087. //upper pinky
  2088.     cylinder { <-.3,-.28,0>, <-.3,.44,-.05>, .26, 1 }
  2089. //lower ring
  2090.     cylinder { <-.3,.44,-.05>, <-.3, .9,-.2>, .26, 1 }
  2091. //upper ring
  2092.     cylinder { <.05,-.28,0>, <.05, .49,-.05>, .26, 1 }
  2093. //lower middle
  2094.     cylinder { <.05,.49,-.05>, <.05, .95,-.2>, .26, 1 }
  2095. //upper middle
  2096.     cylinder { <.4,-.4,0>, <.4, .512, -.05>, .26, 1 }
  2097. //lower index
  2098.     cylinder { <.4,.512,-.05>, <.4, .85, -.2>, .26, 1 }
  2099. //upper index
  2100.     cylinder { <.41, -.95,0>, <.85, -.68, -.05>, .25, 1 }
  2101. //lower thumb
  2102.     cylinder { <.85,-.68,-.05>, <1.2, -.4, -.2>, .25, 1 }
  2103. //upper thumb
  2104.     pigment { Flesh }
  2105.   }
  2106.                                 
  2107.                                 
  2108.                      A hand made with blobs.
  2109.                                 
  2110. As we can guess from the comments, we are building a hand here.
  2111. After we render this image, we can see there are a few problems
  2112. with it. The palm and heel of the hand would look more realistic
  2113. if we used a couple dozen smaller components rather than the half
  2114. dozen larger ones we have used, and each finger should have three
  2115. segments instead of two, but for the sake of a simplified
  2116. demonstration, we can overlook these points. But there is one
  2117. thing we really need to address here: This poor fellow appears to
  2118. have horrible painful swelling of the joints!
  2119.  
  2120. A review of what we know of blobs will quickly reveal what went
  2121. wrong. The joints are places where the blob components overlap,
  2122. therefore the combined strength of both components at that point
  2123. causes the surface to extend further out, since it stays over the
  2124. threshold longer. To fix this, what we need are components
  2125. corresponding to the overlap region which have a negative
  2126. strength to counteract part of the combined field strength. We
  2127. add the following components to our blob (see file blobdem4.pov).
  2128.  
  2129.   sphere { <-.65,.28,-.05>, .26, -1 } //counteract pinky knuckle
  2130. bulge
  2131.   sphere { <-.65,-.28,0>, .26, -1 }   //counteract pinky palm
  2132. bulge
  2133.   sphere { <-.3,.44,-.05>, .26, -1 }  //counteract ring knuckle
  2134. bulge
  2135.   sphere { <-.3,-.28,0>, .26, -1 }    //counteract ring palm
  2136. bulge
  2137.   sphere { <.05,.49,-.05>, .26, -1 }  //counteract middle knuckle
  2138. bulge
  2139.   sphere { <.05,-.28,0>, .26, -1 }    //counteract middle palm
  2140. bulge
  2141.   sphere { <.4,.512,-.05>, .26, -1 }  //counteract index knuckle
  2142. bulge
  2143.   sphere { <.4,-.4,0>, .26, -1 }      //counteract index palm
  2144. bulge
  2145.   sphere { <.85,-.68,-.05>, .25, -1 } //counteract thumb knuckle
  2146. bulge
  2147.   sphere { <.41,-.7,0>, .25, -.89 }   //counteract thumb heel
  2148. bulge
  2149.                                 
  2150.                                 
  2151.               The hand without the swollen joints.
  2152.                                 
  2153. Much better! The negative strength of the spherical components
  2154. counteracts approximately half of the field strength at the
  2155. points where to components overlap, so the ugly, unrealistic (and
  2156. painful looking) bulging is cut out making our hand considerably
  2157. improved. While we could probably make a yet more realistic hand
  2158. with a couple dozen additional components, what we get this time
  2159. is a considerable improvement. Any by now, we have enough basic
  2160. knowledge of blob mechanics to make a wide array of smooth,
  2161. flowing organic shapes!
  2162.  
  2163.  
  2164. 2.4.3     Height Field Object
  2165. A height_field is an object that has a surface that is determined
  2166. by the color value or palette index number of an image designed
  2167. for that purpose. With height fields, realistic mountains and
  2168. other types of terrain can easily be made. First, we need an
  2169. image from which to create the height field. It just so happens
  2170. that POV-Ray is ideal for creating such an image.
  2171.  
  2172. We make a new file called image.pov and edit it to contain the
  2173. following:
  2174.  
  2175.   #include "colors.inc"
  2176.   global_settings {
  2177.     assumed_gamma 2.2
  2178.     hf_gray_16
  2179.   }
  2180. The hf_gray_16 keyword causes the output to be in a special 16
  2181. bit grayscale that is perfect for generating height fields. The
  2182. normal 8 bit output will lead to less smooth surfaces.
  2183.  
  2184. Now we create a camera positioned so that it points directly down
  2185. the z-axis at the origin.
  2186.  
  2187.   camera {
  2188.     location <0, 0, -10>
  2189.     look_at 0
  2190.   }
  2191. We then create a plane positioned like a wall at z=0. This plane
  2192. will completely fill the screen. It will be colored with white
  2193. and gray wrinkles.
  2194.  
  2195.   plane { z, 10
  2196.     pigment {
  2197.       wrinkles
  2198.       color_map {
  2199.        [0 0.3*White]
  2200.        [1 White]
  2201.       }
  2202.     }
  2203.   }
  2204. Finally, create a light source.
  2205.  
  2206.   light_source { <0, 20, -100> color White }
  2207. We render this scene at 640x480 +A0.1 +FT. We will get an image
  2208. that will produce an excellent height field. We create a new file
  2209. called hfdemo.pov and edit it as follows:
  2210.  
  2211.   #include "colors.inc"
  2212. We add a camera that is two units above the origin and ten units
  2213. back ...
  2214.  
  2215.   camera{
  2216.     location <0, 2, -10>
  2217.     look_at 0
  2218.     angle 30
  2219.   }
  2220. ... and a light source.
  2221.  
  2222.   light_source{ <1000,1000,-1000> White }
  2223. Now we add the height field. In the following syntax, a Targa
  2224. image file is specified, the height field is smoothed, it is
  2225. given a simple white pigment, it is translated to center it
  2226. around the origin and it is scaled so that it resembles mountains
  2227. and fills the screen.
  2228.  
  2229.   height_field {
  2230.     tga "image.tga"
  2231.     smooth
  2232.     pigment { White }
  2233.     translate <-.5, -.5, -.5>
  2234.     scale <17, 1.75, 17>
  2235.   }
  2236. We save the file and render it at 320x240 -A. Later, when we are
  2237. satisfied that the height field is the way we want it, we render
  2238. it at a higher resolution with anti-aliasing.
  2239.  
  2240.                                 
  2241.                                 
  2242.          A height field created completely with POV-Ray.
  2243.                                 
  2244. Wow! The Himalayas have come to our computer screen!
  2245.  
  2246.  
  2247. 2.4.4     Lathe Object
  2248. In the real world, lathe refers to a process of making patterned
  2249. rounded shapes by spinning the source material in place and
  2250. carving pieces out as it turns. The results can be elaborate,
  2251. smoothly rounded, elegant looking artifacts such as table legs,
  2252. pottery, etc. In POV-Ray, a lathe object is used for creating
  2253. much the same kind of items, although we are referring to the
  2254. object itself rather than the means of production.
  2255.  
  2256. Here is some source for a really basic lathe (called
  2257. lathdem1.pov).
  2258.  
  2259.   #include "colors.inc"
  2260.   background{White}
  2261.   camera {
  2262.     angle 10
  2263.     location <1, 9, -50>
  2264.     look_at <0, 2, 0>
  2265.   }
  2266.   light_source {
  2267.     <20, 20, -20> color White
  2268.   }
  2269.   lathe {
  2270.     linear_spline
  2271.     6,
  2272.     <0,0>, <1,1>, <3,2>, <2,3>, <2,4>, <0,4>
  2273.     pigment { Blue }
  2274.     finish {
  2275.       ambient .3
  2276.       phong .75
  2277.     }
  2278.   }
  2279.                                 
  2280.                                 
  2281.                      A simple lathe object.
  2282.                                 
  2283. We render this, and what we see is a fairly simply type of lathe,
  2284. which looks like a child's top. Let's take a look at how this
  2285. code produced the effect.
  2286.  
  2287. First, a set of six points are declared which the raytracer
  2288. connects with lines. We note that there are only two components
  2289. in the vectors which describe these points. The lines that are
  2290. drawn are assumed to be in the x-y-plane, therefore it is as if
  2291. all the z-components were assumed to be zero. The use of a two-
  2292. dimensional vector is mandatory (Attempting to use a 3D vector
  2293. would trigger an error... with one exception, which we will
  2294. explore later in the discussion of splines).
  2295.  
  2296. Once the lines are determined, the ray-tracer rotates this line
  2297. around the y-axis, and we can imagine a trail being left through
  2298. space as it goes, with the surface of that trail being the
  2299. surface of our object.
  2300.  
  2301. The specified points are connected with straight lines because we
  2302. used the linear_spline keyword. There are other types of splines
  2303. available with the lathe, which will result in smooth curving
  2304. lines, and even rounded curving points of transition, but we will
  2305. get back to that in a moment.
  2306.  
  2307. First, we would like to digress a moment to talk about the
  2308. difference between a lathe and a surface of revolution object
  2309. (SOR). The SOR object, described in a separate tutorial, may seem
  2310. terribly similar to the lathe at first glance. It too declares a
  2311. series of points and connects them with curving lines and then
  2312. rotates them around the y-axis. The lathe has certain advantages,
  2313. such as different kinds of splines, linear, quadratic and cubic,
  2314. and one more thing:
  2315.  
  2316. The simpler mathematics used by a SOR doesn't allow the curve to
  2317. double back over the same y-coordinates, thus, if using a SOR,
  2318. any sudden twist which cuts back down over the same heights that
  2319. the curve previously covered will trigger an error. For example,
  2320. suppose we wanted a lathe to arc up from <0,0> to <2,2>, then to
  2321. dip back down to <4,0>. Rotated around the y-axis, this would
  2322. produce something like a gelatin mold - a rounded semi torus,
  2323. hollow in the middle. But with the SOR, as soon as the curve
  2324. doubled back on itself in the y-direction, it would become an
  2325. illegal declaration.
  2326.  
  2327. Still, the SOR has one powerful strong point: because it uses
  2328. simpler order mathematics, it generally tends to render faster
  2329. than an equivalent lathe. So in the end, its a matter of: we use
  2330. a SOR if its limitations will allow, but when we need a more
  2331. flexible shape, we go with the lathe instead.
  2332.  
  2333.  
  2334. 2.4.4.1   Understanding The Concept of Splines
  2335. It would be helpful, in order to understand splines, if we had a
  2336. sort of Spline Workshop where we could practice manipulating
  2337. types and points of splines and see what the effects were like.
  2338. So let's make one! Now that we know how to create a basic lathe,
  2339. it will be easy (see file lathdem2.pov):
  2340.  
  2341.   #include "colors.inc"
  2342.   camera {
  2343.     orthographic
  2344.     up <0, 5, 0>
  2345.     right <5, 0, 0>
  2346.     location <2.5, 2.5, -100>
  2347.     look_at <2.5, 2.5, 0>
  2348.   }
  2349.   /* set the control points to be used */
  2350.   #declare Red_Point    = <1.00, 0.00, 0>;
  2351.   #declare Orange_Point = <1.75, 1.00, 0>;
  2352.   #declare Yellow_Point = <2.50, 2.00, 0>;
  2353.   #declare Green_Point  = <2.00, 3.00, 0>;
  2354.   #declare Blue_Point   = <1.50, 4.00, 0>;
  2355.   /* make the control points visible */
  2356.   cylinder { Red_Point, Red_Point - 20*z, .1
  2357.     pigment { Red }
  2358.     finish { ambient 1 }
  2359.   }
  2360.   cylinder { Orange_Point, Orange_Point - 20*z, .1
  2361.     pigment { Orange }
  2362.     finish { ambient 1 }
  2363.   }
  2364.   cylinder { Yellow_Point, Yellow_Point - 20*z, .1
  2365.     pigment { Yellow }
  2366.     finish { ambient 1 }
  2367.   }
  2368.   cylinder { Green_Point, Green_Point - 20*z, .1
  2369.     pigment { Green }
  2370.     finish { ambient 1 }
  2371.   }
  2372.   cylinder { Blue_Point, Blue_Point- 20*z, .1
  2373.     pigment { Blue }
  2374.     finish { ambient 1 }
  2375.   }
  2376.   /* something to make the curve show up */
  2377.   lathe {
  2378.     linear_spline
  2379.     5,
  2380.     Red_Point,
  2381.     Orange_Point,
  2382.     Yellow_Point,
  2383.     Green_Point,
  2384.     Blue_Point
  2385.     pigment { White }
  2386.     finish { ambient 1 }
  2387.   }
  2388.                                 
  2389.                                 
  2390.                    A simple "Spline Workshop".
  2391.                                 
  2392. Now, we take a deep breath. We know that all looks a bit weird,
  2393. but with some simple explanations, we can easily see what all
  2394. this does.
  2395.  
  2396. First, we are using the orthographic camera. If we haven't read
  2397. up on that yet, a quick summary is: it renders the scene flat,
  2398. eliminating perspective distortion so that in a side view, the
  2399. objects look like they were drawn on a piece of graph paper (like
  2400. in the side view of a modeler or CAD package). There are several
  2401. uses for this practical new type of camera, but here it is
  2402. allowing us to see our lathe and cylinders edge on, so that what
  2403. we see is almost like a cross section of the curve which makes
  2404. the lathe, rather than the lathe itself. To further that effect,
  2405. we eliminated shadowing with the ambient 1 finish, which of
  2406. course also eliminates the need for lighting. We have also
  2407. positioned this particular side view so that <0,0> appears at the
  2408. lower left of our scene.
  2409.  
  2410. Next, we declared a set of points. We note that we used 3D
  2411. vectors for these points rather than the 2D vectors we expect in
  2412. a lathe. That's the exception we mentioned earlier. When we
  2413. declare a 3D point, then use it in a lathe, the lathe only uses
  2414. the first two components of the vector, and whatever is in the
  2415. third component is simply ignored. This is handy here, since it
  2416. makes this example possible.
  2417.  
  2418. Next we do two things with the declared points. First we use them
  2419. to place small diameter cylinders at the locations of the points
  2420. with the circular caps facing the camera. Then we re-use those
  2421. same vectors to determine the lathe. Since trying to declare a 2D
  2422. vector can have some odd results, and isn't really what our
  2423. cylinder declarations need anyway, we can take advantage of the
  2424. lathe's tendency to ignore the third component by just setting
  2425. the z-coordinate in these 3D vectors to zero.
  2426.  
  2427. The end result is: when we render this code, we see a white lathe
  2428. against a black background showing us how the curve we've
  2429. declared looks, and the circular ends of the cylinders show us
  2430. where along the x-y-plane our control points are. In this case,
  2431. it's very simple. The linear spline has been used so our curve is
  2432. just straight lines zig-zagging between the points. We change the
  2433. declarations of Red_Point and Blue_Point to read as follows (see
  2434. file lathdem3.pov).
  2435.  
  2436.   #declare Red_Point  = <2.00, 0.00, 0>;
  2437.   #declare Blue_Point = <0.00, 4.00, 0>;
  2438.                                 
  2439.                                 
  2440.                 Moving some points of the spline.
  2441.                                 
  2442. We re-render and, as we can see, all that happens is that the
  2443. straight line segments just move to accommodate the new position
  2444. of the red and blue points. Linear splines are so simple, we
  2445. could manipulate them in our sleep, no?
  2446.  
  2447. Let's try something different. First, we change the points to the
  2448. following (see file lathdem4.pov).
  2449.  
  2450.   #declare Red_Point    = <1.00, 0.00, 0>;
  2451.   #declare Orange_Point = <2.00, 1.00, 0>;
  2452.   #declare Yellow_Point = <3.50, 2.00, 0>;
  2453.   #declare Green_Point  = <2.00, 3.00, 0>;
  2454.   #declare Blue_Point   = <1.50, 4.00, 0>;
  2455.                                 
  2456.                                 
  2457.                     A quadratic spline lathe.
  2458.                                 
  2459. We then go down to the lathe declaration and change linear_spline
  2460. to quadratic_spline. We re-render and what do we have?  Well,
  2461. there's a couple of things worthy of note this time. First, we
  2462. will see that instead of straight lines we have smooth arcs
  2463. connecting the points. These arcs are made from quadratic curves,
  2464. so our lathe looks much more interesting this time. Also,
  2465. Red_Point is no longer connected to the curve. What happened?
  2466.  
  2467. Well, while any two points can determine a straight line, it
  2468. takes three to determine a quadratic curve. POV-Ray looks not
  2469. only to the two points to be connected, but to the point
  2470. immediately preceding them to determine the formula of the
  2471. quadratic curve that will be used to connect them. The problem
  2472. comes in at the beginning of the curve. Beyond the first point in
  2473. the curve there is no previous point. So we need to declare one.
  2474. Therefore, when using a quadratic spline, we must remember that
  2475. the first point we specify is only there so that POV-Ray can
  2476. determine what curve to connect the first two points with. It
  2477. will not show up as part of the actual curve.
  2478.  
  2479. There's just one more thing about this lathe example. Even though
  2480. our curve is now put together with smooth curving lines, the
  2481. transitions between those lines is... well, kind of choppy, no?
  2482. This curve looks like the lines between each individual point
  2483. have been terribly mismatched. Depending on what we are trying to
  2484. make, this could be acceptable, or, we might long for a more
  2485. smoothly curving shape. Fortunately, if the latter is true, we
  2486. have another option.
  2487.  
  2488. The quadratic spline takes longer to render than a linear spline.
  2489. The math is more complex. Still longer needs the cubic spline,
  2490. yet, for a really smoothed out shape, this is the only way to go.
  2491. We go back into our example, and simply replace quadratic_spline
  2492. with cubic_spline (see file lathdem5.pov). We render one more
  2493. time, and take a look at what we have.
  2494.  
  2495.                                 
  2496.                                 
  2497.                       A cubic spline lathe.
  2498.                                 
  2499. While a quadratic spline takes three points to determine the
  2500. curve, a cubic needs four. So, as we might expect, Blue_Point has
  2501. now dropped out of the curve, just as Red_Point did, as the first
  2502. and last points of our curve are now only control points for
  2503. shaping the curves between the remaining points. But look at the
  2504. transition from Orange_Point to Yellow_Point and then back to
  2505. Green_Point. Now, rather than looking mismatched, our curve
  2506. segments look like one smoothly joined curve.
  2507.  
  2508. The concept of splines is a handy and necessary one, which will
  2509. be seen again in the prism and polygon objects. But with a little
  2510. tinkering we can quickly get a feel for working with them.
  2511.  
  2512.  
  2513. 2.4.5     Mesh Object
  2514. Mesh objects are very useful because they allow us to create
  2515. objects containing hundreds or thousands of triangles. Compared
  2516. to a simple union of triangles the mesh object stores the
  2517. triangles more efficiently. Copies of mesh objects need only a
  2518. little additional memory because the triangles are stored only
  2519. once.
  2520.  
  2521. Almost every object can be approximated using triangles but we
  2522. may need a lot of triangles to create more complex shapes. Thus
  2523. we will only create a very simple mesh example. This example will
  2524. show a very useful feature of the triangles meshes though: a
  2525. different texture can be assigned to each triangle in the mesh.
  2526.  
  2527. Now let's begin. We will create a simple box with differently
  2528. colored sides. We create an empty file called meshdemo.pov and
  2529. add the following lines.
  2530.  
  2531.   camera {
  2532.     location <20, 20, -50>
  2533.     look_at <0, 5, 0>
  2534.   }
  2535.   light_source { <50, 50, -50> color rgb<1, 1, 1> }
  2536.   #declare Red = texture {
  2537.     pigment { color rgb<0.8, 0.2, 0.2> }
  2538.     finish { ambient 0.2 diffuse 0.5 }
  2539.   }
  2540.   #declare Green = texture {
  2541.     pigment { color rgb<0.2, 0.8, 0.2> }
  2542.     finish { ambient 0.2 diffuse 0.5 }
  2543.   }
  2544.   #declare Blue = texture {
  2545.     pigment { color rgb<0.2, 0.2, 0.8> }
  2546.     finish { ambient 0.2 diffuse 0.5 }
  2547.   }
  2548. We must declare all textures we want to use inside the mesh
  2549. before the mesh is created. Textures cannot be specified inside
  2550. the mesh due to the poor memory performance that would result.
  2551.  
  2552. Now we add the mesh object. Three sides of the box will use
  2553. individual textures while the other will use the global mesh
  2554. texture.
  2555.  
  2556.   mesh {
  2557.     /* top side */
  2558.     triangle { <-10, 10, -10>, <10, 10, -10>, <10, 10, 10>
  2559.       texture { Red }
  2560.     }
  2561.     triangle { <-10, 10, -10>, <-10, 10, 10>, <10, 10, 10>
  2562.       texture { Red }
  2563.     }
  2564.     /* bottom side */
  2565.     triangle { <-10, -10, -10>, <10, -10, -10>, <10, -10, 10> }
  2566.     triangle { <-10, -10, -10>, <-10, -10, 10>, <10, -10, 10> }
  2567.     /* left side */
  2568.     triangle { <-10, -10, -10>, <-10, -10, 10>, <-10, 10, 10> }
  2569.     triangle { <-10, -10, -10>, <-10, 10, -10>, <-10, 10, 10> }
  2570.     /* right side */
  2571.     triangle { <10, -10, -10>, <10, -10, 10>, <10, 10, 10>
  2572.       texture { Green }
  2573.     }
  2574.     triangle { <10, -10, -10>, <10, 10, -10>, <10, 10, 10>
  2575.       texture { Green }
  2576.     }
  2577.     /* front side */
  2578.     triangle { <-10, -10, -10>, <10, -10, -10>, <-10, 10, -10>
  2579.       texture { Blue }
  2580.     }
  2581.     triangle { <-10, 10, -10>, <10, 10, -10>, <10, -10, -10>
  2582.       texture { Blue }
  2583.     }
  2584.     /* back side */
  2585.     triangle { <-10, -10, 10>, <10, -10, 10>, <-10, 10, 10> }
  2586.     triangle { <-10, 10, 10>, <10, 10, 10>, <10, -10, 10> }
  2587.     texture {
  2588.       pigment { color rgb<0.9, 0.9, 0.9> }
  2589.       finish { ambient 0.2 diffuse 0.7 }
  2590.     }
  2591.   }
  2592. Tracing the scene at 320x240 we will see that the top, right and
  2593. front side of the box have different textures. Though this is not
  2594. a very impressive example it shows what we can do with mesh
  2595. objects. More complex examples, also using smooth triangles, can
  2596. be found under the scene directory as chesmsh.pov and
  2597. robotmsh.pov.
  2598.  
  2599.  
  2600. 2.4.6     Polygon Object
  2601. The polygon object can be used to create any planar, n-sided
  2602. shapes like squares, rectangles, pentagons, hexagons, octagons,
  2603. etc.
  2604.  
  2605. A polygon is defined by a number of points that describe its
  2606. shape. Since polygons have to be closed the first point has to be
  2607. repeated at the end of the point sequence.
  2608.  
  2609. In the following example we will create the word "POV" using just
  2610. one polygon statement.
  2611.  
  2612. We start with thinking about the points we need to describe the
  2613. desired shape. We want the letters to lie in the x-y-plane with
  2614. the letter O being at the center. The letters extend from y=0 to
  2615. y=1. Thus we get the following points for each letter (the z
  2616. coordinate is automatically set to zero).
  2617.  
  2618. Letter P (outer polygon):
  2619.     <-0.8, 0.0>, <-0.8, 1.0>,
  2620.     <-0.3, 1.0>, <-0.3, 0.5>,
  2621.     <-0.7, 0.5>, <-0.7, 0.0>
  2622. Letter P (inner polygon):
  2623.     <-0.7, 0.6>, <-0.7, 0.9>,
  2624.     <-0.4, 0.9>, <-0.4, 0.6>
  2625. Letter O (outer polygon):
  2626.     <-0.25, 0.0>, <-0.25, 1.0>,
  2627.     < 0.25, 1.0>, < 0.25, 0.0>
  2628. Letter O (inner polygon):
  2629.     <-0.15, 0.1>, <-0.15, 0.9>,
  2630.     < 0.15, 0.9>, < 0.15, 0.1>
  2631. Letter V:
  2632.     <0.45, 0.0>, <0.30, 1.0>,
  2633.     <0.40, 1.0>, <0.55, 0.1>,
  2634.     <0.70, 1.0>, <0.80, 1.0>,
  2635.     <0.65, 0.0>
  2636. Both letters P and O have a hole while the letter V consists of
  2637. only one polygon. We'll start with the letter V because it is
  2638. easier to define than the other two letters.
  2639.  
  2640. We create a new file called polygdem.pov and add the following
  2641. text.
  2642.  
  2643.   camera {
  2644.     orthographic
  2645.     location <0, 0, -10>
  2646.     right 1.3 * 4/3 * x
  2647.     up 1.3 * y
  2648.     look_at <0, 0.5, 0>
  2649.   }
  2650.   light_source { <25, 25, -100> color rgb 1 }
  2651.   polygon {
  2652.     8,
  2653.     <0.45, 0.0>, <0.30, 1.0>, // Letter "V"
  2654.     <0.40, 1.0>, <0.55, 0.1>,
  2655.     <0.70, 1.0>, <0.80, 1.0>,
  2656.     <0.65, 0.0>,
  2657.     <0.45, 0.0>
  2658.     pigment { color rgb <1, 0, 0> }
  2659.   }
  2660. As noted above the polygon has to be closed by appending the
  2661. first point to the point sequence. A closed polygon is always
  2662. defined by a sequence of points that ends when a point is the
  2663. same as the first point.
  2664.  
  2665. After we have created the letter V we'll continue with the letter
  2666. P. Since it has a hole we have to find a way of cutting this hole
  2667. into the basic shape. This is quite easy. We just define the
  2668. outer shape of the letter P, which is a closed polygon, and add
  2669. the sequence of points that describes the hole, which is also a
  2670. closed polygon. That's all we have to do. There'll be a hole
  2671. where both polygons overlap.
  2672.  
  2673. In general we will get holes whenever an even number of sub-
  2674. polygons inside a single polygon statement overlap. A sub-polygon
  2675. is defined by a closed sequence of points.
  2676.  
  2677. The letter P consists of two sub-polygons, one for the outer
  2678. shape and one for the hole. Since the hole polygon overlaps the
  2679. outer shape polygon we'll get a hole.
  2680.  
  2681. After we have understood how multiple sub-polygons in a single
  2682. polygon statement work, it is quite easy to add the missing O
  2683. letter.
  2684.  
  2685. Finally, we get the complete word POV.
  2686.  
  2687.   polygon {
  2688.     30,
  2689.     <-0.8, 0.0>, <-0.8, 1.0>,    // Letter "P"
  2690.     <-0.3, 1.0>, <-0.3, 0.5>,    // outer shape
  2691.     <-0.7, 0.5>, <-0.7, 0.0>,
  2692.     <-0.8, 0.0>,
  2693.     <-0.7, 0.6>, <-0.7, 0.9>,    // hole
  2694.     <-0.4, 0.9>, <-0.4, 0.6>,
  2695.     <-0.7, 0.6>
  2696.     <-0.25, 0.0>, <-0.25, 1.0>,  // Letter "O"
  2697.     < 0.25, 1.0>, < 0.25, 0.0>,  // outer shape
  2698.     <-0.25, 0.0>,
  2699.     <-0.15, 0.1>, <-0.15, 0.9>,  // hole
  2700.     < 0.15, 0.9>, < 0.15, 0.1>,
  2701.     <-0.15, 0.1>,
  2702.     <0.45, 0.0>, <0.30, 1.0>,    // Letter "V"
  2703.     <0.40, 1.0>, <0.55, 0.1>,
  2704.     <0.70, 1.0>, <0.80, 1.0>,
  2705.     <0.65, 0.0>,
  2706.     <0.45, 0.0>
  2707.     pigment { color rgb <1, 0, 0> }
  2708.   }
  2709.                                 
  2710.                                 
  2711.          The word "POV" made with one polygon statement.
  2712.                                 
  2713.  
  2714. 2.4.7     Prism Object
  2715. The prism is essentially a polygon or closed curve which is swept
  2716. along a linear path. We can imagine the shape so swept leaving a
  2717. trail in space, and the surface of that trail is the surface of
  2718. our prism. The curve or polygon making up a prism's face can be a
  2719. composite of any number of sub-shapes, can use any kind of three
  2720. different splines, and can either keep a constant width as it is
  2721. swept, or slowly tapering off to a fine point on one end. But
  2722. before this gets too confusing, let's start one step at a time
  2723. with the simplest form of prism. We enter and render the
  2724. following POV code (see file prismdm1.pov).
  2725.  
  2726.   #include "colors.inc"
  2727.   background{White}
  2728.   camera {
  2729.     angle 20
  2730.     location <2, 10, -30>
  2731.     look_at <0, 1, 0>
  2732.   }
  2733.   light_source { <20, 20, -20> color White }
  2734.   prism {
  2735.     linear_sweep
  2736.     linear_spline
  2737.     0, // sweep the following shape from here ...
  2738.     1, // ... up through here
  2739.     7, // the number of points making up the shape ...
  2740.     <3,5>, <-3,5>, <-5,0>, <-3,-5>, <3, -5>, <5,0>, <3,5>
  2741.     pigment { Green }
  2742.   }
  2743.                                 
  2744.                                 
  2745.                     A hexagonal prism shape.
  2746.                                 
  2747. This produces a hexagonal polygon, which is then swept from y=0
  2748. through y=1. In other words, we now have an extruded hexagon. One
  2749. point to note is that although this is a six sided figure, we
  2750. have used a total of seven points. That is because the polygon is
  2751. supposed to be a closed shape, which we do here by making the
  2752. final point the same as the first. Technically, with linear
  2753. polygons, if we didn't do this, POV-Ray would automatically join
  2754. the two ends with a line to force it to close, although a warning
  2755. would be issued. However, this only works with linear splines, so
  2756. we mustn't get too casual about those warning messages!
  2757.  
  2758.  
  2759. 2.4.7.1   Teaching An Old Spline New Tricks
  2760. If we followed the section on splines covered under the lathe
  2761. tutorial (see section "Understanding The Concept of Splines"), we
  2762. know that there are two additional kinds of splines besides
  2763. linear: the quadratic and the cubic spline. Sure enough, we can
  2764. use these with prisms to make a more free form, smoothly curving
  2765. type of prism.
  2766.  
  2767. There is just one catch, and we should read this section
  2768. carefully to keep from tearing our hair out over mysterious "too
  2769. few points in prism" messages which keep our prism from
  2770. rendering. We can probably guess where this is heading: how to
  2771. close a non-linear spline. Unlike the linear spline, which simply
  2772. draws a line between the last and first points if we forget to
  2773. make the last point equal to the first, quadratic and cubic
  2774. splines are a little more fussy.
  2775.  
  2776. First of all, we remember that quadratic splines determine the
  2777. equation of the curve which connects any two points based on
  2778. those two points and the previous point, so the first point in
  2779. any quadratic spline is just control point and won't actually be
  2780. part of the curve.  What this means is: when we make our shape
  2781. out of a quadratic spline, we must match the second point to the
  2782. last, since the first point is not on the curve - it's just a
  2783. control point needed for computational purposes.
  2784.  
  2785. Likewise, cubic splines need both the first and last points to be
  2786. control points, therefore, to close a shape made with a cubic
  2787. spline, we must match the second point to the second from last
  2788. point. If we don't match the correct points on a quadratic or
  2789. cubic shape, that's when we will get the "too few points in
  2790. prism" error. POV-Ray is still waiting for us to close the shape,
  2791. and when it runs out of points without seeing the closure, an
  2792. error is issued.
  2793.  
  2794. Confused? Okay, how about an example? We replace the prism in our
  2795. last bit of code with this one (see file prismdm2.pov).
  2796.  
  2797.   prism {
  2798.     cubic_spline
  2799.     0, // sweep the following shape from here ...
  2800.     1, // ... up through here
  2801.     6, // the number of points making up the shape ...
  2802.     < 3, -5>, // point#1 (control point... not on curve)
  2803.     < 3,  5>, // point#2  ... THIS POINT ...
  2804.     <-5,  0>, // point#3
  2805.     < 3, -5>, // point#4
  2806.     < 3,  5>, // point#5 ... MUST MATCH THIS POINT
  2807.     <-5,  0>  // point#6 (control point... not on curve)
  2808.     pigment { Green }
  2809.   }
  2810.                                 
  2811.                                 
  2812.                 A cubic, triangular prism shape.
  2813.                                 
  2814. This simple prism produces what looks like an extruded triangle
  2815. with its corners sanded smoothly off. Points two, three and four
  2816. are the corners of the triangle and point five closes the shape
  2817. by returning to the location of point two. As for points one and
  2818. six, they are our control points, and aren't part of the shape -
  2819. they're just there to help compute what curves to use between the
  2820. other points.
  2821.  
  2822.  
  2823. 2.4.7.2   Smooth Transitions
  2824. Now a handy thing to note is that we have made point one equal
  2825. point four, and also point six equals point three. Yes, this is
  2826. important. Although this prism would still be legally closed if
  2827. the control points were not what we've made them, the curve
  2828. transitions between points would not be as smooth. We change
  2829. points one and six to <4,6> and <0,7> respectively and re-render
  2830. to see how the back edge of the shape is altered (see file
  2831. prismdm3.pov).
  2832.  
  2833. To put this more generally, if we want a smooth closure on a
  2834. cubic spline, we make the first control point equal to the third
  2835. from last point, and the last control point equal to the third
  2836. point. On a quadratic spline, the trick is similar, but since
  2837. only the first point is a control point, make that equal to the
  2838. second from last point.
  2839.  
  2840.  
  2841. 2.4.7.3   Multiple Sub-Shapes
  2842. Just as with the polygon object (see section "Polygon Object")
  2843. the prism is very flexible, and allows us to make one prism out
  2844. of several sub-prisms. To do this, all we need to do is keep
  2845. listing points after we have already closed the first shape. The
  2846. second shape can be simply an add on going off in another
  2847. direction from the first, but one of the more interesting
  2848. features is that if any even number of sub-shapes overlap, that
  2849. region where they overlap behaves as though it has been cut away
  2850. from both sub-shapes. Let's look at another example. Once again,
  2851. same basic code as before for camera, light and so forth, but we
  2852. substitute this complex prism (see file prismdm4.pov).
  2853.  
  2854.   prism {
  2855.     linear_sweep
  2856.     cubic_spline
  2857.     0,  // sweep the following shape from here ...
  2858.     1,  // ... up through here
  2859.     18, // the number of points making up the shape ...
  2860.     <3,-5>, <3,5>, <-5,0>, <3, -5>, <3,5>, <-5,0>, // sub-shape
  2861. #1
  2862.     <2,-4>, <2,4>, <-4,0>, <2,-4>, <2,4>, <-4,0>,  // sub-shape
  2863. #2
  2864.     <1,-3>, <1,3>, <-3,0>, <1, -3>, <1,3>, <-3,0>  // sub-shape
  2865. #3
  2866.     pigment { Green }
  2867.   }
  2868.                                 
  2869.                                 
  2870.         Using sub-shapes to create a more complex shape.
  2871.                                 
  2872. For readability purposes, we have started a new line every time
  2873. we moved on to a new sub-shape, but the ray-tracer of course
  2874. tells where each shape ends based on whether the shape has been
  2875. closed (as described earlier). We render this new prism, and look
  2876. what we've got. It's the same familiar shape, but it now looks
  2877. like a smaller version of the shape has been carved out of the
  2878. center, then the carved piece was sanded down even smaller and
  2879. set back in the hole.
  2880.  
  2881. Simply, the outer rim is where only sub-shape one exists, then
  2882. the carved out part is where sub-shapes one and two overlap. In
  2883. the extreme center, the object reappears because sub-shapes one,
  2884. two, and three overlap, returning us to an odd number of
  2885. overlapping pieces. Using this technique we could make any number
  2886. of extremely complex prism shapes!
  2887.  
  2888.  
  2889. 2.4.7.4   Conic Sweeps And The Tapering Effect
  2890. In our original prism, the keyword linear_sweep is actually
  2891. optional. This is the default sweep assumed for a prism if no
  2892. type of sweep is specified. But there is another, extremely
  2893. useful kind of sweep: the conic sweep. The basic idea is like the
  2894. original prism, except that while we are sweeping the shape from
  2895. the first height through the second height, we are constantly
  2896. expanding it from a single point until, at the second height, the
  2897. shape has expanded to the original points we made it from. To
  2898. give a small idea of what such effects are good for, we replace
  2899. our existing prism with this (see file prismdm4.pov):
  2900.  
  2901.   prism {
  2902.     conic_sweep
  2903.     linear_spline
  2904.     0, // height 1
  2905.     1, // height 2
  2906.     5, // the number of points making up the shape...
  2907.     <4,4>,<-4,4>,<-4,-4>,<4,-4>,<4,4>
  2908.     rotate <180, 0, 0>
  2909.     translate <0, 1, 0>
  2910.     scale <1, 4, 1>
  2911.     pigment { gradient y scale .2 }
  2912.   }
  2913.                                 
  2914.                                 
  2915.             Creating a pyramid using conic sweeping.
  2916.                                 
  2917. The gradient pigment was selected to give some definition to our
  2918. object without having to fix the lights and the camera angle
  2919. right at this moment, but when we render it, we what we've
  2920. created? A horizontally striped pyramid! By now we can recognize
  2921. the linear spline connecting the four points of a square, and the
  2922. familiar final point which is there to close the spline.
  2923.  
  2924. Notice all the transformations in the object declaration. That's
  2925. going to take a little explanation. The rotate and translate are
  2926. easy. Normally, a conic sweep starts full sized at the top, and
  2927. tapers to a point at y=0, but of course that would be upside down
  2928. if we're making a pyramid. So we flip the shape around the x-axis
  2929. to put it right side up, then since we actually orbited around
  2930. the point, we translate back up to put it in the same position it
  2931. was in when we started.
  2932.  
  2933. The scale is to put the proportions right for this example. The
  2934. base is eight units by eight units, but the height (from y=1 to
  2935. y=0) is only one unit, so we've stretched it out a little. At
  2936. this point, we're probably thinking, "why not just sweep up from
  2937. y=0 to y=4 and avoid this whole scaling thing?"
  2938.  
  2939. That is a very important gotcha! with conic sweeps. To see what's
  2940. wrong with that, let's try and put it into practice (see file
  2941. prismdm5.pov). We must make sure to remove the scale statement,
  2942. and then replace the line which reads
  2943.  
  2944.   1, // height 2
  2945. with
  2946.  
  2947.   4, // height 2
  2948. This sets the second height at y=4, so let's re-render and see if
  2949. the effect is the same.
  2950.  
  2951.                                 
  2952.                                 
  2953.   Choosing a second height larger than one for the conic sweep.
  2954.                                 
  2955. Whoa! Our height is correct, but our pyramid's base is now huge!
  2956. What went wrong here? Simple. The base, as we described it with
  2957. the points we used actually occurs at y=1 no matter what we set
  2958. the second height for. But if we do set the second height higher
  2959. than one, once the sweep passes y=1, it keeps expanding outward
  2960. along the same lines as it followed to our original base, making
  2961. the actual base bigger and bigger as it goes.
  2962.  
  2963. To avoid losing control of a conic sweep prism, it is usually
  2964. best to let the second height stay at y=1, and use a scale
  2965. statement to adjust the height from its unit size. This way we
  2966. can always be sure the base's corners remain where we think they
  2967. are.
  2968.  
  2969. That leads to one more interesting thing about conic sweeps. What
  2970. if we for some reason don't want them to taper all the way to a
  2971. point? What if instead of a complete pyramid, we want more of a
  2972. ziggurat step? Easily done. After putting the second height back
  2973. to one, and replacing our scale statement, we change the line
  2974. which reads
  2975.  
  2976.   0, // height 1
  2977. to
  2978.  
  2979.   0.251, // height 1
  2980.                                 
  2981.                                 
  2982.         Increasing the first height for the conic sweep.
  2983.                                 
  2984. When we re-render, we see that the sweep stops short of going all
  2985. the way to its point, giving us a pyramid without a cap. Exactly
  2986. how much of the cap is cut off depends on how close the first
  2987. height is to the second height.
  2988.  
  2989.  
  2990. 2.4.8     Superquadric Ellipsoid Object
  2991. Sometimes we want to make an object that does not have perfectly
  2992. sharp edges like a box does. Then, the superquadric ellipsoid
  2993. shape made by the superellipsoid is a useful object. It is
  2994. described by the simple syntax:
  2995.  
  2996.     superellipsoid { <Value_E, Value_N >}
  2997. Where Value_E and Value_N are float values greater than zero and
  2998. less than or equal to one. Let's make a superellipsoid and
  2999. experiment with the values of Value_E and Value_N to see what
  3000. kind of shapes we can make.
  3001.  
  3002. We create a file called supellps.pov and edit it as follows:
  3003.  
  3004.   #include "colors.inc"
  3005.   camera {
  3006.     location <10, 5, -20>
  3007.     look_at 0
  3008.     angle 15
  3009.   }
  3010.   background { color rgb <.5, .5, .5> }
  3011.   light_source { <10, 50, -100> White }
  3012. The addition of a gray background makes it a little easier to see
  3013. our object. We now type:
  3014.  
  3015.   superellipsoid { <.25, .25>
  3016.     pigment { Red }
  3017.   }
  3018. We save the file and trace it at 200x150 -A to see the shape. It
  3019. will look like a box, but the edges will be rounded off. Now
  3020. let's experiment with different values of Value_E and Value_N.
  3021. For the next trace, try <1, 0.2>. The shape now looks like a
  3022. cylinder, but the top edges are rounded. Now try <0.1, 1>. This
  3023. shape is an odd one! We don't know exactly what to call it, but
  3024. it is interesting. Finally, lets try <1, 1>. Well, this is more
  3025. familiar... a sphere!
  3026.  
  3027. There are a couple of facts about superellipsoids we should know.
  3028. First, we should not use a value of 0 for either Value_E nor
  3029. Value_N. This will cause POV-Ray to incorrectly make a black box
  3030. instead of our desired shape. Second, very small values of
  3031. Value_E and Value_N may yield strange results so they should be
  3032. avoided. Finally, the Sturmian root solver will not work with
  3033. superellipsoids.
  3034.  
  3035. Superellipsoids are finite objects so they respond to auto-
  3036. bounding and can be used in CSG.
  3037.  
  3038. Now let's use the superellipsoid to make something that would be
  3039. useful in a scene. We will make a tiled floor and place a couple
  3040. of superellipsoid objects hovering over it. We can start with the
  3041. file we have already made.
  3042.  
  3043. We rename it to tiles.pov and edit it so that it reads as
  3044. follows:
  3045.  
  3046.   #include "colors.inc"
  3047.   #include "textures.inc"
  3048.   camera {
  3049.     location <10, 5, -20>
  3050.     look_at 0
  3051.     angle 15
  3052.   }
  3053.   background { color rgb <.5, .5, .5> }
  3054.   light_source{ <10, 50, -100> White }
  3055. Note that we have added #include "textures.inc" so we can use pre-
  3056. defined textures. Now we want to define the superellipsoid which
  3057. will be our tile.
  3058.  
  3059.   #declare Tile = superellipsoid { <0.5, 0.1>
  3060.     scale <1, .05, 1>
  3061.   }
  3062. Superellipsoids are roughly 2*2*2 units unless we scale them
  3063. otherwise. If we wish to lay a bunch of our tiles side by side,
  3064. they will have to be offset from each other so they don't
  3065. overlap. We should select an offset value that is slightly more
  3066. than 2 so that we have some space between the tiles to fill with
  3067. grout. So we now add this:
  3068.  
  3069.   #declare Offset = 2.1;
  3070. We now want to lay down a row of tiles. Each tile will be offset
  3071. from the original by an ever-increasing amount in both the +z and
  3072. -z directions. We refer to our offset and multiply by the tile's
  3073. rank to determine the position of each tile in the row. We also
  3074. union these tiles into a single object called Row like this:
  3075.  
  3076.   #declare Row = union {
  3077.     object { Tile }
  3078.     object { Tile translate z*Offset }
  3079.     object { Tile translate z*Offset*2 }
  3080.     object { Tile translate z*Offset*3 }
  3081.     object { Tile translate z*Offset*4 }
  3082.     object { Tile translate z*Offset*5 }
  3083.     object { Tile translate z*Offset*6 }
  3084.     object { Tile translate z*Offset*7 }
  3085.     object { Tile translate z*Offset*8 }
  3086.     object { Tile translate z*Offset*9 }
  3087.     object { Tile translate z*Offset*10 }
  3088.     object { Tile translate -z*Offset }
  3089.     object { Tile translate -z*Offset*2 }
  3090.     object { Tile translate -z*Offset*3 }
  3091.     object { Tile translate -z*Offset*4 }
  3092.     object { Tile translate -z*Offset*5 }
  3093.     object { Tile translate -z*Offset*6 }
  3094.   }
  3095. This gives us a single row of 17 tiles, more than enough to fill
  3096. the screen. Now we must make copies of the Row and translate
  3097. them, again by the offset value, in both the +x and -x directions
  3098. in ever increasing amounts in the same manner.
  3099.  
  3100.   object { Row }
  3101.   object { Row translate x*Offset }
  3102.   object { Row translate x*Offset*2 }
  3103.   object { Row translate x*Offset*3 }
  3104.   object { Row translate x*Offset*4 }
  3105.   object { Row translate x*Offset*5 }
  3106.   object { Row translate x*Offset*6 }
  3107.   object { Row translate x*Offset*7 }
  3108.   object { Row translate -x*Offset }
  3109.   object { Row translate -x*Offset*2 }
  3110.   object { Row translate -x*Offset*3 }
  3111.   object { Row translate -x*Offset*4 }
  3112.   object { Row translate -x*Offset*5 }
  3113.   object { Row translate -x*Offset*6 }
  3114.   object { Row translate -x*Offset*7 }
  3115. Finally, our tiles are complete. But we need a texture for them.
  3116. To do this we union all of the Rows together and apply a White
  3117. Marble pigment and a somewhat shiny reflective surface to it:
  3118.  
  3119.   union{
  3120.     object { Row }
  3121.     object { Row translate x*Offset }
  3122.     object { Row translate x*Offset*2 }
  3123.     object { Row translate x*Offset*3 }
  3124.     object { Row translate x*Offset*4 }
  3125.     object { Row translate x*Offset*5 }
  3126.     object { Row translate x*Offset*6 }
  3127.     object { Row translate x*Offset*7 }
  3128.     object { Row translate -x*Offset }
  3129.     object { Row translate -x*Offset*2 }
  3130.     object { Row translate -x*Offset*3 }
  3131.     object { Row translate -x*Offset*4 }
  3132.     object { Row translate -x*Offset*5 }
  3133.     object { Row translate -x*Offset*6 }
  3134.     object { Row translate -x*Offset*7 }
  3135.     pigment { White_Marble }
  3136.     finish { phong 1 phong_size 50 reflection .35 }
  3137.   }
  3138. We now need to add the grout. This can simply be a white plane.
  3139. We have stepped up the ambient here a little so it looks whiter.
  3140.  
  3141.   plane { y, 0  //this is the grout
  3142.     pigment { color White }
  3143.     finish { ambient .4 diffuse .7 }
  3144.   }
  3145. To complete our scene, let's add five different superellipsoids,
  3146. each a different color, so that they hover over our tiles and are
  3147. reflected in them.
  3148.  
  3149.   superellipsoid {
  3150.     <0.1, 1>
  3151.     pigment { Red }
  3152.     translate <5, 3, 0>
  3153.     scale .45
  3154.   }
  3155.   superellipsoid {
  3156.     <1, 0.25>
  3157.     pigment { Blue }
  3158.     translate <-5, 3, 0>
  3159.     scale .45
  3160.   }
  3161.   superellipsoid {
  3162.     <0.2, 0.6>
  3163.     pigment { Green }
  3164.     translate <0, 3, 5>
  3165.     scale .45
  3166.   }
  3167.   superellipsoid {
  3168.     <0.25, 0.25>
  3169.     pigment { Yellow }
  3170.     translate <0, 3, -5>
  3171.     scale .45
  3172.   }
  3173.   superellipsoid {
  3174.     <1, 1>
  3175.     pigment { Pink }
  3176.     translate y*3
  3177.     scale .45
  3178.   }
  3179.                                 
  3180.                                 
  3181.        Some superellipsoids hovering above a tiled floor.
  3182.                                 
  3183. We trace the scene at 320x200 -A to see the result. If we are
  3184. happy with that, we do a final trace at 640x480 +A0.2.
  3185.  
  3186.  
  3187. 2.4.9     Surface of Revolution Object
  3188. Bottles, vases and glasses make nice objects in ray-traced
  3189. scenes. We want to create a golden cup using the surface of
  3190. revolution object (SOR object).
  3191.  
  3192. We first start by thinking about the shape of the final object.
  3193. It is quite difficult to come up with a set of points that
  3194. describe a given curve without the help of a modeling program
  3195. supporting POV-Ray's surface of revolution object. If such a
  3196. program is available we should take advantage of it.
  3197.  
  3198.                                 
  3199.                                 
  3200.            The point configuration of our cup object.
  3201.                                 
  3202. We will use the point configuration shown in the figure above.
  3203. There are eight points describing the curve that will be rotated
  3204. about the y-axis to get our cup. The curve was calculated using
  3205. the method described in the reference section (see "Surface of
  3206. Revolution").
  3207.  
  3208. Now it is time to come up with a scene that uses the above SOR
  3209. object. We edit a file called sordemo.pov and enter the following
  3210. text.
  3211.  
  3212.   #include "colors.inc"
  3213.   #include "golds.inc"
  3214.   global_settings { assumed_gamma 2.2 }
  3215.   camera {
  3216.     location <10, 15, -20>
  3217.     look_at <0, 5, 0>
  3218.     angle 45
  3219.   }
  3220.   background { color rgb<0.2, 0.4, 0.8>  }
  3221.   light_source { <100, 100, -100> color rgb 1 }
  3222.   plane { y, 0
  3223.     pigment { checker color Red, color Green scale 10 }
  3224.   }
  3225.   sor {
  3226.     8,
  3227.     <0.0,  -0.5>,
  3228.     <3.0,   0.0>,
  3229.     <1.0,   0.2>,
  3230.     <0.5,   0.4>,
  3231.     <0.5,   4.0>,
  3232.     <1.0,   5.0>,
  3233.     <3.0,  10.0>,
  3234.     <4.0,  11.0>
  3235.     texture { T_Gold_1B }
  3236.   }
  3237. The scene contains our cup object resting on a checkered plane.
  3238. Tracing this scene results in the image below.
  3239.  
  3240.                                 
  3241.                                 
  3242.                  A surface of revolution object.
  3243.                                 
  3244. The surface of revolution is described by starting with the
  3245. number of points followed by the points with ascending heights.
  3246. Each point determines the radius of the curve for a given height.
  3247. E. g. the first point tells POV-Ray that at height -0.5 the
  3248. radius is 0. We should take care that each point has a larger
  3249. height than its predecessor. If this is not the case the program
  3250. will abort with an error message.
  3251.  
  3252.  
  3253. 2.4.10    Text Object
  3254. Creating text objects using POV-Ray always used to mean that the
  3255. letters had to be built either from CSG, a painstaking process or
  3256. by using a black and white image of the letters as a height
  3257. field, a method that was only somewhat satisfactory. Now, for POV-
  3258. Ray 3.0, a new primitive has been introduced that can use any
  3259. TrueType font to create text objects. These objects can be used
  3260. in CSG, transformed and textured just like any other POV
  3261. primitive.
  3262.  
  3263. For this tutorial, we will make two uses of the text object.
  3264. First, let's just make some block letters sitting on a checkered
  3265. plane. Any TTF font should do, but for this tutorial, we will use
  3266. the timrom.ttf or cyrvetic.ttf which come bundled with POV-Ray.
  3267. We create a file called textdemo.pov and edit it as follows:
  3268.  
  3269.   #include "colors.inc"
  3270.   camera {
  3271.     location <0, 1, -10>
  3272.     look_at 0
  3273.     angle 35
  3274.   }
  3275.   light_source { <500,500,-1000> White }
  3276.   plane { y,0
  3277.     pigment { checker Green White }
  3278.   }
  3279. Now let's add the text object. We will use the font timrom.ttf
  3280. and we will create the string "POV-RAY 3.0". For now, we will
  3281. just make the letters red. The syntax is very simple. The first
  3282. string in quotes is the font name, the second one is the string
  3283. to be rendered. The two floats are the thickness and offset
  3284. values. The thickness float determines how thick the block
  3285. letters will be. Values of .5 to 2 are usually best for this. The
  3286. offset value will add to the kerning distance of the letters. We
  3287. will leave this a 0 for now.
  3288.  
  3289.   text { ttf "timrom.ttf" "POV-RAY 3.0" 1, 0
  3290.     pigment { Red }
  3291.   }
  3292. Rendering this at 200x150 -A, we notice that the letters are off
  3293. to the right of the screen. This is because they are placed so
  3294. that the lower left front corner of the first letter is at the
  3295. origin. To center the string we need to translate it -x some
  3296. distance. But how far? In the docs we see that the letters are
  3297. all 0.5 to 0.75 units high. If we assume that each one takes
  3298. about 0.5 units of space on the x-axis, this means that the
  3299. string is about 6 units long (12 characters and spaces). Let's
  3300. translate the string 3 units along the negative x-axis.
  3301.  
  3302.   text { ttf "timrom.ttf" "POV-RAY 3.0" 1, 0
  3303.     pigment { Red }
  3304.     translate -3*x
  3305.   }
  3306. That's better. Now let's play around with some of the parameters
  3307. of the text object. First, let's raise the thickness float to
  3308. something outlandish... say 25!
  3309.  
  3310.   text { ttf "timrom.ttf" "POV-RAY 3.0" 25, 0
  3311.     pigment { Red }
  3312.     translate -2.25*x
  3313.   }
  3314. Actually, that's kind of cool. Now let's return the thickness
  3315. value to 1 and try a different offset value. Change the offset
  3316. float from 0 to 0.1 and render it again.
  3317.  
  3318. Wait a minute?! The letters go wandering off up at an angle! That
  3319. is not what the docs describe! It almost looks as if the offset
  3320. value applies in both the x- and y-axis instead of just the x
  3321. axis like we intended. Could it be that a vector is called for
  3322. here instead of a float? Let's try it. We replace 0.1 with 0.1*x
  3323. and render it again.
  3324.  
  3325. That works! The letters are still in a straight line along the x-
  3326. axis, just a little further apart. Let's verify this and try to
  3327. offset just in the y-axis. We replace 0.1*x with 0.1*y. Again,
  3328. this works as expected with the letters going up to the right at
  3329. an angle with no additional distance added along the x-axis. Now
  3330. let's try the z-axis. We replace 0.1*y with 0.1*z. Rendering this
  3331. yields a disappointment. No offset occurs! The offset value can
  3332. only be applied in the x- and y-directions.
  3333.  
  3334. Let's finish our scene by giving a fancier texture to the block
  3335. letters, using that cool large thickness value, and adding a
  3336. slight y-offset. For fun, we will throw in a sky sphere, dandy up
  3337. our plane a bit, and use a little more interesting camera
  3338. viewpoint (we render the following scene at 640x480 +A0.2):
  3339.  
  3340.   #include "colors.inc"
  3341.   camera {
  3342.     location <-5,.15,-2>
  3343.     look_at <.3,.2,1>
  3344.     angle 35
  3345.   }
  3346.   light_source { <500,500,-1000> White }
  3347.   plane { y,0
  3348.     texture {
  3349.       pigment { SeaGreen }
  3350.       finish { reflection .35 specular 1 }
  3351.       normal { ripples .35 turbulence .5 scale .25 }
  3352.     }
  3353.   }
  3354.   text { ttf "timrom.ttf" "POV-RAY 3.0" 25, 0.1*y
  3355.     pigment { BrightGold }
  3356.     finish { reflection .25 specular 1 }
  3357.     translate -3*x
  3358.   }
  3359.   #include "skies.inc"
  3360.   sky_sphere { S_Cloud5 }
  3361. Let's try using text in a CSG object. We will attempt to create
  3362. an inlay in a stone block using a text object. We create a new
  3363. file called textcsg.pov and edit it as follows:
  3364.  
  3365.   #include "colors.inc"
  3366.   #include "stones.inc"
  3367.   background { color rgb 1 }
  3368.   camera {
  3369.     location <-3, 5, -15>
  3370.     look_at 0
  3371.     angle 25
  3372.   }
  3373.   light_source { <500,500,-1000> White }
  3374. Now let's create the block. We want it to be about eight units
  3375. across because our text string "POV-RAY 3.0" is about six units
  3376. long. We also want it about four units high and about one unit
  3377. deep. But we need to avoid a potential coincident surface with
  3378. the text object so we will make the first z-coordinate 0.1
  3379. instead of 0. Finally, we will give this block a nice stone
  3380. texture.
  3381.  
  3382.   box { <-3.5, -1, 0.1>, <3.5, 1, 1>
  3383.     texture { T_Stone10 }
  3384.   }
  3385. Next, we want to make the text object. We can use the same object
  3386. we used in the first tutorial except we will use slightly
  3387. different thickness and offset values.
  3388.  
  3389.   text { ttf "timrom.ttf" "POV-RAY 3.0" 0.15, 0
  3390.     pigment { BrightGold }
  3391.     finish { reflection .25 specular 1 }
  3392.     translate -3*x
  3393.   }
  3394. We remember that the text object is placed by default so that its
  3395. front surface lies directly on the x-y-plane. If the front of the
  3396. box begins at z=0.1 and thickness is set at 0.15, the depth of
  3397. the inlay will be 0.05 units. We place a difference block around
  3398. the two objects.
  3399.  
  3400.   difference {
  3401.     box { <-3.5, -1, 0.1>, <3.5, 1, 1>
  3402.       texture { T_Stone10 }
  3403.     }
  3404.     text { ttf "timrom.ttf" "POV-RAY 3.0" 0.15, 0
  3405.       pigment { BrightGold }
  3406.       finish { reflection .25 specular 1 }
  3407.       translate -3*x
  3408.     }
  3409.   }
  3410.                                 
  3411.                                 
  3412.                      Text carved from stone.
  3413.                                 
  3414. We render this at 200x150 -A. We can see the inlay clearly and
  3415. that it is indeed a bright gold color. We re-render at 640x480
  3416. +A0.2 to see the results more clearly, but be forewarned... this
  3417. trace will take a little time.
  3418.  
  3419.  
  3420. 2.4.11    Torus Object
  3421. A torus can be thought of as a donut or an inner-tube. It is a
  3422. shape that is vastly useful in many kinds of CSG so POV-Ray has
  3423. adopted this 4th order quartic polynomial as a primitive shape.
  3424. The syntax for a torus is so simple that it makes it a very easy
  3425. shape to work with once we learn what the two float values mean.
  3426. Instead of a lecture on the subject, let's create one and do some
  3427. experiments with it.
  3428.  
  3429. We create a file called tordemo.pov and edit it as follows:
  3430.  
  3431.   #include "colors.inc"
  3432.   camera {
  3433.     location <0, .1, -25>
  3434.     look_at 0
  3435.     angle 30
  3436.   }
  3437.   background { color Gray50 } // to make the torus easy to see
  3438.   light_source{ <300, 300, -1000> White }
  3439.   torus { 4, 1        // major and minor radius
  3440.     rotate -90*x      // so we can see it from the top
  3441.     pigment { Green }
  3442.   }
  3443. We trace the scene. Well, it's a donut alright. Let's try
  3444. changing the major and minor radius values and see what happens.
  3445. We change them as follows:
  3446.  
  3447.   torus { 5, .25      // major and minor radius
  3448. That looks more like a hula-hoop! Let's try this:
  3449.  
  3450.   torus { 3.5, 2.5    // major and minor radius
  3451. Whoa! A donut with a serious weight problem!
  3452.  
  3453. With such a simple syntax, there isn't much else we can do to a
  3454. torus besides change its texture... or is there? Let's see...
  3455.  
  3456. Torii are very useful objects in CSG. Let's try a little
  3457. experiment. We make a difference of a torus and a box:
  3458.  
  3459.   difference {
  3460.     torus { 4, 1
  3461.       rotate x*-90  // so we can see it from the top
  3462.     }
  3463.     box { <-5, -5, -1>, <5, 0, 1> }
  3464.     pigment { Green }
  3465.   }
  3466. Interesting... a half-torus. Now we add another one flipped the
  3467. other way. Only, let's declare the original half-torus and the
  3468. necessary transformations so we can use them again:
  3469.  
  3470.   #declare Half_Torus = difference {
  3471.     torus { 4, 1
  3472.       rotate -90*x  // so we can see it from the top
  3473.     }
  3474.     box { <-5, -5, -1>, <5, 0, 1> }
  3475.     pigment { Green }
  3476.   }
  3477.   #declare Flip_It_Over = 180*x;
  3478.   #declare Torus_Translate = 8;  // twice the major radius
  3479. Now we create a union of two Half_Torus objects:
  3480.  
  3481.   union {
  3482.     object { Half_Torus }
  3483.     object { Half_Torus
  3484.       rotate Flip_It_Over
  3485.       translate Torus_Translate*x
  3486.     }
  3487.   }
  3488. This makes an S-shaped object, but we can't see the whole thing
  3489. from our present camera. Let's add a few more links, three in
  3490. each direction, move the object along the +z-direction and rotate
  3491. it about the +y-axis so we can see more of it. We also notice
  3492. that there appears to be a small gap where the half Torii meet.
  3493. This is due to the fact that we are viewing this scene from
  3494. directly on the x-z-plane. We will change the camera's y-
  3495. coordinate from 0 to 0.1 to eliminate this.
  3496.  
  3497.   union {
  3498.     object { Half_Torus }
  3499.     object { Half_Torus
  3500.       rotate Flip_It_Over
  3501.       translate x*Torus_Translate
  3502.     }
  3503.     object { Half_Torus
  3504.       translate x*Torus_Translate*2
  3505.     }
  3506.     object { Half_Torus
  3507.       rotate Flip_It_Over
  3508.       translate x*Torus_Translate*3
  3509.     }
  3510.     object { Half_Torus
  3511.       rotate Flip_It_Over
  3512.       translate -x*Torus_Translate
  3513.     }
  3514.     object { Half_Torus
  3515.       translate -x*Torus_Translate*2
  3516.     }
  3517.     object { Half_Torus
  3518.       rotate Flip_It_Over
  3519.       translate -x*Torus_Translate*3
  3520.     }
  3521.     object { Half_Torus
  3522.       translate -x*Torus_Translate*4
  3523.     }
  3524.     rotate y*45
  3525.     translate z*20
  3526.   }
  3527. Rendering this we see a cool, undulating, snake-like something-or-
  3528. other. Neato. But we want to model something useful, something
  3529. that we might see in real life. How about a chain?
  3530.  
  3531. Thinking about it for a moment, we realize that a single link of
  3532. a chain can be easily modeled using two half tori and two
  3533. cylinders. We create a new file. We can use the same camera,
  3534. background, light source and declared objects and transformations
  3535. as we used in tordemo.pov:
  3536.  
  3537.   #include "colors.inc"
  3538.   camera {
  3539.     location <0, .1, -25>
  3540.     look_at 0
  3541.     angle 30
  3542.   }
  3543.   background { color Gray50 }
  3544.   light_source{ <300, 300, -1000> White }
  3545.   #declare Half_Torus = difference {
  3546.     torus { 4,1
  3547.       sturm
  3548.       rotate x*-90  // so we can see it from the top
  3549.     }
  3550.     box { <-5, -5, -1>, <5, 0, 1> }
  3551.     pigment { Green }
  3552.   }
  3553.   #declare Flip_It_Over = x*180;
  3554.   #declare Torus_Translate = 8;
  3555. Now, we make a complete torus of two half tori:
  3556.  
  3557.   union {
  3558.     object { Half_Torus }
  3559.     object { Half_Torus rotate Flip_It_Over }
  3560.   }
  3561. This may seem like a wasteful way to make a complete torus, but
  3562. we are really going to move each half apart to make room for the
  3563. cylinders. First, we add the declared cylinder before the union:
  3564.  
  3565.   #declare Chain_Segment = cylinder { <0, 4, 0>, <0, -4, 0>, 1
  3566.     pigment { Green }
  3567.   }
  3568. We then add two Chain_Segments to the union and translate them so
  3569. that they line up with the minor radius of the torus on each
  3570. side:
  3571.  
  3572.   union {
  3573.     object { Half_Torus }
  3574.     object { Half_Torus rotate Flip_It_Over }
  3575.     object { Chain_Segment translate  x*Torus_Translate/2 }
  3576.     object { Chain_Segment translate -x*Torus_Translate/2 }
  3577.   }
  3578. Now we translate the two half tori +y and -y so that the clipped
  3579. ends meet the ends of the cylinders. This distance is equal to
  3580. half of the previously declared Torus_Translate:
  3581.  
  3582.   union {
  3583.     object { Half_Torus
  3584.       translate y*Torus_Translate/2
  3585.     }
  3586.     object { Half_Torus
  3587.       rotate Flip_It_Over
  3588.       translate -y*Torus_Translate/2
  3589.     }
  3590.     object { Chain_Segment
  3591.       translate x*Torus_Translate/2
  3592.     }
  3593.     object { Chain_Segment
  3594.       translate -x*Torus_Translate/2
  3595.     }
  3596.   }
  3597. We render this and viola! A single link of a chain. But we aren't
  3598. done yet! Whoever heard of a green chain? We would rather use a
  3599. nice metallic color instead. First, we remove any pigment blocks
  3600. in the declared torsos and cylinders. Then we add the following
  3601. before the union:
  3602.  
  3603.   #declare Chain_Gold = texture {
  3604.     pigment { BrightGold }
  3605.     finish {
  3606.       ambient .1
  3607.       diffuse .4
  3608.       reflection .25
  3609.       specular 1
  3610.       metallic
  3611.     }
  3612.   }
  3613. We then add the texture to the union and declare the union as a
  3614. single link:
  3615.  
  3616.   #declare Link = union {
  3617.     object { Half_Torus
  3618.       translate y*Torus_Translate/2
  3619.     }
  3620.     object { Half_Torus
  3621.       rotate Flip_It_Over
  3622.       translate -y*Torus_Translate/2
  3623.     }
  3624.     object { Chain_Segment
  3625.       translate x*Torus_Translate/2
  3626.     }
  3627.     object { Chain_Segment
  3628.       translate -x*Torus_Translate/2
  3629.     }
  3630.     texture { Chain_Gold }
  3631.   }
  3632. Now we make a union of two links. The second one will have to be
  3633. translated +y so that its inner wall just meets the inner wall of
  3634. the other link, just like the links of a chain. This distance
  3635. turns out to be double the previously declared Torus_Translate
  3636. minus 2 (twice the minor radius). This can be described by the
  3637. expression:
  3638.  
  3639.   Torus_Translate*2-2*y
  3640. We declare this expression as follows:
  3641.  
  3642.   #declare Link_Translate = Torus_Translate*2-2*y;
  3643. In the object block, we will use this declared value so that we
  3644. can multiply it to create other links. Now, we rotate the second
  3645. link 90*y so that it is perpendicular to the first, just like
  3646. links of a chain. Finally, we scale the union by 1/4 so that we
  3647. can see the whole thing:
  3648.  
  3649.   union {
  3650.     object { Link }
  3651.     object { Link translate y*Link_Translate rotate y*90 }
  3652.     scale .25
  3653.   }
  3654. We render this and we will see a very realistic pair of links. If
  3655. we want to make an entire chain, we must declare the above union
  3656. and then create another union of this declared object. We must be
  3657. sure to remove the scaling from the declared object:
  3658.  
  3659.   #declare Link_Pair =
  3660.   union {
  3661.     object { Link }
  3662.     object { Link translate y*Link_Translate rotate y*90 }
  3663.   }
  3664. Now we declare our chain:
  3665.  
  3666.   #declare Chain = union {
  3667.     object { Link_Pair}
  3668.     object { Link_Pair translate  y*Link_Translate*2 }
  3669.     object { Link_Pair translate  y*Link_Translate*4 }
  3670.     object { Link_Pair translate  y*Link_Translate*6 }
  3671.     object { Link_Pair translate -y*Link_Translate*2 }
  3672.     object { Link_Pair translate -y*Link_Translate*4 }
  3673.     object { Link_Pair translate -y*Link_Translate*6 }
  3674.   }
  3675. And finally we create our chain with a couple of transformations
  3676. to make it easier to see. These include scaling it down by a
  3677. factor of 1/10, and rotating it so that we can clearly see each
  3678. link:
  3679.  
  3680.   object { Chain scale .1 rotate <0, 45, -45> }
  3681.                                 
  3682.                                 
  3683.          The torus object can be used to create chains.
  3684.                                 
  3685. We render this and we should see a very realistic gold chain
  3686. stretched diagonally across the screen.
  3687.  
  3688.  
  3689. 2.5  The Light Source
  3690. In any ray-traced scene, the light needed to illuminate our
  3691. objects and their surfaces must come from a light source. There
  3692. are many kinds of light sources available in POV-Ray and careful
  3693. use of the correct kind can yield very impressive results. Let's
  3694. take a moment to explore some of the different kinds of light
  3695. sources and their various parameters.
  3696.  
  3697.  
  3698. 2.5.1     The Pointlight Source
  3699. Pointlights are exactly what the name indicates. A pointlight has
  3700. no size, is invisible and illuminates everything in the scene
  3701. equally no matter how far away from the light source it may be
  3702. (this behavior can be changed). This is the simplest and most
  3703. basic light source. There are only two important parameters,
  3704. location and color. Let's design a simple scene and place a
  3705. pointlight source in it.
  3706.  
  3707. We create a new file and name it litedemo.pov. We edit it as
  3708. follows:
  3709.  
  3710.   #include "colors.inc"
  3711.   #include "textures.inc"
  3712.   camera {
  3713.     location  <-4, 3, -9>
  3714.     look_at   <0, 0, 0>
  3715.     angle 48
  3716.   }
  3717. We add the following simple objects:
  3718.  
  3719.   plane { y, -1
  3720.     texture {
  3721.       pigment {
  3722.         checker
  3723.         color rgb<0.5, 0, 0>
  3724.         color rgb<0, 0.5, 0.5>
  3725.       }
  3726.       finish {
  3727.         diffuse 0.4
  3728.         ambient 0.2
  3729.         phong 1
  3730.         phong_size 100
  3731.         reflection 0.25
  3732.       }
  3733.     }
  3734.   }
  3735.   torus { 1.5, 0.5
  3736.     texture { Brown_Agate }
  3737.     rotate <90, 160, 0>
  3738.     translate  <-1, 1, 3>
  3739.   }
  3740.   box { <-1, -1, -1>, <1, 1, 1>
  3741.     texture { DMFLightOak }
  3742.     translate  <2, 0, 2.3>
  3743.   }
  3744.   cone { <0,1,0>, 0, <0,0,0>, 1
  3745.     texture { PinkAlabaster }
  3746.     scale <1, 3, 1>
  3747.     translate  <-2, -1, -1>
  3748.   }
  3749.   sphere { <0,0,0>,1
  3750.     texture { Sapphire_Agate }
  3751.     translate  <1.5, 0, -2>
  3752.   }
  3753. Now we add a pointlight:
  3754.  
  3755.   light_source {
  3756.     <2, 10, -3>
  3757.     color White
  3758.   }
  3759. We render this at 200x150 -A and see that the objects are clearly
  3760. visible with sharp shadows. The sides of curved objects nearest
  3761. the light source are brightest in color with the areas that are
  3762. facing away from the light source being darkest. We also note
  3763. that the checkered plane is illuminated evenly all the way to the
  3764. horizon. This allows us to see the plane, but it is not very
  3765. realistic.
  3766.  
  3767.  
  3768. 2.5.2     The Spotlight Source
  3769. Spotlights are a very useful type of light source. They can be
  3770. used to add highlights and illuminate features much as a
  3771. photographer uses spots to do the same thing. To create a
  3772. spotlight simply add the spotlight keyword to a regular point
  3773. light.  There are a few more parameters with spotlights than with
  3774. pointlights. These are radius, falloff, tightness and point_at.
  3775. The radius parameter is the angle of the fully illuminated cone.
  3776. The falloff parameter is the angle of the umbra cone where the
  3777. light falls off to darkness. The tightness is a parameter that
  3778. determines the rate of the light falloff. The point_at parameter
  3779. is just what it says, the location where the spotlight is
  3780. pointing to. Let's change the light in our scene as follows:
  3781.  
  3782.   light_source {
  3783.     <0, 10, -3>
  3784.     color White
  3785.     spotlight
  3786.     radius 15
  3787.     falloff 20
  3788.     tightness 10
  3789.     point_at <0, 0, 0>
  3790.   }
  3791. We render this at 200x150 -A and see that only the objects are
  3792. illuminated. The rest of the plane and the outer portions of the
  3793. objects are now unlit. There is a broad falloff area but the
  3794. shadows are still razor sharp. Let's try fiddling with some of
  3795. these parameters to see what they do. We change the falloff value
  3796. to 16 (it must always be larger than the radius value) and render
  3797. again.  Now the falloff is very narrow and the objects are either
  3798. brightly lit or in total darkness. Now we change falloff back to
  3799. 20 and change the tightness value to 100 (higher is tighter) and
  3800. render again. The spotlight appears to have gotten much smaller
  3801. but what has really happened is that the falloff has become so
  3802. steep that the radius actually appears smaller.
  3803.  
  3804. We decide that a tightness value of 10 (the default) and a
  3805. falloff value of 18 are best for this spotlight and we now want
  3806. to put a few spots around the scene for effect. Let's place a
  3807. slightly narrower blue and a red one in addition to the white one
  3808. we already have:
  3809.  
  3810.   light_source {
  3811.     <10, 10, -1>
  3812.     color Red
  3813.     spotlight
  3814.     radius 12
  3815.     falloff 14
  3816.     tightness 10
  3817.     point_at <2, 0, 0>
  3818.   }
  3819.   light_source {
  3820.     <-12, 10, -1>
  3821.     color Blue
  3822.     spotlight
  3823.     radius 12
  3824.     falloff 14
  3825.     tightness 10
  3826.     point_at <-2, 0, 0>
  3827.   }
  3828. Rendering this we see that the scene now has a wonderfully
  3829. mysterious air to it. The three spotlights all converge on the
  3830. objects making them blue on one side and red on the other with
  3831. enough white in the middle to provide a balance.
  3832.  
  3833.  
  3834. 2.5.3     The Cylindrical Light Source
  3835. Spotlights are cone shaped, meaning that their effect will change
  3836. with distance. The farther away from the spotlight an object is,
  3837. the larger the apparent radius will be. But we may want the
  3838. radius and falloff to be a particular size no matter how far away
  3839. the spotlight is. For this reason, cylindrical light sources are
  3840. needed. A cylindrical light source is just like a spotlight,
  3841. except that the radius and falloff regions are the same no matter
  3842. how far from the light source our object is. The shape is
  3843. therefore a cylinder rather than a cone. We can specify a
  3844. cylindrical light source by replacing the spotlight keyword with
  3845. the cylinder keyword. We try this now with our scene by replacing
  3846. all three spotlights with cylinder lights and rendering again. We
  3847. see that the scene is much dimmer. This is because the
  3848. cylindrical constraints do not let the light spread out like in a
  3849. spotlight. Larger radius and falloff values are needed to do the
  3850. job. We try a radius of 20 and a falloff of 30 for all three
  3851. lights. That's the ticket!
  3852.  
  3853.  
  3854. 2.5.4     The Area Light Source
  3855. So far all of our light sources have one thing in common. They
  3856. produce sharp shadows. This is because the actual light source is
  3857. a point that is infinitely small. Objects are either in direct
  3858. sight of the light, in which case they are fully illuminated, or
  3859. they are not, in which case they are fully shaded. In real life,
  3860. this kind of stark light and shadow situation exists only in
  3861. outer space where the direct light of the sun pierces the total
  3862. blackness of space. But here on Earth, light bends around
  3863. objects, bounces off objects, and usually the source has some
  3864. dimension, meaning that it can be partially hidden from sight
  3865. (shadows are not sharp anymore). They have what is known as an
  3866. umbra, or an area of fuzziness where there is neither total light
  3867. or shade. In order to simulate these soft shadows, a ray-tracer
  3868. must give its light sources dimension. POV-Ray accomplishes this
  3869. with a feature known as an area light.
  3870.  
  3871. Area lights have dimension in two axis'. These are specified by
  3872. the first two vectors in the area light syntax. We must also
  3873. specify how many lights are to be in the array. More will give us
  3874. cleaner soft shadows but will take longer to render. Usually a
  3875. 3*3 or a 5*5 array will suffice. We also have the option of
  3876. specifying an adaptive value. The adaptive keyword tells the ray-
  3877. tracer that it can adapt to the situation and send only the
  3878. needed rays to determine the value of the pixel. If adaptive is
  3879. not used, a separate ray will be sent for every light in the area
  3880. light.  This can really slow things down. The higher the adaptive
  3881. value the cleaner the umbra will be but the longer the trace will
  3882. take.  Usually an adaptive value of 1 is sufficient. Finally, we
  3883. probably should use the jitter keyword.  This tells the ray-
  3884. tracer to slightly move the position of each light in the area
  3885. light so that the shadows appear truly soft instead of giving us
  3886. an umbra consisting of closely banded shadows.
  3887.  
  3888. OK, let's try one. We comment out the cylinder lights and add the
  3889. following:
  3890.  
  3891.   light_source {
  3892.     <2, 10, -3>
  3893.     color White
  3894.     area_light <5, 0, 0>, <0, 0, 5>, 5, 5
  3895.     adaptive 1
  3896.     jitter
  3897.   }
  3898. This is a white area light centered at <2,10,-3>. It is 5 units
  3899. (along the x-axis) by 5 units (along the z-axis) in size and has
  3900. 25 (5*5) lights in it. We have specified adaptive 1 and jitter.
  3901. We render this at 200x150 -A.
  3902.  
  3903. Right away we notice two things. The trace takes quite a bit
  3904. longer than it did with a point or a spotlight and the shadows
  3905. are no longer sharp! They all have nice soft umbrae around them.
  3906. Wait, it gets better.
  3907.  
  3908. Spotlights and cylinder lights can be area lights too! Remember
  3909. those sharp shadows from the spotlights in our scene? It would
  3910. not make much sense to use a 5*5 array for a spotlight, but a
  3911. smaller array might do a good job of giving us just the right
  3912. amount of umbra for a spotlight.  Let's try it. We comment out
  3913. the area light and change the cylinder lights so that they read
  3914. as follows:
  3915.  
  3916.   light_source {
  3917.     <2, 10, -3>
  3918.     color White
  3919.     spotlight
  3920.     radius 15
  3921.     falloff 18
  3922.     tightness 10
  3923.     area_light <1, 0, 0>, <0, 0, 1>, 2, 2
  3924.     adaptive 1
  3925.     jitter
  3926.     point_at <0, 0, 0>
  3927.   }
  3928.   light_source {
  3929.     <10, 10, -1>
  3930.     color Red
  3931.     spotlight
  3932.     radius 12
  3933.     falloff 14
  3934.     tightness 10
  3935.     area_light <1, 0, 0>, <0, 0, 1>, 2, 2
  3936.     adaptive 1
  3937.     jitter
  3938.     point_at <2, 0, 0>
  3939.   }
  3940.   light_source {
  3941.     <-12, 10, -1>
  3942.     color Blue
  3943.     spotlight
  3944.     radius 12
  3945.     falloff 14
  3946.     tightness 10
  3947.     area_light <1, 0, 0>, <0, 0, 1>, 2, 2
  3948.     adaptive 1
  3949.     jitter
  3950.     point_at <-2, 0, 0>
  3951.   }
  3952. We now have three area-spotlights, one unit square consisting of
  3953. an array of four (2*2) lights, three different colors, all
  3954. shining on our scene. We render this at 200x150 -A. It appears to
  3955. work perfectly. All our shadows have small, tight umbrae, just
  3956. the sort we would expect to find on an object under a real
  3957. spotlight.
  3958.  
  3959.  
  3960. 2.5.5     The Ambient Light Source
  3961. The ambient light source is used to simulate the effect of inter-
  3962. diffuse reflection. If there wasn't inter-diffuse reflection all
  3963. areas not directly lit by a light source would be completely
  3964. dark. POV-Ray uses the ambient keyword to determine how much
  3965. light coming from the ambient light source is reflected by a
  3966. surface.
  3967.  
  3968. By default the ambient light source, which emits its light
  3969. everywhere and in all directions, is pure white (rgb <1,1,1>).
  3970. Changing its color can be used to create interesting effects.
  3971. First of all the overall light level of the scene can be adjusted
  3972. easily. Instead of changing all ambient values in every finish
  3973. only the ambient light source is modified. By assigning different
  3974. colors we can create nice effects like a moody reddish ambient
  3975. lighting. For more details about the ambient light source see
  3976. "Ambient Light".
  3977.  
  3978. Below is an example of a red ambient light source.
  3979.  
  3980.   global_settings { ambient_light rgb<1, 0, 0> }
  3981.  
  3982. 2.5.6     Light Source Specials
  3983.  
  3984. 2.5.6.1   Using Shadowless Lights
  3985. Light sources can be assigned the shadowless keyword and no
  3986. shadows will be cast due to its presence in a scene. Sometimes,
  3987. scenes are difficult to illuminate properly using the lights we
  3988. have chosen to illuminate our objects.  It is impractical and
  3989. unrealistic to apply a higher ambient value to the texture of
  3990. every object in the scene. So instead, we would place a couple of
  3991. fill lights around the scene. Fill lights are simply dimmer
  3992. lights with the shadowless keyword that act to boost the
  3993. illumination of other areas of the scene that may not be lit
  3994. well.  Let's try using one in our scene.
  3995.  
  3996. Remember the three colored area spotlights? We go back and un-
  3997. comment them and comment out any other lights we have made. Now
  3998. we add the following:
  3999.  
  4000.   light_source {
  4001.     <0, 20, 0>
  4002.     color Gray50
  4003.     shadowless
  4004.   }
  4005. This is a fairly dim light 20 units over the center of the scene.
  4006. It will give a dim illumination to all objects including the
  4007. plane in the background. We render it and see.
  4008.  
  4009.  
  4010. 2.5.6.2   Assigning an Object to a Light Source
  4011. Light sources are invisible. They are just a location where the
  4012. light appears to be coming from. They have no true size or shape.
  4013. If we want our light source to be a visible shape, we can use the
  4014. looks_like keyword. We can specify that our light source can look
  4015. like any object we choose. When we use looks_like, then no_shadow
  4016. is applied to the object automatically. This is done so that the
  4017. object will not block any illumination from the light source.  If
  4018. we want some blocking to occur (as in a lampshade), it is better
  4019. to simply use a union to do the same thing. Let's add such an
  4020. object to our scene. Here is a light bulb we have made just for
  4021. this purpose:
  4022.  
  4023.   #declare Lightbulb = union {
  4024.     merge {
  4025.       sphere { <0,0,0>,1 }
  4026.       cylinder { <0,0,1>, <0,0,0>, 1
  4027.         scale <0.35, 0.35, 1.0>
  4028.         translate  0.5*z
  4029.       }
  4030.       texture {
  4031.         pigment {color rgb <1, 1, 1>}
  4032.         finish {ambient .8 diffuse .6}
  4033.       }
  4034.     }
  4035.     cylinder { <0,0,1>, <0,0,0>, 1
  4036.       scale <0.4, 0.4, 0.5>
  4037.       texture { Brass_Texture }
  4038.       translate  1.5*z
  4039.     }
  4040.     rotate -90*x
  4041.     scale .5
  4042.   }
  4043. Now we add the light source:
  4044.  
  4045.   light_source {
  4046.     <0, 2, 0>
  4047.     color White
  4048.     looks_like { Lightbulb }
  4049.   }
  4050. Rendering this we see that a fairly believable light bulb now
  4051. illuminates the scene. However, if we do not specify a high
  4052. ambient value, the light bulb is not lit by the light source. On
  4053. the plus side, all of the shadows fall away from the light bulb,
  4054. just as they would in a real situation. The shadows are sharp, so
  4055. let's make our bulb an area light:
  4056.  
  4057.   light_source {
  4058.     <0, 2, 0>
  4059.     color White
  4060.     area_light <1, 0, 0>, <0, 1, 0>, 2, 2
  4061.     adaptive 1
  4062.     jitter
  4063.     looks_like { Lightbulb }
  4064.   }
  4065. We note that we have placed this area light in the x-y-plane
  4066. instead of the x-z-plane. We also note that the actual appearance
  4067. of the light bulb is not affected in any way by the light source.
  4068. The bulb must be illuminated by some other light source or by, as
  4069. in this case, a high ambient value.
  4070.  
  4071.  
  4072. 2.5.6.3   Using Light Fading
  4073. If it is realism we want, it is not realistic for the plane to be
  4074. evenly illuminated off into the distance. In real life, light
  4075. gets scattered as it travels so it diminishes its ability to
  4076. illuminate objects the farther it gets from its source. To
  4077. simulate this, POV-Ray allows us to use two keywords:
  4078. fade_distance, which specifies the distance at which full
  4079. illumination is achieved, and fade_power, an exponential value
  4080. which determines the actual rate of attenuation. Let's apply
  4081. these keywords to our fill light.
  4082.  
  4083. First, we make the fill light a little brighter by changing
  4084. Gray50 to Gray75. Now we change that fill light as follows:
  4085.  
  4086.   light_source {
  4087.     <0, 20, 0>
  4088.     color Gray75
  4089.     fade_distance 5
  4090.     fade_power 1
  4091.     shadowless
  4092.   }
  4093. This means that the full value of the fill light will be achieved
  4094. at a distance of 5 units away from the light source. The fade
  4095. power of 1 means that the falloff will be linear (the light falls
  4096. of at a constant rate). We render this to see the result.
  4097.  
  4098. That definitely worked!  Now let's try a fade power of 2 and a
  4099. fade distance of 10. Again, this works well. The falloff is much
  4100. faster with a fade power of 2 so we had to raise the fade
  4101. distance to 10.
  4102.  
  4103.  
  4104. 2.6  Simple Texture Options
  4105. The pictures rendered so far where somewhat boring regarding the
  4106. appearance of the objects. Let's add some fancy features to the
  4107. texture.
  4108.  
  4109.  
  4110. 2.6.1     Surface Finishes
  4111. One of the main features of a ray-tracer is its ability to do
  4112. interesting things with surface finishes such as highlights and
  4113. reflection. Let's add a nice little Phong highlight (shiny spot)
  4114. to a sphere. To do this we need to add a finish keyword followed
  4115. by a parameter. We change the definition of the sphere to this:
  4116.  
  4117.   sphere { <0, 1, 2>, 2
  4118.     texture {
  4119.       pigment { color Yellow } // Yellow is pre-defined in
  4120. COLORS.INC
  4121.       finish { phong 1 }
  4122.     }
  4123.   }
  4124. We render the scene. The phong keyword adds a highlight the same
  4125. color of the light shining on the object. It adds a lot of
  4126. credibility to the picture and makes the object look smooth and
  4127. shiny. Lower values of phong will make the highlight less bright
  4128. (values should be between 0 and 1).
  4129.  
  4130.  
  4131. 2.6.2     Adding Bumpiness
  4132. The highlight we have added illustrates how much of our
  4133. perception depends on the reflective properties of an object. Ray-
  4134. tracing can exploit this by playing tricks on our perception to
  4135. make us see complex details that aren't really there.
  4136.  
  4137. Suppose we wanted a very bumpy surface on the object. It would be
  4138. very difficult to mathematically model lots of bumps. We can
  4139. however simulate the way bumps look by altering the way light
  4140. reflects off of the surface. Reflection calculations depend on a
  4141. vector called a surface normal. This is a vector which points
  4142. away from the surface and is perpendicular to it. By artificially
  4143. modifying (or perturbing) this normal vector we can simulate
  4144. bumps. We change the scene to read as follows and render it:
  4145.  
  4146.   sphere { <0, 1, 2>, 2
  4147.     texture {
  4148.       pigment { color Yellow }
  4149.       normal { bumps 0.4 scale 0.2 }
  4150.       finish { phong 1}
  4151.     }
  4152.   }
  4153. This tells POV-Ray to use the bumps pattern to modify the surface
  4154. normal. The value 0.4 controls the apparent depth of the bumps.
  4155. Usually the bumps are about 1 unit wide which doesn't work very
  4156. well with a sphere of radius 2. The scale makes the bumps 1/5th
  4157. as wide but does not affect their depth.
  4158.  
  4159.  
  4160. 2.6.3     Creating Color Patterns
  4161. We can do more than assigning a solid color to an object. We can
  4162. create complex patterns in the pigment block like in this
  4163. example:
  4164.  
  4165.   sphere { <0, 1, 2>, 2
  4166.     texture {
  4167.       pigment {
  4168.         wood
  4169.         color_map {
  4170.           [0.0 color DarkTan]
  4171.           [0.9 color DarkBrown]
  4172.           [1.0 color VeryDarkBrown]
  4173.         }
  4174.         turbulence 0.05
  4175.         scale <0.2, 0.3, 1>
  4176.       }
  4177.       finish { phong 1 }
  4178.     }
  4179.   }
  4180. The keyword wood specifies a pigment pattern of concentric rings
  4181. like rings in wood. The color_map keyword specifies that the
  4182. color of the wood should blend from DarkTan to DarkBrown over the
  4183. first 90% of the vein and from DarkBrown to VeryDarkBrown over
  4184. the remaining 10%. The turbulence keyword slightly stirs up the
  4185. pattern so the veins aren't perfect circles and the scale keyword
  4186. adjusts the size of the pattern.
  4187.  
  4188. Most patterns are set up by default to give us one feature across
  4189. a sphere of radius 1.0. A feature is very roughly defined as a
  4190. color transition. For example, a wood texture would have one band
  4191. on a sphere of radius 1.0. In this example we scale the pattern
  4192. using the scale keyword followed by a vector. In this case we
  4193. scaled 0.2 in the x direction, 0.3 in the y direction and the z
  4194. direction is scaled by 1, which leaves it unchanged. Scale values
  4195. larger than one will stretch an element. Scale values smaller
  4196. than one will squish an element. A scale value of one will leave
  4197. an element unchanged.
  4198.  
  4199.  
  4200. 2.6.4     Pre-defined Textures
  4201. POV-Ray has some very sophisticated textures pre-defined in the
  4202. standard include files glass.inc, metals.inc, stones.inc and
  4203. woods.inc. Some are entire textures with pigment, normal and/or
  4204. finish parameters already defined. Some are just pigments or just
  4205. finishes.  We change the definition of our sphere to the
  4206. following and then re-render it:
  4207.  
  4208.   sphere { <0, 1, 2>, 2
  4209.     texture {
  4210.       pigment {
  4211.         DMFWood4       // pre-defined in textures.inc
  4212.         scale 4        // scale by the same amount in all
  4213.                        // directions
  4214.       }
  4215.       finish { Shiny } // pre-defined in finish.inc
  4216.     }
  4217.   }
  4218. The pigment identifier DMFWood4 has already been scaled down
  4219. quite small when it was defined. For this example we want to
  4220. scale the pattern larger. Because we want to scale it uniformly
  4221. we can put a single value after the scale keyword rather than a
  4222. vector of x, y, z scale factors.
  4223.  
  4224. We look through the file textures.inc to see what pigments and
  4225. finishes are defined and try them out. We just insert the name of
  4226. the new pigment where DMFWood4 is now or try a different finish
  4227. in place of Shiny and re-render our file.
  4228.  
  4229. Here is an example of using a complete texture identifier rather
  4230. than just the pieces.
  4231.  
  4232.   sphere { <0, 1, 2>, 2
  4233.     texture { PinkAlabaster }
  4234.   }
  4235.  
  4236. 2.7  Advanced Texture Options
  4237. The extremely powerful texturing ability is one thing that really
  4238. sets POV-Ray apart from other raytracers. So far we have not
  4239. really tried anything too complex but by now we should be
  4240. comfortable enough with the program's syntax to try some of the
  4241. more advanced texture options.
  4242.  
  4243. Obviously, we cannot try them all. It would take a tutorial a lot
  4244. more pages to use every texturing option available in POV-Ray.
  4245. For this limited tutorial, we will content ourselves to just
  4246. trying a few of them to give an idea of how textures are created.
  4247. With a little practice, we will soon be creating beautiful
  4248. textures of our own.
  4249.  
  4250. Note that early versions of POV-Ray made a distinction between
  4251. pigment and normal patterns, i. e. patterns that could be used
  4252. inside a normal or pigment statement. With POV-Ray 3.0 this
  4253. restriction was removed so that all patterns listed in section
  4254. "Patterns" can be used as a pigment or normal pattern.
  4255.  
  4256.  
  4257. 2.7.1     Pigments
  4258. Every surface must have a color. In POV-Ray this color is called
  4259. a pigment. It does not have to be a single color. It can be a
  4260. color pattern, a color list or even an image map. Pigments can
  4261. also be layered one on top of the next so long as the uppermost
  4262. layers are at least partially transparent so the ones beneath can
  4263. show through. Let's play around with some of these kinds of
  4264. pigments.
  4265.  
  4266. We create a file called texdemo.pov and edit it as follows:
  4267.  
  4268.   #include "colors.inc"
  4269.   camera {
  4270.     location <1, 1, -7>
  4271.     look_at 0
  4272.     angle 36
  4273.   }
  4274.   light_source { <1000, 1000, -1000> White }
  4275.   plane { y, -1.5
  4276.     pigment { checker Green, White }
  4277.   }
  4278.   sphere { <0,0,0>, 1
  4279.     pigment { Red }
  4280.   }
  4281. Giving this file a quick test render at 200x150 -A we see that it
  4282. is a simple red sphere against a green and white checkered plane.
  4283. We will be using the sphere for our textures.
  4284.  
  4285.  
  4286. 2.7.1.1   Using Color List Pigments
  4287. Before we begin we should note that we have already made one kind
  4288. of pigment, the color list pigment. In the previous example we
  4289. have used a checkered pattern on our plane. There are two other
  4290. kinds of color list pigments, brick and hexagon. Let's quickly
  4291. try each of these. First, we change the plane's pigment as
  4292. follows:
  4293.  
  4294.   pigment { hexagon Green, White, Yellow }
  4295. Rendering this we see a three-color hexagonal pattern. Note that
  4296. this pattern requires three colors. Now we change the pigment
  4297. to...
  4298.  
  4299.   pigment { brick Gray75, Red rotate -90*x scale .25 }
  4300. Looking at the resulting image we see that the plane now has a
  4301. brick pattern. We note that we had to rotate the pattern to make
  4302. it appear correctly on the flat plane. This pattern normally is
  4303. meant to be used on vertical surfaces. We also had to scale the
  4304. pattern down a bit so we could see it more easily. We can play
  4305. around with these color list pigments, change the colors, etc.
  4306. until we get a floor that we like.
  4307.  
  4308.  
  4309. 2.7.1.2   Using Pigment and Patterns
  4310. Let's begin texturing our sphere by using a pattern and a color
  4311. map consisting of three colors. We replace the pigment block with
  4312. the following.
  4313.  
  4314.   pigment {
  4315.     gradient x
  4316.     color_map {
  4317.       [0.00 color Red]
  4318.       [0.33 color Blue]
  4319.       [0.66 color Yellow]
  4320.       [1.00 color Red]
  4321.     }
  4322.   }
  4323. Rendering this we see that the gradient pattern gives us an
  4324. interesting pattern of vertical stripes. We change the gradient
  4325. direction to y. The stripes are horizontal now. We change the
  4326. gradient direction to z. The stripes are now more like concentric
  4327. rings. This is because the gradient direction is directly away
  4328. from the camera. We change the direction back to x and add the
  4329. following to the pigment block.
  4330.  
  4331.   pigment {
  4332.     gradient x
  4333.     color_map {
  4334.       [0.00 color Red]
  4335.       [0.33 color Blue]
  4336.       [0.66 color Yellow]
  4337.       [1.00 color Red]
  4338.     }
  4339.     rotate -45*z          // <- add this line
  4340.   }
  4341. The vertical bars are now slanted at a 45 degree angle. All
  4342. patterns can be rotated, scaled and translated in this manner.
  4343. Let's now try some different types of patterns. One at a time, we
  4344. substitute the following keywords for gradient x and render to
  4345. see the result: bozo, marble, agate, granite, leopard, spotted
  4346. and wood (if we like we can test all patterns listed in section
  4347. "Patterns").
  4348.  
  4349. Rendering these we see that each results in a slightly different
  4350. pattern. But to get really good results each type of pattern
  4351. requires the use of some pattern modifiers.
  4352.  
  4353.  
  4354. 2.7.1.3   Using Pattern Modifiers
  4355. Let's take a look at some pattern modifiers. First, we change the
  4356. pattern type to bozo. Then we add the following change.
  4357.  
  4358.   pigment {
  4359.     bozo
  4360.     frequency 3            // <- add this line
  4361.     color_map {
  4362.       [0.00 color Red]
  4363.       [0.33 color Blue]
  4364.       [0.66 color Yellow]
  4365.       [1.00 color Red]
  4366.     }
  4367.     rotate -45*z
  4368.   }
  4369. The frequency modifier determines the number of times the color
  4370. map repeats itself per unit of size. This change makes the bozo
  4371. pattern we saw earlier have many more bands in it. Now we change
  4372. the pattern type to marble. When we rendered this earlier, we saw
  4373. a banded pattern similar to gradient y that really did not look
  4374. much like marble at all. This is because marble really is a kind
  4375. of gradient and it needs another pattern modifier to look like
  4376. marble. This modifier is called turbulence. We change the line
  4377. frequency 3 to turbulence 1 and render again. That's better! Now
  4378. let's put frequency 3 back in right after the turbulence and take
  4379. another look. Even more interesting!
  4380.  
  4381. But wait, it gets better! Turbulence itself has some modifiers of
  4382. its own. We can adjust the turbulence several ways. First, the
  4383. float that follows the turbulence keyword can be any value with
  4384. higher values giving us more turbulence. Second, we can use the
  4385. keywords omega, lambda and octaves to change the turbulence
  4386. parameters. Let's try this now:
  4387.  
  4388.   pigment {
  4389.     marble
  4390.     turbulence 0.5
  4391.     lambda 1.5
  4392.     omega 0.8
  4393.     octaves 5
  4394.     frequency 3
  4395.     color_map {
  4396.       [0.00 color Red]
  4397.       [0.33 color Blue]
  4398.       [0.66 color Yellow]
  4399.       [1.00 color Red]
  4400.     }
  4401.     rotate 45*z
  4402.   }
  4403. Rendering this we see that the turbulence has changed and the
  4404. pattern looks different. We play around with the numerical values
  4405. of turbulence, lambda, omega and octaves to see what they do.
  4406.  
  4407.  
  4408. 2.7.1.4   Using Transparent Pigments and Layered Textures
  4409. Pigments are described by numerical values that give the rgb
  4410. value of the color to be used (like color rgb<1,0,0> giving us a
  4411. red color). But this syntax will give us more than just the rgb
  4412. values. We can specify filtering transparency by changing it as
  4413. follows: color rgbf<1,0,0,1>. The f stands for filter, POV-Ray's
  4414. word for filtered transparency. A value of one means that the
  4415. color is completely transparent, but still filters the light
  4416. according to what the pigment is. In this case, the color will be
  4417. a transparent red, like red cellophane.
  4418.  
  4419. There is another kind of transparency in POV-Ray. It is called
  4420. transmittance or non-filtering transparency (the keyword is
  4421. transmit). It is different from filter in that it does not filter
  4422. the light according to the pigment color. It instead allows all
  4423. the light to pass through unchanged. It can be specified like
  4424. this: rgbt <1,0,0,1>.
  4425.  
  4426. Let's use some transparent pigments to create another kind of
  4427. texture, the layered texture. Returning to our previous example,
  4428. declare the following texture.
  4429.  
  4430.   #declare LandArea = texture {
  4431.       pigment {
  4432.         agate
  4433.         turbulence 1
  4434.         lambda 1.5
  4435.         omega .8
  4436.         octaves 8
  4437.         color_map {
  4438.           [0.00 color rgb <.5, .25, .15>]
  4439.           [0.33 color rgb <.1, .5, .4>]
  4440.           [0.86 color rgb <.6, .3, .1>]
  4441.           [1.00 color rgb <.5, .25, .15>]
  4442.         }
  4443.       }
  4444.     }
  4445. This texture will be the land area. Now let's make the oceans by
  4446. declaring the following.
  4447.  
  4448.   #declare OceanArea = texture {
  4449.       pigment {
  4450.         bozo
  4451.         turbulence .5
  4452.         lambda 2
  4453.         color_map {
  4454.           [0.00, 0.33 color rgb <0, 0, 1>
  4455.                       color rgb <0, 0, 1>]
  4456.           [0.33, 0.66 color rgbf <1, 1, 1, 1>
  4457.                       color rgbf <1, 1, 1, 1>]
  4458.           [0.66, 1.00 color rgb <0, 0, 1>
  4459.                       color rgb <0, 0, 1>]
  4460.         }
  4461.       }
  4462.     }
  4463. Note how the ocean is the opaque blue area and the land is the
  4464. clear area which will allow the underlying texture to show
  4465. through.
  4466.  
  4467. Now, let's declare one more texture to simulate an atmosphere
  4468. with swirling clouds.
  4469.  
  4470.   #declare CloudArea = texture {
  4471.     pigment {
  4472.       agate
  4473.       turbulence 1
  4474.       lambda 2
  4475.       frequency 2
  4476.       color_map {
  4477.         [0.0 color rgbf <1, 1, 1, 1>]
  4478.         [0.5 color rgbf <1, 1, 1, .35>]
  4479.         [1.0 color rgbf <1, 1, 1, 1>]
  4480.       }
  4481.     }
  4482.   }
  4483. Now apply all of these to our sphere.
  4484.  
  4485.   sphere { <0,0,0>, 1
  4486.     texture { LandArea }
  4487.     texture { OceanArea }
  4488.     texture { CloudArea }
  4489.   }
  4490. We render this and have a pretty good rendition of a little
  4491. planetoid. But it could be better. We don't particularly like the
  4492. appearance of the clouds. There is a way they could be done that
  4493. would be much more realistic.
  4494.  
  4495.  
  4496. 2.7.1.5   Using Pigment Maps
  4497. Pigments may be blended together in the same way as the colors in
  4498. a color map using the same pattern keywords and a pigment_map.
  4499. Let's just give it a try.
  4500.  
  4501. We add the following declarations, making sure they appear before
  4502. the other declarations in the file.
  4503.  
  4504.   #declare Clouds1 = pigment {
  4505.       bozo
  4506.       turbulence 1
  4507.       color_map {
  4508.         [0.0 color White filter 1]
  4509.         [0.5 color White]
  4510.         [1.0 color White filter 1]
  4511.       }
  4512.     }
  4513.   #declare Clouds2 = pigment {
  4514.     agate
  4515.     turbulence 1
  4516.     color_map {
  4517.       [0.0 color White filter 1]
  4518.       [0.5 color White]
  4519.       [1.0 color White filter 1]
  4520.       }
  4521.     }
  4522.   #declare Clouds3 = pigment {
  4523.     marble
  4524.     turbulence 1
  4525.     color_map {
  4526.       [0.0 color White filter 1]
  4527.       [0.5 color White]
  4528.       [1.0 color White filter 1]
  4529.     }
  4530.   }
  4531.   #declare Clouds4 = pigment {
  4532.     granite
  4533.     turbulence 1
  4534.     color_map {
  4535.       [0.0 color White filter 1]
  4536.       [0.5 color White]
  4537.       [1.0 color White filter 1]
  4538.     }
  4539.   }
  4540. Now we use these declared pigments in our cloud layer on our
  4541. planetoid. We replace the declared cloud layer with.
  4542.  
  4543.   #declare CloudArea = texture {
  4544.     pigment {
  4545.       gradient y
  4546.       pigment_map {
  4547.         [0.00 Clouds1]
  4548.         [0.25 Clouds2]
  4549.         [0.50 Clouds3]
  4550.         [0.75 Clouds4]
  4551.         [1.00 Clouds1]
  4552.       }
  4553.     }
  4554.   }
  4555. We render this and see a remarkable pattern that looks very much
  4556. like weather patterns on the planet earth. They are separated
  4557. into bands, simulating the different weather types found at
  4558. different latitudes.
  4559.  
  4560.  
  4561. 2.7.2     Normals
  4562. Objects in POV-Ray have very smooth surfaces. This is not very
  4563. realistic so there are several ways to disturb the smoothness of
  4564. an object by perturbing the surface normal. The surface normal is
  4565. the vector that is perpendicular to the angle of the surface. By
  4566. changing this normal the surface can be made to appear bumpy,
  4567. wrinkled or any of the many patterns available. Let's try a
  4568. couple of them.
  4569.  
  4570.  
  4571. 2.7.2.1   Using Basic Normal Modifiers
  4572. We comment out the planetoid sphere for now and, at the bottom of
  4573. the file, create a new sphere with a simple, single color
  4574. texture.
  4575.  
  4576.   sphere { <0,0,0>, 1
  4577.     pigment { Gray75 }
  4578.     normal { bumps 1 scale .2 }
  4579.   }
  4580. Here we have added a normal block in addition to the pigment
  4581. block (note that these do not have to be included in a texture
  4582. block unless they need to be transformed together or need to be
  4583. part of a layered texture). We render this to see what it looks
  4584. like. Now, one at a time, we substitute for the keyword bumps the
  4585. following keywords: dents, wrinkles, ripples and waves (we can
  4586. also use any of the patterns listed in "Patterns"). We render
  4587. each to see what they look like. We play around with the float
  4588. value that follows the keyword. We also experiment with the scale
  4589. value.
  4590.  
  4591. For added interest, we change the plane texture to a single color
  4592. with a normal as follows.
  4593.  
  4594.   plane { y, -1.5
  4595.     pigment { color rgb <.65, .45, .35> }
  4596.     normal { dents .75 scale .25 }
  4597.   }
  4598.  
  4599. 2.7.2.2   Blending Normals
  4600. Normals can be layered similar to pigments but the results can be
  4601. unexpected. Let's try that now by editing the sphere as follows.
  4602.  
  4603.   sphere { <0,0,0>, 1
  4604.     pigment { Gray75 }
  4605.       normal { radial frequency 10 }
  4606.       normal { gradient y scale .2 }
  4607.   }
  4608. As we can see, the resulting pattern is neither a radial nor a
  4609. gradient. It is instead the result of first calculating a radial
  4610. pattern and then calculating a gradient pattern. The results are
  4611. simply additive. This can be difficult to control so POV-Ray
  4612. gives the user other ways to blend normals.
  4613.  
  4614. One way is to use normal maps. A normal map works the same way as
  4615. the pigment map we used earlier. Let's change our sphere texture
  4616. as follows.
  4617.  
  4618.   sphere { <0,0,0>, 1
  4619.     pigment { Gray75 }
  4620.     normal {
  4621.       gradient y
  4622.       frequency 3
  4623.       turbulence .5
  4624.       normal_map {
  4625.         [0.00 granite]
  4626.         [0.25 spotted turbulence .35]
  4627.         [0.50 marble turbulence .5]
  4628.         [0.75 bozo turbulence .25]
  4629.         [1.00 granite]
  4630.       }
  4631.     }
  4632.   }
  4633. Rendering this we see that the sphere now has a very irregular
  4634. bumpy surface. The gradient pattern type separates the normals
  4635. into bands but they are turbulated, giving the surface a chaotic
  4636. appearance. But this give us an idea.
  4637.  
  4638. Suppose we use the same pattern for a normal map that we used to
  4639. create the oceans on our planetoid and applied it to the land
  4640. areas. Does it follow that if we use the same pattern and
  4641. modifiers on a sphere the same size that the shape of the pattern
  4642. would be the same? Wouldn't that make the land areas bumpy while
  4643. leaving the oceans smooth? Let's try it. First, let's render the
  4644. two spheres side-by-side so we can see if the pattern is indeed
  4645. the same. We un-comment the planetoid sphere and make the
  4646. following changes.
  4647.  
  4648.   sphere { <0,0,0>, 1
  4649.     texture { LandArea }
  4650.     texture { OceanArea }
  4651.     //texture { CloudArea }  // <-comment this out
  4652.     translate -x             // <- add this transformation
  4653.   }
  4654. Now we change the gray sphere as follows.
  4655.  
  4656.   sphere { <0,0,0>, 1
  4657.     pigment { Gray75 }
  4658.     normal {
  4659.       bozo
  4660.       turbulence .5
  4661.       lambda 2
  4662.       normal_map {
  4663.         [0.4 dents .15 scale .01]
  4664.         [0.6 agate turbulence 1]
  4665.         [1.0 dents .15 scale .01]
  4666.       }
  4667.     }
  4668.     translate x // <- add this transformation
  4669.   }
  4670. We render this to see if the pattern is the same. We see that
  4671. indeed it is. So let's comment out the gray sphere and add the
  4672. normal block it contains to the land area texture of our
  4673. planetoid. We remove the transformations so that the planetoid is
  4674. centered in the scene again.
  4675.  
  4676.   #declare LandArea = texture {
  4677.     pigment {
  4678.       agate
  4679.       turbulence 1
  4680.       lambda 1.5
  4681.       omega .8
  4682.       octaves 8
  4683.       color_map {
  4684.         [0.00 color rgb <.5, .25, .15>]
  4685.         [0.33 color rgb <.1, .5, .4>]
  4686.         [0.86 color rgb <.6, .3, .1>]
  4687.         [1.00 color rgb <.5, .25, .15>]
  4688.       }
  4689.     }
  4690.     normal {
  4691.       bozo
  4692.       turbulence .5
  4693.       lambda 2
  4694.       normal_map {
  4695.         [0.4 dents .15 scale .01]
  4696.         [0.6 agate turbulence 1]
  4697.         [1.0 dents .15 scale .01]
  4698.       }
  4699.     }
  4700.   }
  4701. Looking at the resulting image we see that indeed our idea works!
  4702. The land areas are bumpy while the oceans are smooth. We add the
  4703. cloud layer back in and our planetoid is complete.
  4704.  
  4705. There is much more that we did not cover here due to space
  4706. constraints. On our own, we should take the time to explore slope
  4707. maps, average and bump maps.
  4708.  
  4709.  
  4710. 2.7.3     Finishes
  4711. The final part of a POV-Ray texture is the finish. It controls
  4712. the properties of the surface of an object. It can make it shiny
  4713. and reflective, or dull and flat. It can also specify what
  4714. happens to light that passes through transparent pigments, what
  4715. happens to light that is scattered by less-than-perfectly-smooth
  4716. surfaces and what happens to light that is reflected by surfaces
  4717. with thin-film interference properties. There are twelve
  4718. different properties available in POV-Ray to specify the finish
  4719. of a given object. These are controlled by the following
  4720. keywords: ambient, diffuse, brilliance, phong, specular,
  4721. metallic, reflection, crand and iridescence. Let's design a
  4722. couple of textures that make use of these parameters.
  4723.  
  4724.  
  4725. 2.7.3.1   Using Ambient
  4726. Since objects in POV-Ray are illuminated by light sources, the
  4727. portions of those objects that are in shadow would be completely
  4728. black were it not for the first two finish properties, ambient
  4729. and diffuse. Ambient is used to simulate the light that is
  4730. scattered around the scene that does not come directly from a
  4731. light source. Diffuse determines how much of the light that is
  4732. seen comes directly from a light source. These two keywords work
  4733. together to control the simulation of ambient light. Let's use
  4734. our gray sphere to demonstrate this. Let's also change our plane
  4735. back to its original green and white checkered pattern.
  4736.  
  4737.   plane {y,-1.5
  4738.     pigment {checker Green, White}
  4739.   }
  4740.   sphere { <0,0,0>, 1
  4741.     pigment {Gray75}
  4742.     finish {
  4743.       ambient .2
  4744.       diffuse .6
  4745.   }
  4746. In the above example, the default values for ambient and diffuse
  4747. are used. We render this to see what the effect is and then make
  4748. the following change to the finish.
  4749.  
  4750.   ambient 0
  4751.   diffuse 0
  4752. The sphere is black because we have specified that none of the
  4753. light coming from any light source will be reflected by the
  4754. sphere. Let's change diffuse back to the default of 0.6.
  4755.  
  4756. Now we see the gray surface color where the light from the light
  4757. source falls directly on the sphere but the shaded side is still
  4758. absolutely black. Now let's change diffuse to 0.3 and ambient to
  4759. 0.3.
  4760.  
  4761. The sphere now looks almost flat. This is because we have
  4762. specified a fairly high degree of ambient light and only a low
  4763. amount of the light coming from the light source is diffusely
  4764. reflected towards the camera. The default values of ambient and
  4765. diffuse are pretty good averages and a good starting point. In
  4766. most cases, an ambient value of 0.1 ... 0.2 is sufficient and a
  4767. diffuse value of 0.5 ... 0.7 will usually do the job. There are a
  4768. couple of exceptions. If we have a completely transparent surface
  4769. with high refractive and/or reflective values, low values of both
  4770. ambient and diffuse may be best. Here is an example:
  4771.  
  4772. sphere { <0,0,0>, 1
  4773.    pigment { White filter 1 }
  4774.    finish {
  4775.       ambient 0
  4776.       diffuse 0
  4777.       reflection .25
  4778.       specular 1
  4779.       roughness .001
  4780.    }
  4781.    interior{ior 1.33}
  4782. }
  4783. This is glass, obviously. Glass is a material that takes nearly
  4784. all of its appearance from its surroundings. Very little of the
  4785. surface is seen because it transmits or reflects practically all
  4786. of the light that shines on it. See glass.inc for some other
  4787. examples.
  4788.  
  4789. If we ever need an object to be completely illuminated
  4790. independently of the lighting situation in a given scene we can
  4791. do this artificially by specifying an ambient value of 1 and a
  4792. diffuse value of 0. This will eliminate all shading and simply
  4793. give the object its fullest and brightest color value at all
  4794. points. This is good for simulating objects that emit light like
  4795. light bulbs and for skies in scenes where the sky may not be
  4796. adequately lit by any other means.
  4797.  
  4798. Let's try this with our sphere now.
  4799.  
  4800.   sphere { <0,0,0>, 1
  4801.      pigment { White }
  4802.      finish {
  4803.         ambient 1
  4804.         diffuse 0
  4805.      }
  4806.   }
  4807. Rendering this we get a blinding white sphere with no visible
  4808. highlights or shaded parts. It would make a pretty good
  4809. streetlight.
  4810.  
  4811.  
  4812. 2.7.3.2   Using Surface Highlights
  4813. In the glass example above, we noticed that there were bright
  4814. little hotspots on the surface. This gave the sphere a hard,
  4815. shiny appearance. POV-Ray gives us two ways to specify surface
  4816. specular highlights. The first is called Phong highlighting.
  4817. Usually, Phong highlights are described using two keywords: phong
  4818. and phong_size. The float that follows phong determines the
  4819. brightness of the highlight while the float following phong_size
  4820. determines its size. Let's try this.
  4821.  
  4822.   sphere { <0,0,0>, 1
  4823.     pigment { Gray50 }
  4824.     finish {
  4825.       ambient .2
  4826.       diffuse .6
  4827.       phong .75
  4828.       phong_size 25
  4829.     }
  4830.   }
  4831. Rendering this we see a fairly broad, soft highlight that gives
  4832. the sphere a kind of plastic appearance. Now let's change
  4833. phong_size to 150. This makes a much smaller highlight which
  4834. gives the sphere the appearance of being much harder and shinier.
  4835.  
  4836. There is another kind of highlight that is calculated by a
  4837. different means called specular highlighting. It is specified
  4838. using the keyword specular and operates in conjunction with
  4839. another keyword called roughness. These two keywords work
  4840. together in much the same way as phong and phong_size to create
  4841. highlights that alter the apparent shininess of the surface.
  4842. Let's try using specular in our sphere.
  4843.  
  4844.   sphere { <0,0,0>, 1
  4845.      pigment { Gray50 }
  4846.      finish {
  4847.         ambient .2
  4848.         diffuse .6
  4849.         specular .75
  4850.         roughness .1
  4851.     }
  4852.   }
  4853. Looking at the result we see a broad, soft highlight similar to
  4854. what we had when we used phong_size of 25. Change roughness to
  4855. .001 and render again. Now we see a small, tight highlight
  4856. similar to what we had when we used phong_size of 150. Generally
  4857. speaking, specular is slightly more accurate and therefore
  4858. slightly more realistic than phong but you should try both
  4859. methods when designing a texture. There are even times when both
  4860. phong and specular may be used on a finish.
  4861.  
  4862.  
  4863. 2.7.3.3   Using Reflection and Metallic
  4864. There is another surface parameter that goes hand in hand with
  4865. highlights, reflection. Surfaces that are very shiny usually have
  4866. a degree of reflection to them. Let's take a look at an example.
  4867.  
  4868.   sphere { <0,0,0>, 1
  4869.      pigment { Gray50 }
  4870.      finish {
  4871.         ambient .2
  4872.         diffuse .6
  4873.         specular .75
  4874.         roughness .001
  4875.         reflection .5
  4876.      }
  4877.   }
  4878. We see that our sphere now reflects the green and white checkered
  4879. plane and the black background but the gray color of the sphere
  4880. seems out of place. This is another time when a lower diffuse
  4881. value is needed.  Generally, the higher reflection is the lower
  4882. diffuse should be. We lower the diffuse value to 0.3 and the
  4883. ambient value to 0.1 and render again. That is much better. Let's
  4884. make our sphere as shiny as a polished gold ball bearing.
  4885.  
  4886.   sphere { <0,0,0>, 1
  4887.      pigment { BrightGold }
  4888.      finish {
  4889.         ambient .1
  4890.         diffuse .1
  4891.         specular 1
  4892.         roughness .001
  4893.         reflection .75
  4894.      }
  4895.    }
  4896. That is very close but there is something wrong with the
  4897. highlight. To make the surface appear more like metal the keyword
  4898. metallic is used. We add it now to see the difference.
  4899.  
  4900.   sphere { <0,0,0>, 1
  4901.      pigment { BrightGold }
  4902.      finish {
  4903.         ambient .1
  4904.         diffuse .1
  4905.         specular 1
  4906.         roughness .001
  4907.         reflection .75
  4908.         metallic
  4909.      }
  4910.   }
  4911. We see that the highlight has taken on the color of the surface
  4912. rather than the light source. This gives the surface a more
  4913. metallic appearance.
  4914.  
  4915.  
  4916. 2.7.3.4   Using Iridescence
  4917. Iridescence is what we see on the surface of an oil slick when
  4918. the sun shines on it. The rainbow effect is created by something
  4919. called thin-film interference (read section "Iridescence" for
  4920. details). For now let's just try using it. Iridescence is
  4921. specified by the irid statement and three values: amount,
  4922. thickness and turbulence. The amount is the contribution to the
  4923. overall surface color. Usually 0.1 to 0.5 is sufficient here. The
  4924. thickness affects the "busyness" of the effect. Keep this between
  4925. 0.25 and 1 for best results. The turbulence is a little different
  4926. from pigment or normal turbulence. We cannot set octaves, lambda
  4927. or omega but we can specify an amount which will affect the
  4928. thickness in a slightly different way from the thickness value.
  4929. Values between 0.25 and 1 work best here too. Finally,
  4930. iridescence will respond to the surface normal since it depends
  4931. on the angle of incidence of the light rays striking the surface.
  4932. With all of this in mind, let's add some iridescence to our glass
  4933. sphere.
  4934.  
  4935. sphere { <0,0,0>, 1
  4936.      pigment { White filter 1 }
  4937.      finish {
  4938.         ambient .1
  4939.         diffuse .1
  4940.         reflection .2
  4941.         specular 1
  4942.         roughness .001
  4943.         irid {
  4944.           0.35
  4945.           thickness .5
  4946.           turbulence .5
  4947.         }
  4948.      }
  4949.      interior{
  4950.         ior 1.5
  4951.         fade_distance 5
  4952.         fade_power 1
  4953.         caustics 1
  4954.      }
  4955. }
  4956. We try to vary the values for amount, thickness and turbulence to
  4957. see what changes they make. We also try to add a normal block to
  4958. see what happens.
  4959.  
  4960.  
  4961. 2.7.4     Working With Pigment Maps
  4962. Let's look at the pigment map. We must not confuse this with a
  4963. color map, as color maps can only take individual colors as
  4964. entries in the map, while pigment maps can use entire other
  4965. pigment patterns. To get a feel for these, let's begin by setting
  4966. up a basic plane with a simple pigment map. Now, in the following
  4967. example, we are going to declare each of the pigments we are
  4968. going to use before we actually use them. This isn't strictly
  4969. necessary (we could put an entire pigment description in each
  4970. entry of the map) but it just makes the whole thing more
  4971. readable.
  4972.  
  4973.   // simple Black on White checkboard... it's a classic
  4974.   #declare Pigment1 = pigment {
  4975.     checker color Black color White
  4976.     scale .1
  4977.   }
  4978.   // kind of a "psychedelic rings" effect
  4979.   #declare Pigment2 = pigment {
  4980.     wood
  4981.     color_map {
  4982.       [ 0.0 Red ]
  4983.       [ 0.3 Yellow ]
  4984.       [ 0.6 Green ]
  4985.       [ 1.0 Blue ]
  4986.     }
  4987.   }
  4988.   plane { -z, 0
  4989.     pigment {
  4990.       gradient x
  4991.       pigment_map {
  4992.         [ 0.0 Pigment1 ]
  4993.         [ 0.5 Pigment2 ]
  4994.         [ 1.0 Pigment1 ]
  4995.       }
  4996.     }
  4997.   }
  4998. Okay, what we have done here is very simple, and probably quite
  4999. recognizable if we have been working with color maps all along
  5000. anyway. All we have done is substituted a pigment map where a
  5001. color map would normally go, and as the entries in our map, we
  5002. have referenced our declared pigments. When we render this
  5003. example, we see a pattern which fades back and forth between the
  5004. classic checkerboard, and those colorful rings. Because we fade
  5005. from Pigment1 to Pigment2 and then back again, we see a clear
  5006. blending of the two patterns at the transition points. We could
  5007. just as easily get a sudden transition by amending the map to
  5008. read.
  5009.  
  5010.   pigment_map {
  5011.     [ 0.0 Pigment1 ]
  5012.     [ 0.5 Pigment1 ]
  5013.     [ 0.5 Pigment2 ]
  5014.     [ 1.0 Pigment2 ]
  5015.   }
  5016. Blending individual pigment patterns is just the beginning.
  5017.  
  5018.  
  5019. 2.7.5     Working With Normal Maps
  5020.  For our next example, we replace the plane in the scene with
  5021. this one.
  5022.  
  5023.   plane { -z, 0
  5024.     pigment { White }
  5025.     normal {
  5026.       gradient x
  5027.       normal_map {
  5028.         [ 0.0 bumps 1 scale .1]
  5029.         [ 1.0 ripples 1 scale .1]
  5030.       }
  5031.     }
  5032.   }
  5033. First of all, we have chosen a solid white color to show off all
  5034. bumping to best effect. Secondly, we notice that our map blends
  5035. smoothly from all bumps at 0.0 to all ripples at 1.0, but because
  5036. this is a default gradient, it falls off abruptly back to bumps
  5037. at the beginning of the next cycle. We Render this and see just
  5038. enough sharp transitions to clearly see where one normal gives
  5039. over to another, yet also an example of how two normal patterns
  5040. look while they are smoothly blending into one another.
  5041.  
  5042. The syntax is the same as we would expect. We just changed the
  5043. type of map, moved it into the normal block and supplied
  5044. appropriate bump types. It is important to remember that as of
  5045. POV-Ray 3, all patterns that work with pigments work as normals
  5046. as well (and vice versa, of course) so we could just as easily
  5047. have blended from wood to granite, or any other pattern we like.
  5048. We experiment a bit and get a feel for what the different
  5049. patterns look like.
  5050.  
  5051. After seeing how interesting the various normals look blended, we
  5052. might like to see them completely blended all the way through
  5053. rather than this business of fading from one to the next. Well,
  5054. that is possible too, but we would be getting ahead of ourselves.
  5055. That is called the average function, and we will return to it a
  5056. little bit further down the page.
  5057.  
  5058.  
  5059. 2.7.6     Working With Texture Maps
  5060. We know how to blend colors, pigment patterns, and normals, and
  5061. we are probably thinking what about finishes? What about whole
  5062. textures? Both of these can be kind of covered under one topic.
  5063. While there is no finish map per se, there are texture maps, and
  5064. we can easily adapt these to serve as finish maps, simply by
  5065. putting the same pigment and/or normal in each of the texture
  5066. entries of the map. Here is an example. We eliminate the declared
  5067. pigments we used before and the previous plane, and add the
  5068. following.
  5069.  
  5070.   #declare Texture1 = texture {
  5071.     pigment { Grey }
  5072.     finish { reflection 1 }
  5073.   }
  5074.   #declare Texture2 = texture {
  5075.     pigment { Grey }
  5076.     finish { reflection 0 }
  5077.   }
  5078.   cylinder { <-2, 5, -2>, <-2, -5, -2>, 1
  5079.     pigment { Blue }
  5080.   }
  5081.   plane { -z, 0
  5082.     rotate y * 30
  5083.     texture {
  5084.       gradient y
  5085.       texture_map {
  5086.         [ 0.0 Texture1 ]
  5087.         [ 0.4 Texture1 ]
  5088.         [ 0.6 Texture2 ]
  5089.         [ 1.0 Texture2 ]
  5090.       }
  5091.       scale 2
  5092.     }
  5093.   }
  5094. Now, what have we done here? The background plane alternates
  5095. vertically between two textures, identical except for their
  5096. finishes. When we render this, the cylinder has a reflection part
  5097. of the way down the plane, and then stops reflecting, then begins
  5098. and then stops again, in a gradient pattern down the surface of
  5099. the plane. With a little adaptation, this could be used with any
  5100. pattern, and in any number of creative ways, whether we just
  5101. wanted to give various parts of an object different finishes, as
  5102. we are doing here, or whole different textures altogether.
  5103.  
  5104. One might ask: if there is a texture map, why do we need pigment
  5105. and normal maps? Fair question. The answer: speed of calculation.
  5106. If we use a texture map, for every in-between point, POV-Ray must
  5107. make multiple calculations for each texture element, and then run
  5108. a weighted average to produce the correct value for that point.
  5109. Using just a pigment map (or just a normal map) decreases the
  5110. overall number of calculations, and our texture renders a bit
  5111. faster in the bargain. As a rule of thumb: we use pigment or
  5112. normal maps where we can and only fall back on texture maps if we
  5113. need the extra flexibility.
  5114.  
  5115.  
  5116. 2.7.7     Working With List Textures
  5117.  If we have followed the corresponding tutorials on simple
  5118. pigments, we know that there are three patterns called color list
  5119. patterns, because rather than using a color map, these simple but
  5120. useful patterns take a list of colors immediately following the
  5121. pattern keyword. We're talking about checker, hexagon, and, new
  5122. to POV-Ray 3, the brick pattern.
  5123.  
  5124. Naturally they also work with whole pigments, normals, and entire
  5125. textures, just as the other patterns do above. The only
  5126. difference is that we list entries in the pattern (as we would do
  5127. with individual colors) rather than using a map of entries. Here
  5128. is an example. We strike the plane and any declared pigments we
  5129. had left over in our last example, and add the following to our
  5130. basic file.
  5131.  
  5132.   #declare Pigment1 = pigment {
  5133.     hexagon
  5134.     color Yellow color Green color Grey
  5135.     scale .1
  5136.   }
  5137.   #declare Pigment2 = pigment {
  5138.     checker
  5139.     color Red color Blue
  5140.     scale .1
  5141.   }
  5142.   #declare Pigment3 = pigment {
  5143.     brick
  5144.     color White color Black
  5145.     rotate -90*x
  5146.     scale .1
  5147.   }
  5148.   box { -5, 5
  5149.     pigment {
  5150.       hexagon
  5151.       pigment {Pigment1}
  5152.       pigment {Pigment2}
  5153.       pigment {Pigment3}
  5154.       rotate 90*x
  5155.     }
  5156.   }
  5157. We begin by declaring an example of each of the color list
  5158. patterns as individual pigments. Then we use the hexagon pattern
  5159. as a pigment list pattern, simply feeding it a list of pigments
  5160. rather than colors as we did above. There are two rotate
  5161. statements throughout this example, because bricks are aligned
  5162. along the z-direction, while hexagons align along the y-
  5163. direction, and we wanted everything to face toward the camera we
  5164. originally declared out in the -z-direction so we can really see
  5165. the patterns within patterns effect here.
  5166.  
  5167. Of course color list patterns used to be only for pigments, but
  5168. as of POV-Ray 3, everything that worked for pigments can now also
  5169. be adapted for normals or entire textures. A couple of quick
  5170. examples might look like
  5171.  
  5172.   normal {
  5173.     brick
  5174.     normal { granite .1 }
  5175.     normal { bumps 1 scale .1 }
  5176.   }
  5177. or...
  5178.  
  5179.   texture {
  5180.     checker
  5181.     texture { Gold_Metal }
  5182.     texture { Silver_Metal }
  5183.   }
  5184.  
  5185. 2.7.8     What About Tiles?
  5186. In earlier versions of POV-Ray, there was a texture pattern
  5187. called tiles. By simply using a checker texture pattern (as we
  5188. just saw above), we can achieve the same thing as tiles used to
  5189. do, so it is now obsolete. It is still supported by POV-Ray 3 for
  5190. backwards compatibility with old scene files, but now is a good
  5191. time to get in the habit of using a checker pattern instead.
  5192.  
  5193.  
  5194. 2.7.9     Average Function
  5195. Now things get interesting. Above, we began to see how pigments
  5196. and normals can fade from one to the other when we used them in
  5197. maps. But how about if we want a smooth blend of patterns all the
  5198. way through? That is where a new feature called average can come
  5199. in very handy. Average works with pigment, normal, and texture
  5200. maps, although the syntax is a little bit different, and when we
  5201. are not expecting it, the change can be confusing. Here is a
  5202. simple example. We use our standard includes, camera and light
  5203. source from above, and enter the following object.
  5204.  
  5205.   plane { -z, 0
  5206.     pigment { White }
  5207.     normal {
  5208.       average
  5209.       normal_map {
  5210.         [ gradient x ]
  5211.         [ gradient y ]
  5212.       }
  5213.     }
  5214.   }
  5215. What we have done here is pretty self explanatory as soon as we
  5216. render it. We have combined a vertical with a horizontal gradient
  5217. bump pattern, creating crisscrossing gradients. Actually, the
  5218. crisscrossing effect is a smooth blend of gradient x with
  5219. gradient y all the way across our plane. Now, what about that
  5220. syntax difference?
  5221.  
  5222. We see how our normal map has changed from earlier examples. The
  5223. floating point value to the left-hand side of each map entry has
  5224. been removed.  That value usually helps in procedurally mapping
  5225. each entry to the pattern we have selected, but average is a
  5226. smooth blend all the way through, not a pattern, so it cannot use
  5227. those values. In fact, including them may sometimes lead to
  5228. unexpected results, such as entries being lost or misrepresented
  5229. in some way. To ensure that we'll get the pattern blend we
  5230. anticipate, we leave off the floating point value.
  5231.  
  5232.  
  5233. 2.7.10    Working With Layered Textures
  5234. With the multitudinous colors, patterns, and options for creating
  5235. complex textures in POV-Ray, we can easily become deeply
  5236. engrossed in mixing and tweaking just the right textures to apply
  5237. to our latest creations. But as we go, sooner or later there is
  5238. going to come that special texture. That texture that is sort of
  5239. like wood, only varnished, and with a kind of spotty yellow
  5240. streaking, and some vertical gray flecks, that looks like someone
  5241. started painting over it all, and then stopped, leaving part of
  5242. the wood visible through the paint.
  5243.  
  5244. Only... now what? How do we get all that into one texture? No
  5245. pattern can do that many things. Before we panic and say image
  5246. map there is at least one more option: layered textures.
  5247.  
  5248. With layered textures, we only need to specify a series of
  5249. textures, one after the other, all associated with the same
  5250. object. Each texture we list will be applied one on top of the
  5251. other, from bottom to top in the order they appear.
  5252.  
  5253. It is very important to note that we must have some degree of
  5254. transparency (filter or transmit) in the pigments of our upper
  5255. textures, or the ones below will get lost underneath. We won't
  5256. receive a warning or an error - technically it is legal to do
  5257. this: it just doesn't make sense. It is like spending hours
  5258. sketching an elaborate image on a bare wall, then slapping a
  5259. solid white coat of latex paint over it.
  5260.  
  5261. Let's design a very simple object with a layered texture, and
  5262. look at how it works. We create a file called LAYTEX.POV and add
  5263. the following lines.
  5264.  
  5265.   #include "colors.inc"
  5266.   #include "textures.inc"
  5267.   camera {
  5268.     location <0, 5, -30>
  5269.     look_at <0, 0, 0>
  5270.   }
  5271.   light_source { <-20, 30, -50> color White }
  5272.   plane { y, 0 pigment { checker color Green color Yellow  } }
  5273.   background { rgb <.7, .7, 1> }
  5274.   box { <-10, 0, -10>, <10, 10, 10>
  5275.     texture {
  5276.       Silver_Metal // a metal object ...
  5277.       normal {     // ... which has suffered a beating
  5278.         dents 2
  5279.         scale 1.5
  5280.       }
  5281.     } // (end of base texture)
  5282.     texture { // ... has some flecks of rust ...
  5283.       pigment {
  5284.         granite
  5285.         color_map {
  5286.           [0.0 rgb <.2, 0, 0> ]
  5287.           [0.2 color Brown ]
  5288.           [0.2 rgbt <1, 1, 1, 1> ]
  5289.           [1.0 rgbt <1, 1, 1, 1> ]
  5290.         }
  5291.         frequency 16
  5292.       }
  5293.     } // (end rust fleck texture)
  5294.     texture { // ... and some sooty black marks
  5295.       pigment {
  5296.         bozo
  5297.         color_map {
  5298.           [0.0 color Black ]
  5299.           [0.2 color rgbt <0, 0, 0, .5> ]
  5300.           [0.4 color rgbt <.5, .5, .5, .5> ]
  5301.           [0.5 color rgbt <1, 1, 1, 1> ]
  5302.           [1.0 color rgbt <1, 1, 1, 1> ]
  5303.         }
  5304.         scale 3
  5305.       }
  5306.     } // (end of sooty mark texture)
  5307.   } // (end of box declaration)
  5308. Whew. This gets complicated, so to make it easier to read, we
  5309. have included comments showing what we are doing and where
  5310. various parts of the declaration end (so we don't get lost in all
  5311. those closing brackets!). To begin, we created a simple box over
  5312. the classic checkerboard floor, and give the background sky a
  5313. pale blue color. Now for the fun part...
  5314.  
  5315. To begin with we made the box use the Silver_Metal texture as
  5316. declared in textures.inc (for bonus points, look up textures.inc
  5317. and see how this standard texture was originally created
  5318. sometime). To give it the start of its abused state, we added the
  5319. dents normal pattern, which creates the illusion of some denting
  5320. in the surface as if our mysterious metal box had been knocked
  5321. around quite a bit.
  5322.  
  5323. The flecks of rust are nothing but a fine grain granite pattern
  5324. fading from dark red to brown which then abruptly drops to fully
  5325. transparent for the majority of the color map. True, we could
  5326. probably come up with a more realistic pattern of rust using
  5327. pigment maps to cluster rusty spots, but pigment maps are a
  5328. subject for another tutorial section, so let's skip that just
  5329. now.
  5330.  
  5331. Lastly, we have added a third texture to the pot. The randomly
  5332. shifting bozo texture gradually fades from blackened centers to
  5333. semi-transparent medium gray, and then ultimately to fully
  5334. transparent for the latter half of its color map. This gives us a
  5335. look of sooty burn marks further marring the surface of the metal
  5336. box. The final result leaves our mysterious metal box looking
  5337. truly abused, using multiple texture patterns, one on top of the
  5338. other, to produce an effect that no single pattern could
  5339. generate!
  5340.  
  5341.  
  5342. 2.7.10.1  Declaring Layered Textures
  5343. In the event we want to reuse a layered texture on several
  5344. objects in our scene, it is perfectly legal to declare a layered
  5345. texture. We won't repeat the whole texture from above, but the
  5346. general format would be something like this:
  5347.  
  5348.   #declare Abused_Metal =
  5349.     texture { /* insert your base texture here... */ }
  5350.     texture { /* and your rust flecks here... */ }
  5351.     texture { /* and of course, your sooty burn marks here */ }
  5352. POV-Ray has no problem spotting where the declaration ends,
  5353. because the textures follow one after the other with no objects
  5354. or directives in between. The layered texture to be declared will
  5355. be assumed to continue until it finds something other than
  5356. another texture, so any number of layers can be added in to a
  5357. declaration in this fashion.
  5358.  
  5359. One final word about layered textures: whatever layered texture
  5360. we create, whether declared or not, we must not leave off the
  5361. texture wrapper. In conventional single textures a common
  5362. shorthand is to have just a pigment, or just a pigment and
  5363. finish, or just a normal, or whatever, and leave them outside of
  5364. a texture statement. This shorthand does not extend to layered
  5365. textures. As far as POV-Ray is concerned we can layer entire
  5366. textures, but not individual pieces of textures. For example
  5367.  
  5368.   #declare Bad_Texture =
  5369.     texture { /* insert your base texture here... */ }
  5370.     pigment { Red filter .5 }
  5371.     normal { bumps 1 }
  5372. will not work. The pigment and the normal are just floating there
  5373. without being part of any particular texture. Inside an object,
  5374. with just a single texture, we can do this sort of thing, but
  5375. with layered textures, we would just generate an error whether
  5376. inside the object or in a declaration.
  5377.  
  5378.  
  5379. 2.7.10.2  Another Layered Textures Example
  5380. To further explain how layered textures work another example is
  5381. described in detail. A tablecloth is created to be used in a
  5382. picnic scene. Since a simple red and white checkered cloth looks
  5383. entirely too new, too flat, and too much like a tiled floor,
  5384. layered textures are used to stain the cloth.
  5385.  
  5386. We're going to create a scene containing four boxes. The first
  5387. box has that plain red and white texture we started with in our
  5388. picnic scene, the second adds a layer meant to realistically fade
  5389. the cloth, the third adds some wine stains, and the final box
  5390. adds a few wrinkles (not another layer, but we must note when and
  5391. where adding changes to the surface normal have an effect in
  5392. layered textures).
  5393.  
  5394. We start by placing a camera, some lights, and the first box. At
  5395. this stage, the texture is plain tiling, not layered. See file
  5396. layered1.pov.
  5397.  
  5398.   #include "colors.inc"
  5399.   camera {
  5400.     location <0, 0, -6>
  5401.     look_at <0, 0, 0>
  5402.   }
  5403.   light_source { <-20, 30, -100> color White }
  5404.   light_source { <10, 30, -10> color White }
  5405.   light_source { <0, 30, 10> color White }
  5406.   #declare PLAIN_TEXTURE =
  5407.     // red/white check
  5408.     texture {
  5409.       pigment {
  5410.         checker
  5411.         color rgb<1.000, 0.000, 0.000>
  5412.         color rgb<1.000, 1.000, 1.000>
  5413.         scale <0.2500, 0.2500, 0.2500>
  5414.       }
  5415.     }
  5416.   // plain red/white check box
  5417.   box { <-1, -1, -1>, <1, 1, 1>
  5418.     texture {
  5419.       PLAIN_TEXTURE
  5420.     }
  5421.     translate  <-1.5, 1.2, 0>
  5422.   }
  5423. We render this scene. It is not particularly interesting, isn't
  5424. it? That is why we will use some layered textures to make it more
  5425. interesting.
  5426.  
  5427. First, we add a layer of two different, partially transparent
  5428. grays. We tile them as we had tiled the red and white colors, but
  5429. we add some turbulence to make the fading more realistic. We add
  5430. following box to the previous scene and re-render (see file
  5431. layered2.pov).
  5432.  
  5433.   #declare FADED_TEXTURE =
  5434.     // red/white check texture
  5435.     texture {
  5436.       pigment {
  5437.         checker
  5438.         color rgb<0.920, 0.000, 0.000>
  5439.         color rgb<1.000, 1.000, 1.000>
  5440.         scale <0.2500, 0.2500, 0.2500>
  5441.       }
  5442.     }
  5443.     // greys to fade red/white
  5444.     texture {
  5445.       pigment {
  5446.         checker
  5447.         color rgbf<0.632, 0.612, 0.688, 0.698>
  5448.         color rgbf<0.420, 0.459, 0.520, 0.953>
  5449.         turbulence 0.500
  5450.         scale <0.2500, 0.2500, 0.2500>
  5451.       }
  5452.     }
  5453.   // faded red/white check box
  5454.   box { <-1, -1, -1>, <1, 1, 1>
  5455.     texture {
  5456.       FADED_TEXTURE
  5457.     }
  5458.     translate  <1.5, 1.2, 0>
  5459.   }
  5460. Even though it is a subtle difference, the red and white checks
  5461. no longer look quite so new.
  5462.  
  5463. Since there is a bottle of wine in the picnic scene, we thought
  5464. it might be a nice touch to add a stain or two. While this effect
  5465. can almost be achieved by placing a flattened blob on the cloth,
  5466. what we really end up with is a spill effect, not a stain. Thus
  5467. it is time to add another layer.
  5468.  
  5469. Again, we add another box to the scene we already have scripted
  5470. and re-render (see file layered3.pov).
  5471.  
  5472.   #declare STAINED_TEXTURE =
  5473.     // red/white check
  5474.     texture {
  5475.       pigment {
  5476.         checker
  5477.         color rgb<0.920, 0.000, 0.000>
  5478.         color rgb<1.000, 1.000, 1.000>
  5479.         scale <0.2500, 0.2500, 0.2500>
  5480.       }
  5481.     }
  5482.     // greys to fade check
  5483.     texture {
  5484.       pigment {
  5485.         checker
  5486.         color rgbf<0.634, 0.612, 0.688, 0.698>
  5487.         color rgbf<0.421, 0.463, 0.518, 0.953>
  5488.         turbulence 0.500
  5489.         scale <0.2500, 0.2500, 0.2500>
  5490.       }
  5491.     }
  5492.     // wine stain
  5493.     texture {
  5494.       pigment {
  5495.         spotted
  5496.         color_map {
  5497.           [ 0.000  color rgb<0.483, 0.165, 0.165> ]
  5498.           [ 0.329  color rgbf<1.000, 1.000, 1.000, 1.000> ]
  5499.           [ 0.734  color rgbf<1.000, 1.000, 1.000, 1.000> ]
  5500.           [ 1.000  color rgb<0.483, 0.165, 0.165> ]
  5501.         }
  5502.         turbulence 0.500
  5503.         frequency 1.500
  5504.       }
  5505.     }
  5506.   // stained box
  5507.   box { <-1, -1, -1>, <1, 1, 1>
  5508.     texture {
  5509.       STAINED_TEXTURE
  5510.     }
  5511.     translate  <-1.5, -1.2, 0>
  5512.   }
  5513. Now there's a tablecloth texture with personality.
  5514.  
  5515. Another touch we want to add to the cloth are some wrinkles as if
  5516. the cloth had been rumpled. This is not another texture layer,
  5517. but when working with layered textures, we must keep in mind that
  5518. changes to the surface normal must be included in the uppermost
  5519. layer of the texture. Changes to lower layers have no effect on
  5520. the final product (no matter how transparent the upper layers
  5521. are).
  5522.  
  5523. We add this final box to the script and re-render (see file
  5524. layered4.pov)
  5525.  
  5526.   #declare WRINKLED_TEXTURE =
  5527.     // red and white check
  5528.     texture {
  5529.       pigment {
  5530.         checker
  5531.         color rgb<0.920, 0.000, 0.000>
  5532.         color rgb<1.000, 1.000, 1.000>
  5533.         scale <0.2500, 0.2500, 0.2500>
  5534.       }
  5535.     }
  5536.     // greys to "fade" checks
  5537.     texture {
  5538.       pigment {
  5539.         checker
  5540.         color rgbf<0.632, 0.612, 0.688, 0.698>
  5541.         color rgbf<0.420, 0.459, 0.520, 0.953>
  5542.         turbulence 0.500
  5543.         scale <0.2500, 0.2500, 0.2500>
  5544.       }
  5545.     }
  5546.     // the wine stains
  5547.     texture {
  5548.       pigment {
  5549.         spotted
  5550.         color_map {
  5551.           [ 0.000  color rgb<0.483, 0.165, 0.165> ]
  5552.           [ 0.329  color rgbf<1.000, 1.000, 1.000, 1.000> ]
  5553.           [ 0.734  color rgbf<1.000, 1.000, 1.000, 1.000> ]
  5554.           [ 1.000  color rgb<0.483, 0.165, 0.165> ]
  5555.         }
  5556.         turbulence 0.500
  5557.         frequency 1.500
  5558.       }
  5559.       normal {
  5560.         wrinkles 5.0000
  5561.       }
  5562.     }
  5563.   // wrinkled box
  5564.   box { <-1, -1, -1>, <1, 1, 1>
  5565.     texture {
  5566.       WRINKLED_TEXTURE
  5567.     }
  5568.     translate  <1.5, -1.2, 0>
  5569.   }
  5570. Well, this may not be the tablecloth we want at any picnic we're
  5571. attending, but if we compare the final box to the first, we see
  5572. just how much depth, dimension, and personality is possible just
  5573. by the use of creative texturing.
  5574.  
  5575. One final note: the comments concerning the surface normal do not
  5576. hold true for finishes. If a lower layer contains a specular
  5577. finish and an upper layer does not, any place where the upper
  5578. layer is transparent, the specular will show through.
  5579.  
  5580.  
  5581. 2.7.11    When All Else Fails: Material Maps
  5582. We have some pretty powerful texturing tools at our disposal, but
  5583. what if we want a more free form arrangement of complex textures?
  5584. Well, just as image maps do for pigments, and bump maps do for
  5585. normals, whole textures can be mapped using a material map,
  5586. should the need arise.
  5587.  
  5588. Just as with image maps and bump maps, we need a source image in
  5589. bitmapped format which will be called by POV-Ray to serve as the
  5590. map of where the individual textures will go, but this time, we
  5591. need to specify what texture will be associated with which
  5592. palette index. To make such an image, we can use a paint program
  5593. which allows us to select colors by their palette index number
  5594. (the actual color is irrelevant, since it is only a map to tell
  5595. POV-Ray what texture will go at that location). Now, if we have
  5596. the complete package that comes with POV-Ray, we have in our
  5597. include files an image called povmap.gif which is a bitmapped
  5598. image that uses only the first four palette indices to create a
  5599. bordered square with the words "Persistence of Vision" in it.
  5600. This will do just fine as a sample map for the following example.
  5601. Using our same include files, the camera and light source, we
  5602. enter the following object.
  5603.  
  5604.   plane { -z, 0
  5605.     texture {
  5606.       material_map {
  5607.         gif "povmap.gif"
  5608.         interpolate 2
  5609.         once
  5610.         texture { PinkAlabaster }          // the inner border
  5611.         texture { pigment { DMFDarkOak } } // outer border
  5612.         texture { Gold_Metal }             // lettering
  5613.         texture { Chrome_Metal }           // the window panel
  5614.       }
  5615.       translate <-0.5, -0.5, 0>
  5616.       scale 5
  5617.     }
  5618.   }
  5619. The position of the light source and the lack of foreground
  5620. objects to be reflected do not show these textures off to their
  5621. best advantage. But at least we can see how the process works.
  5622. The textures have simply been placed according to the location of
  5623. pixels of a particular palette index. By using the once keyword
  5624. (to keep it from tiling), and translating and scaling our map to
  5625. match the camera we have been using, we get to see the whole
  5626. thing laid out for us.
  5627.  
  5628. Of course, that is just with palette mapped image formats, such
  5629. as GIF and certain flavors of PNG. Material maps can also use non-
  5630. paletted formats, such as the TGA files that POV-Ray itself
  5631. outputs. That leads to an interesting consequence: We can use POV-
  5632. Ray to produce source maps for POV-Ray! Before we wrap up with
  5633. some of the limitations of special textures, let's do one more
  5634. thing with material maps, to show how POV-Ray can make its own
  5635. source maps.
  5636.  
  5637. To begin with, if using an non-paletted image, POV-Ray looks at
  5638. the 8 bit red component of the pixel's color (which will be a
  5639. value from 0 to 255) to determine which texture from the list to
  5640. use. So to create a source map, we need to control very precisely
  5641. what the red value of a given pixel will be. We can do this by
  5642.  
  5643.   1.)  Using an rgb statement to choose our color such as rgb
  5644.   <N/255,0,0>, where "N" is the red value we want to assign that
  5645.   pigment, and then...
  5646.   2.)  Use no light sources and apply a finish of finish{ambient
  5647.   1} to all objects, to ensure that highlighting and shadowing
  5648.   will not interfere.
  5649. Confused? Alright, here is an example, which will generate a map
  5650. very much like povmap.gif which we used earlier, except in TGA
  5651. file format. We notice that we have given the pigments blue and
  5652. green components too. POV-Ray will ignore that in our final map,
  5653. so this is really for us humans, whose unaided eyes cannot tell
  5654. the difference between red variances of 0 to 4/255ths. Without
  5655. those blue and green variances, our map would look to our eyes
  5656. like a solid black screen. That may be a great way to send secret
  5657. messages using POV-Ray (plug it into a material map to decode)
  5658. but it is no use if we want to see what our source map looks like
  5659. to make sure we have what we expected to.
  5660.  
  5661. We render the following code, and name the resulting file
  5662. povmap.tga.
  5663.  
  5664.   camera {
  5665.     orthographic
  5666.     up <0, 5, 0>
  5667.     right <5, 0, 0>
  5668.     location <0, 0, -25>
  5669.     look_at <0, 0, 0>
  5670.   }
  5671.   plane { -z, 0
  5672.     pigment { rgb <1/255, 0, 0.5> }
  5673.     finish { ambient 1 }
  5674.   }
  5675.   box { <-2.3, -1.8, -0.2>, <2.3, 1.8, -0.2>
  5676.     pigment { rgb <0/255, 0, 1> }
  5677.     finish { ambient 1 }
  5678.   }
  5679.   box { <-1.95, -1.3, -0.4>, <1.95, 1.3, -0.3>
  5680.     pigment { rgb <2/255, 0.5, 0.5> }
  5681.     finish { ambient 1 }
  5682.   }
  5683.   text { ttf "crystal.ttf", "The vision", 0.1, 0
  5684.     scale <0.7, 1, 1>
  5685.     translate <-1.8, 0.25, -0.5>
  5686.     pigment { rgb <3/255, 1, 1> }
  5687.     finish { ambient 1 }
  5688.   }
  5689.   text { ttf "crystal.ttf", "Persists!", 0.1, 0
  5690.     scale <0.7, 1, 1>
  5691.     translate <-1.5, -1, -0.5>
  5692.     pigment { rgb <3/255, 1, 1> }
  5693.     finish { ambient 1 }
  5694.   }
  5695. All we have to do is modify our last material map example by
  5696. changing the material map from GIF to TGA and modifying the
  5697. filename. When we render using the new map, the result is
  5698. extremely similar to the palette mapped GIF we used before,
  5699. except that we didn't have to use an external paint program to
  5700. generate our source: POV-Ray did it all!
  5701.  
  5702.  
  5703. 2.7.12    Limitations Of Special Textures
  5704. There are a couple limitations to all of the special textures we
  5705. have seen (from textures, pigment and normal maps through
  5706. material maps). First, if we have used the default directive to
  5707. set the default texture for all items in our scene, it will not
  5708. accept any of the special textures discussed here.  This is
  5709. really quite minor, since we can always declare such a texture
  5710. and apply it individually to all objects. It doesn't actually
  5711. prevent us from doing anything we couldn't otherwise do.
  5712.  
  5713. The other is more limiting, but as we will shortly see, can be
  5714. worked around quite easily. If we have worked with layered
  5715. textures, we have already seen how we can pile multiple texture
  5716. patterns on top of one another (as long as one texture has
  5717. transparency in it). This very useful technique has a problem
  5718. incorporating the special textures we have just seen as a layer.
  5719. But there is an answer!
  5720.  
  5721. For example, say we have a layered texture called Speckled_Metal,
  5722. which produces a silver metallic surface, and then puts tiny
  5723. specks of rust all over it. Then we decide, for a really rusty
  5724. look, we want to create patches of concentrated rust, randomly
  5725. over the surface. The obvious approach is to create a special
  5726. texture pattern, with transparency to use as the top layer. But
  5727. of course, as we have seen, we wouldn't be able to use that
  5728. texture pattern as a layer. We would just generate an error
  5729. message. The solution is to turn the problem inside out, and make
  5730. our layered texture part of the texture pattern instead, like
  5731. this
  5732.  
  5733.   // This part declares a pigment for use
  5734.   // in the rust patch texture pattern
  5735.   #declare Rusty = pigment {
  5736.     granite
  5737.     color_map {
  5738.       [ 0 rgb <0.2, 0, 0> ]
  5739.       [ 1 Brown ]
  5740.     }
  5741.     frequency 20
  5742.   }
  5743.   // And this part applies it
  5744.   // Notice that our original layered texture
  5745.   // "Speckled_Metal" is now part of the map
  5746.   #declare Rust_Patches = texture {
  5747.     bozo
  5748.     texture_map {
  5749.       [ 0.0  pigment {Rusty} ]
  5750.       [ 0.75 Speckled_Metal ]
  5751.       [ 1.0  Speckled_Metal ]
  5752.     }
  5753.   }
  5754. And the ultimate effect is the same as if we had layered the rust
  5755. patches on to the speckled metal anyway.
  5756.  
  5757. With the full array of patterns, pigments, normals, finishes,
  5758. layered and special textures, there is now practically nothing we
  5759. cannot create in the way of amazing textures. An almost infinite
  5760. number of new possibilities are just waiting to be created!
  5761.  
  5762.  
  5763. 2.8  Using the Camera
  5764.  
  5765. 2.8.1     Using Focal Blur
  5766. Let's construct a simple scene to illustrate the use of focal
  5767. blur. For this example we will use a pink sphere, a green box and
  5768. a blue cylinder with the sphere placed in the foreground, the box
  5769. in the center and the cylinder in the background. A checkered
  5770. floor for perspective and a couple of light sources will complete
  5771. the scene. We create a new file called focaldem.pov and enter the
  5772. following text
  5773.  
  5774.   #include "colors.inc"
  5775.   #include "shapes.inc"
  5776.   #include "textures.inc"
  5777.   sphere { <1, 0, -6>, 0.5
  5778.     finish {
  5779.       ambient 0.1
  5780.       diffuse 0.6
  5781.     }
  5782.     pigment { NeonPink }
  5783.   }
  5784.   box { <-1, -1, -1>, < 1,  1,  1>
  5785.     rotate <0, -20, 0>
  5786.     finish {
  5787.       ambient 0.1
  5788.       diffuse 0.6
  5789.     }
  5790.     pigment { Green }
  5791.   }
  5792.   cylinder { <-6, 6, 30>, <-6, -1, 30>, 3
  5793.     finish {
  5794.       ambient 0.1
  5795.       diffuse 0.6
  5796.     }
  5797.     pigment {NeonBlue}
  5798.   }
  5799.   plane { y, -1.0
  5800.     pigment {
  5801.       checker color Gray65 color Gray30
  5802.     }
  5803.   }
  5804.   light_source { <5, 30, -30> color White }
  5805.   light_source { <-5, 30, -30> color White }
  5806. Now we can proceed to place our focal blur camera to an
  5807. appropriate viewing position. Straight back from our three
  5808. objects will yield a nice view. Adjusting the focal point will
  5809. move the point of focus anywhere in the scene. We just add the
  5810. following lines to the file:
  5811.  
  5812.   camera {
  5813.     location <0.0, 1.0, -10.0>
  5814.     look_at  <0.0, 1.0,  0.0>
  5815.   //  focal_point <-6, 1, 30>    // blue cylinder in focus
  5816.   //  focal_point < 0, 1,  0>    // green box in focus
  5817.     focal_point < 1, 1, -6>    // pink sphere in focus
  5818.     aperture 0.4     // a nice compromise
  5819.   //  aperture 0.05    // almost everything is in focus
  5820.   //  aperture 1.5     // much blurring
  5821.   //  blur_samples 4       // fewer samples, faster to render
  5822.     blur_samples 20      // more samples, higher quality image
  5823.   }
  5824. The focal point is simply the point at which the focus of the
  5825. camera is at its sharpest. We position this point in our scene
  5826. and assign a value to the aperture to adjust how close or how far
  5827. away we want the focal blur to occur from the focused area.
  5828.  
  5829. The aperture setting can be considered an area of focus. Opening
  5830. up the aperture has the effect of making the area of focus
  5831. smaller while giving the aperture a smaller value makes the area
  5832. of focus larger. This is how we control where focal blur begins
  5833. to occur around the focal point.
  5834.  
  5835. The blur samples setting determines how many rays are used to
  5836. sample each pixel. Basically, the more rays that are used the
  5837. higher the quality of the resultant image, but consequently the
  5838. longer it takes to render. Each scene is different so we have to
  5839. experiment.  This tutorial has examples of 4 and 20 samples but
  5840. we can use more for high resolution images. We should not use
  5841. more samples than is necessary to achieve the desired quality -
  5842. more samples take more time to render. The confidence and
  5843. variance settings are covered in section "Focal Blur".
  5844.  
  5845. We experiment with the focal point, aperture, and blur sample
  5846. settings.  The scene has lines with other values that we can try
  5847. by commenting out the default line with double slash marks and un-
  5848. commenting the line we wish to try out. We make only one change
  5849. at a time to see the effect on the scene.
  5850.  
  5851. Two final points when tracing a scene using a focal blur camera.
  5852. We needn't specify anti-aliasing because the focal blur code uses
  5853. its one sampling method that automatically takes care of anti-
  5854. aliasing. Focal blur can only be used with the perspective
  5855. camera.
  5856.  
  5857.  
  5858. 2.9  Using Atmospheric Effects
  5859. POV-Ray offers a variety of atmospheric effects, i. e. features
  5860. that affect the background of the scene or the air by which
  5861. everything is surrounded.
  5862.  
  5863. It is easy to assign a simple color or a complex color pattern to
  5864. a virtual sky sphere. You can create anything from a cloud free,
  5865. blue summer sky to a stormy, heavy clouded sky. Even starfields
  5866. can easily be created.
  5867.  
  5868. You can use different kinds of fog to create foggy scenes.
  5869. Multiple fog layers of different colors can add an eerie touch to
  5870. your scene.
  5871.  
  5872. A much more realistic effect can be created by using an
  5873. atmosphere, a constant fog that interacts with the light coming
  5874. from light sources. Beams of light become visible and objects
  5875. will cast shadows into the fog.
  5876.  
  5877. Last but not least you can add a rainbow to your scene.
  5878.  
  5879.  
  5880. 2.9.1     The Background
  5881. The background feature is used to assign a color to all rays that
  5882. don't hit any object. This is done in the following way.
  5883.  
  5884.   camera {
  5885.     location <0, 0, -10>
  5886.     look_at <0, 0, 0>
  5887.   }
  5888.   background { color rgb <0.2, 0.2, 0.3> }
  5889.   sphere { 0, 1
  5890.     pigment { color rgb <0.8, 0.5, 0.2> }
  5891.   }
  5892. The background color will be visible if a sky sphere is used and
  5893. if some translucency remains after all sky sphere pigment layers
  5894. are processed.
  5895.  
  5896.  
  5897. 2.9.2     The Sky Sphere
  5898. The sky_sphere can be used to easily create a cloud covered sky,
  5899. a nightly star sky or whatever sky you have in mind.
  5900.  
  5901. In the following examples we'll start with a very simple sky
  5902. sphere that will get more and more complex as we add new features
  5903. to it.
  5904.  
  5905.  
  5906. 2.9.2.1   Creating a Sky with a Color Gradient
  5907. Beside the single color sky sphere that is covered with the
  5908. background feature the simplest sky sphere is a color gradient.
  5909.  
  5910. You may have noticed that the color of the sky varies with the
  5911. angle to the earth's surface normal. If you look straight up the
  5912. sky normally has a much deeper blue than it has at the horizon.
  5913.  
  5914. We want to model this effect using the sky sphere as shown in the
  5915. scene below (skysph1.pov).
  5916.  
  5917.   #include "colors.inc"
  5918.   camera {
  5919.     location <0, 1, -4>
  5920.     look_at <0, 2, 0>
  5921.     angle 80
  5922.   }
  5923.   light_source { <10, 10, -10> White }
  5924.   sphere { 2*y, 1
  5925.     pigment { color rgb <1, 1, 1> }
  5926.     finish { ambient 0.2 diffuse 0 reflection 0.6 }
  5927.   }
  5928.   sky_sphere {
  5929.     pigment {
  5930.       gradient y
  5931.       color_map {
  5932.         [0 color Red]
  5933.         [1 color Blue]
  5934.       }
  5935.       scale 2
  5936.       translate -1
  5937.     }
  5938.   }
  5939. The interesting part is the sky sphere statement. It contains a
  5940. pigment that describe the look of the sky sphere. We want to
  5941. create a color gradient along the viewing angle measured against
  5942. the earth's surface normal. Since the ray direction vector is
  5943. used to calculate the pigment colors we have to use the y-
  5944. gradient.
  5945.  
  5946. The scale and translate transformation are used to map the points
  5947. derived from the direction vector to the right range. Without
  5948. those transformations the pattern would be repeated twice on the
  5949. sky sphere. The scale statement is used to avoid the repetition
  5950. and the translate -1 statement moves the color at index zero to
  5951. the bottom of the sky sphere (that's the point of the sky sphere
  5952. you'll see if you look straight down).
  5953.  
  5954. After this transformation the color entry at position 0 will be
  5955. at the bottom of the sky sphere, i. e. below us, and the color at
  5956. position 1 will be at the top, i. e. above us.
  5957.  
  5958. The colors for all other positions are interpolated between those
  5959. two colors as you can see in the resulting image.
  5960.  
  5961.                                 
  5962.                                 
  5963.                   A simple gradient sky sphere.
  5964.                                 
  5965. If you want to start one of the colors at a specific angle you'll
  5966. first have to convert the angle to a color map index. This is
  5967. done by using the formula
  5968.  
  5969.   color_map_index = (1 - cos(angle)) / 2
  5970. where the angle is measured against the negated earth's surface
  5971. normal. This is the surface normal pointing towards the center of
  5972. the earth. An angle of 0 degrees describes the point below us
  5973. while an angle of 180 degrees represents the zenith.
  5974.  
  5975. In POV-Ray you first have to convert the degree value to radian
  5976. values as it is shown in the following example.
  5977.  
  5978.   sky_sphere {
  5979.     pigment {
  5980.       gradient y
  5981.       color_map {
  5982.         [(1-cos(radians( 30)))/2 color Red]
  5983.         [(1-cos(radians(120)))/2 color Blue]
  5984.       }
  5985.       scale 2
  5986.       translate -1
  5987.     }
  5988.   }
  5989. This scene uses a color gradient that starts with a red color at
  5990. 30 degrees and blends into the blue color at 120 degrees. Below
  5991. 30 degrees everything is red while above 120 degrees all is blue.
  5992.  
  5993.  
  5994. 2.9.2.2   Adding the Sun
  5995. In the following example we will create a sky with a red sun
  5996. surrounded by a red color halo that blends into the dark blue
  5997. night sky. We'll do this using only the sky sphere feature.
  5998.  
  5999. The sky sphere we use is shown below. A ground plane is also
  6000. added for greater realism (skysph2.pov).
  6001.  
  6002.   sky_sphere {
  6003.     pigment {
  6004.       gradient y
  6005.       color_map {
  6006.         [0.000 0.002 color rgb <1.0, 0.2, 0.0>
  6007.                      color rgb <1.0, 0.2, 0.0>]
  6008.         [0.002 0.200 color rgb <0.8, 0.1, 0.0>
  6009.                      color rgb <0.2, 0.2, 0.3>]
  6010.       }
  6011.       scale 2
  6012.       translate -1
  6013.     }
  6014.     rotate -135*x
  6015.   }
  6016.   plane { y, 0
  6017.     pigment { color Green }
  6018.     finish { ambient .3 diffuse .7 }
  6019.   }
  6020. The gradient pattern and the transformation inside the pigment
  6021. are the same as in the example in the previous section.
  6022.  
  6023. The color map consists of three colors. A bright, slightly
  6024. yellowish red that is used for the sun, a darker red for the halo
  6025. and a dark blue for the night sky. The sun's color covers only a
  6026. very small portion of the sky sphere because we don't want the
  6027. sun to become too big. The color is used at the color map values
  6028. 0.000 and 0.002 to get a sharp contrast at value 0.002 (we don't
  6029. want the sun to blend into the sky). The darker red color used
  6030. for the halo blends into the dark blue sky color from value 0.002
  6031. to 0.200. All values above 0.200 will reveal the dark blue sky.
  6032.  
  6033. The rotate -135*x statement is used to rotate the sun and the
  6034. complete sky sphere to its final position. Without this rotation
  6035. the sun would be at 0 degrees, i.e. right below us.
  6036.  
  6037.                                 
  6038.                                 
  6039.                A red sun descends into the night.
  6040.                                 
  6041. Looking at the resulting image you'll see what impressive effects
  6042. you can achieve with the sky sphere.
  6043.  
  6044.  
  6045. 2.9.2.3   Adding Some Clouds
  6046. To further improve our image we want to add some clouds by adding
  6047. a second pigment. This new pigment uses the bozo pattern to
  6048. create some nice clouds. Since it lays on top of the other
  6049. pigment it needs some transparent colors in the color map (look
  6050. at entries 0.5 to 1.0).
  6051.  
  6052.   sky_sphere {
  6053.     pigment {
  6054.       gradient y
  6055.       color_map {
  6056.         [0.000 0.002 color rgb <1.0, 0.2, 0.0>
  6057.                      color rgb <1.0, 0.2, 0.0>]
  6058.         [0.002 0.200 color rgb <0.8, 0.1, 0.0>
  6059.                      color rgb <0.2, 0.2, 0.3>]
  6060.       }
  6061.       scale 2
  6062.       translate -1
  6063.     }
  6064.     pigment {
  6065.       bozo
  6066.       turbulence 0.65
  6067.       octaves 6
  6068.       omega 0.7
  6069.       lambda 2
  6070.       color_map {
  6071.           [0.0 0.1 color rgb <0.85, 0.85, 0.85>
  6072.                    color rgb <0.75, 0.75, 0.75>]
  6073.           [0.1 0.5 color rgb <0.75, 0.75, 0.75>
  6074.                    color rgbt <1, 1, 1, 1>]
  6075.           [0.5 1.0 color rgbt <1, 1, 1, 1>
  6076.                    color rgbt <1, 1, 1, 1>]
  6077.       }
  6078.       scale <0.2, 0.5, 0.2>
  6079.     }
  6080.     rotate -135*x
  6081.   }
  6082.                                 
  6083.                                 
  6084.                 A cloudy sky with a setting sun.
  6085.                                 
  6086. The sky sphere has one drawback as you might notice when looking
  6087. at the final image (skysph3.pov). The sun doesn't emit any light
  6088. and the clouds will not cast any shadows. If you want to have
  6089. clouds that cast shadows you'll have to use a real, large sphere
  6090. with an appropriate texture and a light source somewhere outside
  6091. the sphere.
  6092.  
  6093.  
  6094. 2.9.3     The Fog
  6095. You can use the fog feature to add fog of two different types to
  6096. your scene: constant fog and ground fog. The constant fog has a
  6097. constant density everywhere while the ground fog's density
  6098. decreases as you move upwards.
  6099.  
  6100. The usage of both fog types will be described in the next
  6101. sections in detail.
  6102.  
  6103.  
  6104. 2.9.3.1   A Constant Fog
  6105. The simplest fog type is the constant fog that has a constant
  6106. density in all locations. It is specified by a distance keyword
  6107. which actually describes the fog's density and a fog color.
  6108.  
  6109. The distance value determines the distance at which 36.8% of the
  6110. background are still visible (for a more detailed explanation of
  6111. how the fog is calculated read the reference section "Fog").
  6112.  
  6113. The fog color can be used to create anything from a pure white to
  6114. a red, blood-colored fog. You can also use a black fog to
  6115. simulate the effect of a limited range of vision.
  6116.  
  6117. The following example will show you how to add fog to a simple
  6118. scene (fog1.pov).
  6119.  
  6120.   #include "colors.inc"
  6121.   camera {
  6122.     location  <0, 20, -100>
  6123.   }
  6124.   background { color SkyBlue }
  6125.   plane { y, -10
  6126.     pigment {
  6127.       checker color Yellow color Green
  6128.       scale 20
  6129.     }
  6130.   }
  6131.   sphere { <0, 25, 0>, 40
  6132.     pigment { Red }
  6133.     finish { phong 1.0 phong_size 20 }
  6134.   }
  6135.   sphere { <-100, 150, 200>,  20
  6136.     pigment { Green }
  6137.     finish { phong 1.0 phong_size 20 }
  6138.   }
  6139.   sphere { <100, 25, 100>, 30
  6140.     pigment { Blue }
  6141.     finish { phong 1.0 phong_size 20 }
  6142.   }
  6143.   light_source { <100, 120, 40> color White}
  6144.   fog {
  6145.     distance 150
  6146.     color rgb<0.3, 0.5, 0.2>
  6147.   }
  6148.                                 
  6149.                                 
  6150.                          A foggy scene.
  6151.                                 
  6152. According to their distance the spheres in this scene more or
  6153. less vanish in the greenish fog we used, as does the checkerboard
  6154. plane.
  6155.  
  6156.  
  6157. 2.9.3.2   Setting a Minimum Translucency
  6158. If you want to make sure that the background does not completely
  6159. vanish in the fog you can set the transmittance channel of the
  6160. fog's color to the amount of background you always want to be
  6161. visible.
  6162.  
  6163. Using as transmittance value of 0.2 as in
  6164.  
  6165.   fog {
  6166.     distance 150
  6167.     color rgbt<0.3, 0.5, 0.2, 0.2>
  6168.   }
  6169. the fog's translucency never drops below 20% as you can see in
  6170. the resulting image (fog2.pov).
  6171.  
  6172.                                 
  6173.                                 
  6174. Adding a translucency threshold you make sure that the background
  6175.                         does not vanish.
  6176.                                 
  6177.  
  6178. 2.9.3.3   Creating a Filtering Fog
  6179. The greenish fog we have used so far doesn't filter the light
  6180. passing through it. All it does is to diminish the light's
  6181. intensity. We can change this by using a non-zero filter channel
  6182. in the fog's color (fog3.pov).
  6183.  
  6184.   fog {
  6185.     distance 150
  6186.     color rgbf<0.3, 0.5, 0.2, 1.0>
  6187.   }
  6188. The filter value determines the amount of light that is filtered
  6189. by the fog. In our example 100% of the light passing through the
  6190. fog will be filtered by the fog. If we had used a value of 0.7
  6191. only 70% of the light would have been filtered. The remaining 30%
  6192. would have passed unfiltered.
  6193.  
  6194.                                 
  6195.                                 
  6196.                         A filtering fog.
  6197.                                 
  6198. You'll notice that the intensity of the objects in the fog is not
  6199. only diminished due to the fog's color but that the colors are
  6200. actually influenced by the fog. The red and especially the blue
  6201. sphere got a green hue.
  6202.  
  6203.  
  6204. 2.9.3.4   Adding Some Turbulence to the Fog
  6205. In order to make our somewhat boring fog a little bit more
  6206. interesting we can add some turbulence, making it look like it
  6207. had a non-constant density (fog4.pov).
  6208.  
  6209.   fog {
  6210.     distance 150
  6211.     color rgbf<0.3, 0.5, 0.2, 1.0>
  6212.     turbulence 0.2
  6213.     turb_depth 0.3
  6214.   }
  6215.                                 
  6216.                                 
  6217.      Adding some turbulence makes the fog more interesting.
  6218.                                 
  6219. The turbulence keyword is used to specify the amount of
  6220. turbulence used while the turb_depth value is used to move the
  6221. point at which the turbulence value is calculated along the
  6222. viewing ray. Values near zero move the point to the viewer while
  6223. values near one move it to the intersection point (the default
  6224. value is 0.5). This parameter can be used to avoid noise that may
  6225. appear in the fog due to the turbulence (this normally happens at
  6226. very far away intersection points, especially if no intersection
  6227. occurs, i. e. the background is hit). If this happens just lower
  6228. the turb_depth value until the noise vanishes.
  6229.  
  6230. You should keep in mind that the actual density of the fog does
  6231. not change. Only the distance-based attenuation value of the fog
  6232. is modified by the turbulence value at a point along the viewing
  6233. ray.
  6234.  
  6235.  
  6236. 2.9.3.5   Using Ground Fog
  6237. The much more interesting and flexible fog type is the ground
  6238. fog, which is selected with the fog_type statement. It's
  6239. appearance is described with the fog_offset and fog_alt keywords.
  6240. The fog_offset specifies the height, i. e. y value, below which
  6241. the fog has a constant density of one. The fog_alt keyword
  6242. determines how fast the density of the fog will approach zero as
  6243. one moves along the y axis. At a height of fog_offset+fog_alt the
  6244. fog will have a density of 25%.
  6245.  
  6246. The following example (fog5.pov) uses a ground fog which has a
  6247. constant density below y=25 (the center of the red sphere) and
  6248. quickly falls off for increasing altitudes.
  6249.  
  6250.   fog {
  6251.     distance 150
  6252.     color rgbf<0.3, 0.5, 0.2, 1.0>
  6253.     fog_type 2
  6254.     fog_offset 25
  6255.     fog_alt 1
  6256.   }
  6257.                                 
  6258.                                 
  6259.     The ground fog only covers the lower parts of the world.'
  6260.                                 
  6261.  
  6262. 2.9.3.6   Using Multiple Layers of Fog
  6263. It is possible to use several layers of fog by using more than
  6264. one fog statement in your scene file. This is quite useful if you
  6265. want to get nice effects using turbulent ground fogs. You could
  6266. add up several, differently colored fogs to create an eerie scene
  6267. for example.
  6268.  
  6269. Just try the following example (fog6.pov).
  6270.  
  6271.   fog {
  6272.     distance 150
  6273.     color rgb<0.3, 0.5, 0.2>
  6274.     fog_type 2
  6275.     fog_offset 25
  6276.     fog_alt 1
  6277.     turbulence 0.1
  6278.     turb_depth 0.2
  6279.   }
  6280.   fog {
  6281.     distance 150
  6282.     color rgb<0.5, 0.1, 0.1>
  6283.     fog_type 2
  6284.     fog_offset 15
  6285.     fog_alt 4
  6286.     turbulence 0.2
  6287.     turb_depth 0.2
  6288.   }
  6289.   fog {
  6290.     distance 150
  6291.     color rgb<0.1, 0.1, 0.6>
  6292.     fog_type 2
  6293.     fog_offset 10
  6294.     fog_alt 2
  6295.   }
  6296.                                 
  6297.                                 
  6298. Quite nice results can be achieved using multiple layers of fog.
  6299.                                 
  6300. You can combine constant density fogs, ground fogs, filtering
  6301. fogs, non-filtering fogs, fogs with a translucency threshold,
  6302. etc.
  6303.  
  6304.  
  6305. 2.9.3.7   Fog and Hollow Objects
  6306. Whenever you use the fog feature and the camera is inside a non-
  6307. hollow object you won't get any fog effects. For a detailed
  6308. explanation why this happens see "Empty and Solid Objects".
  6309.  
  6310. In order to avoid this problem you have to make all those objects
  6311. hollow by either making sure the camera is outside these objects
  6312. (using the inverse keyword) or by adding the hollow to them
  6313. (which is much easier).
  6314.  
  6315.  
  6316. 2.9.4     The Rainbow
  6317. The rainbow feature can be used to create rainbows and maybe
  6318. other more strange effects. The rainbow is a fog like effect that
  6319. is restricted to a cone-like volume.
  6320.  
  6321.  
  6322. 2.9.4.1   Starting With a Simple Rainbow
  6323. The rainbow is specified with a lot of parameters: the angle
  6324. under which it is visible, the width of the color band, the
  6325. direction of the incoming light, the fog-like distance based
  6326. particle density and last but not least the color map to be used.
  6327.  
  6328. The size and shape of the rainbow are determined by the angle and
  6329. width keywords. The direction keyword is used to set the
  6330. direction of the incoming light, thus setting the rainbow's
  6331. position. The rainbow is visible when the angle between the
  6332. direction vector and the incident light direction is larger than
  6333. angle-width/2 and smaller than angle+width/2.
  6334.  
  6335. The incoming light is the virtual light source that is
  6336. responsible for the rainbow. There needn't be a real light source
  6337. to create the rainbow effect.
  6338.  
  6339. The rainbow is a fog-like effect, i.e. the rainbow's color is
  6340. mixed with the background color based on the distance to the
  6341. intersection point. If you choose small distance values the
  6342. rainbow will be visible on objects, not just in the background.
  6343. You can avoid this by using a very large distance value.
  6344.  
  6345. The color map is the crucial part of the rainbow since it
  6346. contains all the colors that normally can be seen in a rainbow.
  6347. The color of the innermost color band is taken from the color map
  6348. entry 0 while the outermost band is take from entry 1. You should
  6349. note that due to the limited color range any monitor can display
  6350. it is impossible to create a real rainbow. There are just some
  6351. colors that you cannot display.
  6352.  
  6353. The filter channel of the rainbow's color map is used in the same
  6354. way as with fogs. It determines how much of the light passing
  6355. through the rainbow is filtered by the color.
  6356.  
  6357. The following example shows a simple scene with a ground plane,
  6358. three spheres and a somewhat exaggerated rainbow (rainbow1.pov).
  6359.  
  6360.   #include "colors.inc"
  6361.   camera {
  6362.     location <0, 20, -100>
  6363.     look_at <0, 25, 0>
  6364.     angle 80
  6365.   }
  6366.   background { color SkyBlue }
  6367.   plane { y, -10 pigment { color Green } }
  6368.   light_source {<100, 120, 40> color White}
  6369.   // declare rainbow's colors
  6370.   #declare r_violet1 = color rgbf<1.0, 0.5, 1.0, 1.0>;
  6371.   #declare r_violet2 = color rgbf<1.0, 0.5, 1.0, 0.8>;
  6372.   #declare r_indigo  = color rgbf<0.5, 0.5, 1.0, 0.8>;
  6373.   #declare r_blue    = color rgbf<0.2, 0.2, 1.0, 0.8>;
  6374.   #declare r_cyan    = color rgbf<0.2, 1.0, 1.0, 0.8>;
  6375.   #declare r_green   = color rgbf<0.2, 1.0, 0.2, 0.8>;
  6376.   #declare r_yellow  = color rgbf<1.0, 1.0, 0.2, 0.8>;
  6377.   #declare r_orange  = color rgbf<1.0, 0.5, 0.2, 0.8>;
  6378.   #declare r_red1    = color rgbf<1.0, 0.2, 0.2, 0.8>;
  6379.   #declare r_red2    = color rgbf<1.0, 0.2, 0.2, 1.0>;
  6380.   // create the rainbow
  6381.   rainbow {
  6382.     angle 42.5
  6383.     width 5
  6384.     distance 1.0e7
  6385.     direction <-0.2, -0.2, 1>
  6386.     jitter 0.01
  6387.     color_map {
  6388.       [0.000  color r_violet1]
  6389.       [0.100  color r_violet2]
  6390.       [0.214  color r_indigo]
  6391.       [0.328  color r_blue]
  6392.       [0.442  color r_cyan]
  6393.       [0.556  color r_green]
  6394.       [0.670  color r_yellow]
  6395.       [0.784  color r_orange]
  6396.       [0.900  color r_red1]
  6397.     }
  6398.   }
  6399. Some irregularity is added to the color bands using the jitter
  6400. keyword.
  6401.  
  6402.                                 
  6403.                                 
  6404.                        A colorful rainbow.
  6405.                                 
  6406. The rainbow in our sample is much too bright. You'll never see a
  6407. rainbow like this in reality. You can decrease the rainbow's
  6408. colors by decreasing the RGB values in the color map.
  6409.  
  6410.  
  6411. 2.9.4.2   Increasing the Rainbow's Translucency
  6412. The result we have so far looks much too bright. Just reducing
  6413. the rainbow's color helps but it's much better to increase the
  6414. translucency of the rainbow because it is more realistic if the
  6415. background is visible through the rainbow.
  6416.  
  6417. We can use the transmittance channel of the colors in the color
  6418. map to specify a minimum translucency, just like we did with the
  6419. fog. To get realistic results we have to use very large
  6420. transmittance values as you can see in the following example
  6421. (rainbow2.pov).
  6422.  
  6423.   rainbow {
  6424.     angle 42.5
  6425.     width 5
  6426.     distance 1.0e7
  6427.     direction <-0.2, -0.2, 1>
  6428.     jitter 0.01
  6429.     color_map {
  6430.       [0.000  color r_violet1 transmit 0.98]
  6431.       [0.100  color r_violet2 transmit 0.96]
  6432.       [0.214  color r_indigo  transmit 0.94]
  6433.       [0.328  color r_blue    transmit 0.92]
  6434.       [0.442  color r_cyan    transmit 0.90]
  6435.       [0.556  color r_green   transmit 0.92]
  6436.       [0.670  color r_yellow  transmit 0.94]
  6437.       [0.784  color r_orange  transmit 0.96]
  6438.       [0.900  color r_red1    transmit 0.98]
  6439.     }
  6440.   }
  6441. The transmittance values increase at the outer bands of the
  6442. rainbow to make it softly blend into the background.
  6443.  
  6444.                                 
  6445.                                 
  6446.                  A much more realistic rainbow.
  6447.                                 
  6448. The resulting image looks much more realistic than our first
  6449. rainbow.
  6450.  
  6451.  
  6452. 2.9.4.3   Using a Rainbow Arc
  6453. Currently our rainbow has a circular shape, even though most of
  6454. it is hidden below the ground plane. You can easily create a
  6455. rainbow arc by using the arc_angle keyword with an angle below
  6456. 360 degrees.
  6457.  
  6458. If you use arc_angle 120 for example you'll get a rainbow arc
  6459. that abruptly vanishes at the arc's ends. This does not look
  6460. good. To avoid this the falloff_angle keyword can be used to
  6461. specify a region where the arc smoothly blends into the
  6462. background.
  6463.  
  6464. As explained in the rainbow's reference section (see "Rainbow")
  6465. the arc extends from -arc_angle/2 to arc_angle/2 while the
  6466. blending takes place from -arc_angle/2 to -falloff_angle/2 and
  6467. falloff_angle/2 to arc_angle/2. This is the reason why the
  6468. falloff_angle has to be smaller or equal to the arc_angle.
  6469.  
  6470. In the following examples we use an 120 degrees arc with a 45
  6471. degree falloff region on both sides of the arc (rainbow3.pov).
  6472.  
  6473.   rainbow {
  6474.     angle 42.5
  6475.     width 5
  6476.     arc_angle 120
  6477.     falloff_angle 30
  6478.     distance 1.0e7
  6479.     direction <-0.2, -0.2, 1>
  6480.     jitter 0.01
  6481.     color_map {
  6482.       [0.000  color r_violet1 transmit 0.98]
  6483.       [0.100  color r_violet2 transmit 0.96]
  6484.       [0.214  color r_indigo  transmit 0.94]
  6485.       [0.328  color r_blue    transmit 0.92]
  6486.       [0.442  color r_cyan    transmit 0.90]
  6487.       [0.556  color r_green   transmit 0.92]
  6488.       [0.670  color r_yellow  transmit 0.94]
  6489.       [0.784  color r_orange  transmit 0.96]
  6490.       [0.900  color r_red1    transmit 0.98]
  6491.     }
  6492.   }
  6493. The arc angles are measured against the rainbows up direction
  6494. which can be specified using the up keyword. By default the up
  6495. direction is the y-axis.
  6496.  
  6497.                                 
  6498.                                 
  6499.                          A rainbow arc.
  6500.                                 
  6501. We finally have a realistic looking rainbow arc.
  6502.  
  6503.  
  6504. 2.9.5     Animation
  6505. There are a number of programs available that will take a series
  6506. of still image files (such as POV-Ray outputs) and assemble them
  6507. into animations.  Such programs can produce AVI, MPEG, FLI/FLC,
  6508. QuickTime, or even animated GIF files (for use on the World Wide
  6509. Web). The trick, therefore, is how to produce the frames. That,
  6510. of course, is where POV-Ray comes in. In earlier versions
  6511. producing an animation series was no joy, as everything had to be
  6512. done manually. We had to set the clock variable, and handle
  6513. producing unique file names for each individual frame by hand. We
  6514. could achieve some degree of automation by using batch files or
  6515. similar scripting devices, but still, We had to set it all up by
  6516. hand, and that was a lot of work (not to mention frustration...
  6517. imagine forgetting to set the individual file names and coming
  6518. back 24 hours later to find each frame had overwritten the last).
  6519.  
  6520. Now, at last, with POV-Ray 3, there is a better way. We no longer
  6521. need a separate batch script or external sequencing programs,
  6522. because a few simple settings in our INI file (or on the command
  6523. line) will activate an internal animation sequence which will
  6524. cause POV-Ray to automatically handle the animation loop details
  6525. for us.
  6526.  
  6527. Actually, there are two halves to animation support: those
  6528. settings we put in the INI file (or on the command line), and
  6529. those code modifications we work into our scene description file.
  6530. If we've already worked with animation in previous versions of
  6531. POV-Ray, we can probably skip ahead to the section "INI File
  6532. Settings" below. Otherwise, let's start with basics. Before we
  6533. get to how to activate the internal animation loop, let's look at
  6534. a couple examples of how a couple of keywords can set up our code
  6535. to describe the motions of objects over time.
  6536.  
  6537.  
  6538. 2.9.5.1   The Clock Variable: Key To It All
  6539. POV-Ray supports an automatically declared floating point
  6540. variable identified as clock (all lower case). This is the key to
  6541. making image files that can be automated. In command line
  6542. operations, the clock variable is set using the +k switch. For
  6543. example, +k3.4 from the command line would set the value of clock
  6544. to 3.4. The same could be accomplished from the INI file using
  6545. Clock=3.4 in an INI file.
  6546.  
  6547. If we don't set clock for anything, and the animation loop is not
  6548. used (as will be described a little later) the clock variable is
  6549. still there - it's just set for the default value of 0.0, so it
  6550. is possible to set up some POV code for the purpose of animation,
  6551. and still render it as a still picture during the object/world
  6552. creation stage of our project.
  6553.  
  6554. The simplest example of using this to our advantage would be
  6555. having an object which is travelling at a constant rate, say,
  6556. along the x-axis. We would have the statement
  6557.  
  6558.   translate <clock, 0, 0>
  6559. in our object's declaration, and then have the animation loop
  6560. assign progressively higher values to clock. And that's fine, as
  6561. long as only one element or aspect of our scene is changing, but
  6562. what happens when we want to control multiple changes in the same
  6563. scene simultaneously?
  6564.  
  6565. The secret here is to use normalized clock values, and then make
  6566. other variables in your scene proportional to clock. That is,
  6567. when we set up our clock, (we're getting to that, patience!) have
  6568. it run from 0.0 to 1.0, and then use that as a multiplier to some
  6569. other values. That way, the other values can be whatever we need
  6570. them to be, and clock can be the same 0 to 1 value for every
  6571. application. Let's look at a (relatively) simple example
  6572.  
  6573.   #include "colors.inc"
  6574.   camera {
  6575.     location <0, 3, -6>
  6576.     look_at <0, 0, 0>
  6577.   }
  6578.   light_source { <20, 20, -20> color White }
  6579.   plane { y, 0
  6580.     pigment { checker color White color Black }
  6581.   }
  6582.   sphere { <0, 0, 0> , 1
  6583.     pigment {
  6584.       gradient x
  6585.       color_map {
  6586.         [0.0 Blue  ]
  6587.         [0.5 Blue  ]
  6588.         [0.5 White ]
  6589.         [1.0 White ]
  6590.       }
  6591.       scale .25
  6592.     }
  6593.     rotate <0, 0, -clock*360>
  6594.     translate <-pi, 1, 0>
  6595.     translate <2*pi*clock, 0, 0>
  6596.   }
  6597. Assuming that a series of frames is run with the clock
  6598. progressively going from 0.0 to 1.0, the above code will produce
  6599. a striped ball which rolls from left to right across the screen.
  6600. We have two goals here:
  6601.  
  6602.  
  6603. 2.  Translate the ball from point A to point B, and,
  6604. 2.  Rotate the ball in exactly the right proportion to its linear
  6605.   movement to imply that it is rolling -- not gliding -- to its
  6606.   final position.
  6607. Taking the second goal first, we start with the sphere at the
  6608. origin, because anywhere else and rotation will cause it to orbit
  6609. the origin instead of rotating. Throughout the course of the
  6610. animation, the ball will turn one complete 360 degree turn.
  6611. Therefore, we used the formula, 360*clock to determine the
  6612. rotation in each frame. Since clock runs 0 to 1, the rotation of
  6613. the sphere runs from 0 degrees through 360.
  6614.  
  6615. Then we used the first translation to put the sphere at its
  6616. initial starting point. Remember, we couldn't have just declared
  6617. it there, or it would have orbited the origin, so before we can
  6618. meet our other goal (translation), we have to compensate by
  6619. putting the sphere back where it would have been at the start.
  6620. After that, we re-translate the sphere by a clock relative
  6621. distance, causing it to move relative to the starting point.
  6622. We've chosen the formula of 2*pi* r*clock (the widest
  6623. circumference of the sphere times current clock value) so that it
  6624. will appear to move a distance equal to the circumference of the
  6625. sphere in the same time that it rotates a complete 360 degrees.
  6626. In this way, we've synchronized the rotation of the sphere to its
  6627. translation, making it appear to be smoothly rolling along the
  6628. plane.
  6629.  
  6630. Besides allowing us to coordinate multiple aspects of change over
  6631. time more cleanly, mathematically speaking, the other good reason
  6632. for using normalized clock values is that it will not matter
  6633. whether we are doing a ten frame animated GIF, or a three hundred
  6634. frame AVI. Values of the clock are proportioned to the number of
  6635. frames, so that same POV code will work without regard to how
  6636. long the frame sequence is. Our rolling ball will still travel
  6637. the exact same amount no matter how many frames our animation
  6638. ends up with.
  6639.  
  6640.  
  6641. 2.9.5.2   Clock Dependant Variables And Multi-Stage Animations
  6642. Okay, what if we wanted the ball to roll left to right for the
  6643. first half of the animation, then change direction 135 degrees
  6644. and roll right to left, and toward the back of the scene. We
  6645. would need to make use of POV-Ray's new conditional rendering
  6646. directives, and test the clock value to determine when we reach
  6647. the halfway point, then start rendering a different clock
  6648. dependant sequence. But our goal, as above, it to be working in
  6649. each stage with a variable in the range of 0 to 1 (normalized)
  6650. because this makes the math so much cleaner to work with when we
  6651. have to control multiple aspects during animation. So let's
  6652. assume we keep the same camera, light, and plane, and let the
  6653. clock run from 0 to 2! Now, replace the single sphere declaration
  6654. with the following...
  6655.  
  6656.   #if ( clock <= 1 )
  6657.     sphere { <0, 0, 0> , 1
  6658.       pigment {
  6659.         gradient x
  6660.         color_map {
  6661.           [0.0 Blue  ]
  6662.           [0.5 Blue  ]
  6663.           [0.5 White ]
  6664.           [1.0 White ]
  6665.         }
  6666.         scale .25
  6667.       }
  6668.       rotate <0, 0, -clock*360>
  6669.       translate <-pi, 1, 0>
  6670.       translate <2*pi*clock, 0, 0>
  6671.     }
  6672.   #else
  6673.     // (if clock is > 1, we're on the second phase)
  6674.     // we still want to work with  a value from 0 - 1
  6675.     #declare ElseClock = clock - 1;
  6676.     sphere { <0, 0, 0> , 1
  6677.       pigment {
  6678.         gradient x
  6679.         color_map {
  6680.           [0.0 Blue  ]
  6681.           [0.5 Blue  ]
  6682.           [0.5 White ]
  6683.           [1.0 White ]
  6684.         }
  6685.         scale .25
  6686.       }
  6687.       rotate <0, 0, ElseClock*360>
  6688.       translate <-2*pi*ElseClock, 0, 0>
  6689.       rotate <0, 45, 0>
  6690.       translate <pi, 1, 0>
  6691.     }
  6692.   #end
  6693. If we spotted the fact that this will cause the ball to do an
  6694. unrealistic snap turn when changing direction, bonus points for
  6695. us - we're a born animator. However, for the simplicity of the
  6696. example, let's ignore that for now. It will be easy enough to fix
  6697. in the real world, once we examine how the existing code works.
  6698.  
  6699. All we did differently was assume that the clock would run 0 to
  6700. 2, and that we wanted to be working with a normalized value
  6701. instead. So when the clock goes over 1.0, POV assumes the second
  6702. phase of the journey has begun, and we declare a new variable
  6703. Elseclock which we make relative to the original built in clock,
  6704. in such a way that while clock is going 1 to 2, Elseclock is
  6705. going 0 to 1. So, even though there is only one clock, there can
  6706. be as many additional variables as we care to declare (and have
  6707. memory for), so even in fairly complex scenes, the single clock
  6708. variable can be made the common coordinating factor which
  6709. orchestrates all other motions.
  6710.  
  6711.  
  6712. 2.9.5.3   The Phase Keyword
  6713. There is another keyword we should know for purposes of
  6714. animations: the phase keyword. The phase keyword can be used on
  6715. many texture elements, especially those that can take a color,
  6716. pigment, normal or texture map.  Remember the form that these
  6717. maps take. For example:
  6718.  
  6719.   color_map {
  6720.     [0.00 White ]
  6721.     [0.25 Blue ]
  6722.     [0.76 Green ]
  6723.     [1.00 Red ]
  6724.   }
  6725. The floating point value to the left inside each set of brackets
  6726. helps POV-Ray to map the color values to various areas of the
  6727. object being textured.  Notice that the map runs cleanly from 0.0
  6728. to 1.0?
  6729.  
  6730. Phase causes the color values to become shifted along the map by
  6731. a floating point value which follows the keyword phase. Now, if
  6732. we are using a normalized clock value already anyhow, we can make
  6733. the variable clock the floating point value associated with
  6734. phase, and the pattern will smoothly shift over the course of the
  6735. animation. Let's look at a common example using a gradient normal
  6736. pattern
  6737.  
  6738.   #include "colors.inc"
  6739.   #include "textures.inc"
  6740.   #background { rgb<0.8, 0.8, 0.8> }
  6741.   camera {
  6742.     location <1.5, 1, -30>
  6743.     look_at <0, 1, 0>
  6744.     angle 10
  6745.   }
  6746.   light_source { <-100, 20, -100> color White }
  6747.   // flag
  6748.   polygon { 5, <0, 0>, <0, 1>, <1, 1>, <1, 0>, <0, 0>
  6749.     pigment { Blue }
  6750.     normal {
  6751.       gradient x
  6752.       phase clock
  6753.       scale <0.2, 1, 1>
  6754.       sine_wave
  6755.     }
  6756.     scale <3, 2, 1>
  6757.     translate <-1.5, 0, 0>
  6758.   }
  6759.   // flagpole
  6760.   cylinder { <-1.5, -4, 0>, <-1.5, 2.25, 0>, 0.05
  6761.     texture { Silver_Metal }
  6762.   }
  6763.   // polecap
  6764.   sphere { <-1.5, 2.25, 0>, 0.1
  6765.     texture { Silver_Metal }
  6766.   }
  6767. Now, here we've created a simple blue flag with a gradient normal
  6768. pattern on it. We've forced the gradient to use a sine-wave type
  6769. wave so that it looks like the flag is rolling back and forth as
  6770. though flapping in a breeze. But the real magic here is that
  6771. phase keyword. It's been set to take the clock variable as a
  6772. floating point value which, as the clock increments slowly toward
  6773. 2.0, will cause the crests and troughs of the flag's wave to
  6774. shift along the x-axis.  Effectively, when we animate the frames
  6775. created by this code, it will look like the flag is actually
  6776. rippling in the wind.
  6777.  
  6778. This is only one, simple example of how a clock dependant phase
  6779. shift can create interesting animation effects. Trying phase will
  6780. all sorts of texture patterns, and it is amazing the range of
  6781. animation effects we can create simply by phase alone, without
  6782. ever actually moving the object.
  6783.  
  6784.  
  6785. 2.9.5.4   Do Not Use Jitter Or Crand
  6786.  One last piece of basic information to save frustration. Because
  6787. jitter is an element of anti-aliasing, we could just as easily
  6788. have mentioned this under the INI file settings section, but
  6789. there are also forms of anti-aliasing used in area lights, and
  6790. the new atmospheric effects of POV-Ray, so now is as good a time
  6791. as any.
  6792.  
  6793. Jitter is a very small amount of random ray perturbation designed
  6794. to diffuse tiny aliasing errors that might not otherwise totally
  6795. disappear, even with intense anti-aliasing. By randomizing the
  6796. placement of erroneous pixels, the error becomes less noticeable
  6797. to the human eye, because the eye and mind are naturally inclined
  6798. to look for regular patterns rather than random distortions.
  6799.  
  6800. This concept, which works fantastically for still pictures, can
  6801. become a nightmare in animations. Because it is random in nature,
  6802. it will be different for each frame we render, and this becomes
  6803. even more severe if we dither the final results down to, say 256
  6804. color animations (such as FLC's). The result is jumping pixels
  6805. all over the scene, but especially concentrated any place where
  6806. aliasing would normally be a problem (e.g., where an infinite
  6807. plane disappears into the distance).
  6808.  
  6809. For this reason, we should always set jitter to off in area
  6810. lights and anti-aliasing options when preparing a scene for an
  6811. animation. The (relatively) small extra measure quality due to
  6812. the use of jitter will be offset by the ocean of jumpies that
  6813. results. This general rule also applies to any truly random
  6814. texture elements, such as crand.
  6815.  
  6816.  
  6817. 2.9.5.5   INI File Settings
  6818. Okay, so we have a grasp of how to code our file for animation.
  6819. We know about the clock variable, user declared clock-relative
  6820. variables, and the phase keyword. We know not to jitter or crand
  6821. when we render a scene, and we're all set build some animations.
  6822. Alright, let's have at it.
  6823.  
  6824. The first concept we'll need to know is the INI file settings,
  6825. Initial_Frame and Final_Frame. These are very handy settings that
  6826. will allow us to render a particular number of frames and each
  6827. with its own unique frame number, in a completely hands free way.
  6828. It is of course, so blindingly simple that it barely needs
  6829. explanation, but here's an example anyway. We just add the
  6830. following lines to our favorite INI file settings
  6831.  
  6832.   Initial_Frame = 1
  6833.   Final_Frame = 20
  6834. and we'll initiate an automated loop that will generate 20 unique
  6835. frames.  The settings themselves will automatically append a
  6836. frame number onto the end of whatever we have set the output file
  6837. name for, thus giving each frame an unique file number without
  6838. having to think about it. Secondly, by default, it will cycle the
  6839. clock variable up from 0 to 1 in increments proportional to the
  6840. number of frames. This is very convenient, since, no matter
  6841. whether we are making a five frame animated GIF or a 300 frame
  6842. MPEG sequence, we will have a clock value which smoothly cycles
  6843. from exactly the same start to exactly the same finish.
  6844.  
  6845. Next, about that clock. In our example with the rolling ball
  6846. code, we saw that sometimes we want the clock to cycle through
  6847. values other than the default of 0.0 to 1.0. Well, when that's
  6848. the case, there are setting for that too.  The format is also
  6849. quite simple. To make the clock run, as in our example, from 0.0
  6850. to 2.0, we would just add to your INI file the lines
  6851.  
  6852.   Initial_Clock = 0.0
  6853.   Final_Clock = 2.0
  6854. Now, suppose we were developing a sequence of 100 frames, and we
  6855. detected a visual glitch somewhere in frames, say 51 to 75. We go
  6856. back over our code and we think we've fixed it. We'd like to
  6857. render just those 25 frames instead of redoing the whole sequence
  6858. from the beginning. What do we change?
  6859.  
  6860. If we said make Initial_Frame = 51, and Final_Frame = 75, we're
  6861. wrong. Even though this would re-render files named with numbers
  6862. 51 through 75, they will not properly fit into our sequence,
  6863. because the clock will begin at its initial value starting with
  6864. frame 51, and cycle to final value ending with frame 75. The only
  6865. time Initial_Frame and Final_Frame should change is if we are
  6866. doing an essentially new sequence that will be appended onto
  6867. existing material.
  6868.  
  6869. If we wanted to look at just 51 through 75 of the original
  6870. animation, we need two new INI settings
  6871.  
  6872.   Subset_Start_Frame = 51
  6873.   Subset_End_Frame = 75
  6874. Added to settings from before, the clock will still cycle through
  6875. its values proportioned from frames 1 to 100, but we will only be
  6876. rendering that part of the sequence from the 51st to the 75th
  6877. frames.
  6878.  
  6879. This should give us a basic idea of how to use animation.
  6880. Although, this introductory tutorial doesn't cover all the
  6881. angles. For example, the last two settings we just saw, subset
  6882. animation, can take fractional values, like 0.5 to 0.75, so that
  6883. the number of actual frames will not change what portion of the
  6884. animation is being rendered. There is also support for efficient
  6885. odd-even field rendering as would be useful for animations
  6886. prepared for display in interlaced playback such as television
  6887. (see the reference section for full details).
  6888.  
  6889. With POV-Ray 3 now fully supporting a complete host of animation
  6890. options, a whole fourth dimension is added to the raytracing
  6891. experience. Whether we are making a FLIC, AVI, MPEG, or simply an
  6892. animated GIF for our web site, animation support takes a lot of
  6893. the tedium out of the process. And don't forget that phase and
  6894. clock can be used to explore the range of numerous texture
  6895. elements, as well as some of the more difficult to master objects
  6896. (hint: the julia fractal for example). So even if we are
  6897. completely content with making still scenes, adding animation to
  6898. our repertoire can greatly enhance our understanding of what POV-
  6899. Ray is capable of. Adventure awaits!
  6900.  
  6901.  
  6902.  
  6903.  
  6904. 3.0    POV-Ray Options
  6905. The reference section describes all command line switches and INI
  6906. file keywords that are used to set the options of POV-Ray. It is
  6907. supposed to be used as a reference for looking up things. It does
  6908. not contain detailed explanations on how scenes are written or
  6909. how POV-Ray is used. It just explains all features, their syntax,
  6910. applications, limits, drawbacks, etc.
  6911.  
  6912. POV-Ray was originally created as a command-line program for
  6913. operating systems without graphical interfaces, dialog boxes and
  6914. pull-down menus. Most versions of POV-Ray still use command-line
  6915. switches to tell it what to do. This documentation assumes you
  6916. are using the command-line version. If you are using Macintosh,
  6917. MS-Windows or other GUI versions, there will be dialog boxes or
  6918. menus which do the same thing. There is system-specific
  6919. documentation for each system describing the specific commands.
  6920.  
  6921.  
  6922. 3.1  Setting POV-Ray Options
  6923. There are two distinct ways of setting POV-Ray options: command
  6924. line switches and INI file keywords. Both are explained in detail
  6925. in the following sections.
  6926.  
  6927.  
  6928. 3.1.1     Command Line Switches
  6929. Command line switches consist of a + (plus) or - (minus) sign,
  6930. followed by one or more alphabetic characters and possibly a
  6931. numeric value. Here is a typical command line with switches.
  6932.  
  6933.   POVRAY +Isimple.pov +V +W80 +H60
  6934. povray is the name of the program and it is followed by several
  6935. switches. Each switch begins with a plus or minus sign. The +I
  6936. switch with the filename tells POV-Ray what scene file it should
  6937. use as input and +V tells the program to output its status to the
  6938. text screen as it's working. The +W and +H switches set the width
  6939. and height of the image in pixels. This image will be 80 pixels
  6940. wide by 60 pixels high.
  6941.  
  6942. In switches which toggle a feature, the plus turns it on and
  6943. minus turns it off. For example +P turns on the pause for
  6944. keypress   when finished option while -P turns it off. Other
  6945. switches are used to specify values and do not toggle a feature.
  6946. Either plus or minus may be used in that instance. For example
  6947. +W320 sets the width to 320 pixels. You could also use -W320 and
  6948. get the same results.
  6949.  
  6950. Switches may be specified in upper or lower case. They are read
  6951. left to right but in general may be specified in any order. If
  6952. you specify a switch more than once, the previous value is
  6953. generally overwritten with the last specification. The only
  6954. exception is the +L switch for setting library paths. Up to ten
  6955. unique paths may be specified.
  6956.  
  6957. Almost all + or - switches have an equivalent option which can be
  6958. used in an INI file which is described in the next section. A
  6959. detailed description of each switch is given in the option
  6960. reference section.
  6961.  
  6962.  
  6963. 3.1.2     Using INI Files
  6964. Because it is difficult to set more than a few options on a
  6965. command line, you have the ability to put multiple options in one
  6966. or more text files. These initialization files or INI files have
  6967. .ini as their default extension. Previous versions of POV-Ray
  6968. called them default files or DEF files. You may still use
  6969. existing DEF files with this version of POV-Ray.
  6970.  
  6971. The majority of options you use will be stored in INI files. The
  6972. command line switches are recommended for options which you will
  6973. turn off or on frequently as you perform test renderings of a
  6974. scene you are developing. The file povray.ini is automatically
  6975. read if present.  You may specify additional INI files on the
  6976. command-line by simply typing the file name on the command line.
  6977. For example:
  6978.  
  6979.   POVRAY MYOPTS.INI
  6980. If no extension is given, then .ini is assumed. POV-Ray knows
  6981. this is not a switch because it is not preceded by a plus or
  6982. minus. In fact a common error among new users is that they forget
  6983. to put the +I switch before the input file name. Without the
  6984. switch, POV-Ray thinks that the scene file simple.pov is an INI
  6985. file. Don't forget! If no plus or minus precedes a command line
  6986. switch, it is assumed to be an INI file name.
  6987.  
  6988. You may have multiple INI files on the command line along with
  6989. switches. For example:
  6990.  
  6991.   POVRAY MYOPTS +V OTHER
  6992. This reads options from myopts.ini, then sets the +V switch, then
  6993. reads options from other.ini.
  6994.  
  6995. An INI file is a plain ASCII text file with options of the
  6996. form...
  6997.  
  6998.   Option_keyword=VALUE ; Text after semicolon is a comment
  6999. For example the INI equivalent of the switch +Isimple.pov is...
  7000.  
  7001.   Input_File_Name=simple.pov
  7002. Options are read top to bottom in the file but in general may be
  7003. specified in any order. If you specify an option more than once,
  7004. the previous values are generally overwritten with the last
  7005. specification. The only exception is the Library_Path=path
  7006. options. Up to ten unique paths may be specified.
  7007.  
  7008. Almost all INI-style options have equivalent + or - switches. The
  7009. option reference section gives a detailed description of all POV-
  7010. Ray options. It includes both the INI-style settings and the +/-
  7011. switches.
  7012.  
  7013. The INI keywords are not case sensitive. Only one INI option is
  7014. permitted per line of text. You may also include switches in your
  7015. INI file if they are easier for you. You may have multiple
  7016. switches per line but you should not mix switches and INI options
  7017. on the same line. You may nest INI files by simply putting the
  7018. file name on a line by itself with no equals sign after it.
  7019. Nesting may occur up to ten levels deep.
  7020.  
  7021. For example:
  7022.  
  7023.   ; This is a sample INI file. This entire line is a comment.
  7024.   ; Blank lines are permitted.
  7025.   Input_File_Name=simple.pov ;This sets the input file name
  7026.   +W80 +H60 ; Traditional +/- switches are permitted too
  7027.   MOREOPT   ; Read MOREOPT.INI and continue with next line
  7028.   +V        ; Another switch
  7029.   ; That's all folks!
  7030. INI files may have labeled sections so that more than one set of
  7031. options may be stored in a single file. Each section begins with
  7032. a label in [] brackets. For example:
  7033.  
  7034.   ; RES.INI
  7035.   ; This sample INI file is used to set resolution.
  7036.   +W120 +H100  ; This section has no label.
  7037.                ; Select it with "RES"
  7038.   [Low]
  7039.   +W80 +H60    ; This section has a label.
  7040.                ; Select it with "RES[Low]"
  7041.   [Med]
  7042.   +W320 +H200  ; This section has a label.
  7043.                ; Select it with "RES[Med]"
  7044.   [High]
  7045.   +W640 +H480  ; Labels are not case sensitive.
  7046.                ; "RES[high]" works
  7047.   [Really High]
  7048.   +W800 +H600  ; Labels may contain blanks
  7049. When you specify the INI file you should follow it with the
  7050. section label in brackets. For example...
  7051.  
  7052.   POVRAY RES[Med] +Imyfile.pov
  7053. POV-Ray reads res.ini and skips all options until it finds the
  7054. label Med. It processes options after that label until it finds
  7055. another label and then it skips. If no label is specified on the
  7056. command line then only the unlabeled area at the top of the file
  7057. is read. If a label is specified, the unlabeled area is ignored.
  7058.  
  7059. Because a blank space is considered a delimiter for command-line
  7060. switches, POV-Ray has a difficult time reading file names or INI
  7061. labels containing blanks.  The rule is that INI-style options
  7062. allow blanks in INI files but switches do not allow blanks
  7063. whether in INI files or on the command line.  For example:
  7064.  
  7065.  +Imy file.pov               ;doesn't work anywhere
  7066.  Input_File=my file.pov      ;works only in INI file
  7067. To nest INI files which have blanks in the file name or labels
  7068. use the Include_INI option like this:
  7069.  
  7070.   Input_File=my file.pov
  7071.   Include_Ini=my options[this section]
  7072.  
  7073. 3.1.3     Using the POVINI Environment Variable
  7074. The environment variable POVINI is used to specify the location
  7075. and name of a default INI file that is read every time POV-Ray is
  7076. executed. If POVINI is not specified, or if your computer
  7077. platform does not use environment variables, a default INI file
  7078. may be read. If the specified file does not exist, a warning
  7079. message is printed.
  7080.  
  7081. To set the environment variable under MS-DOS you might put the
  7082. following line in your autoexec.bat file...
  7083.  
  7084.   set POVINI=c:\povray3\default.ini
  7085. On most operating systems the sequence of reading options is as
  7086. follows:
  7087.  
  7088.   1.  Read options from default INI file specified by the POVINI
  7089.   environment variable or platform specific INI file.
  7090.   2.  Read switches from command line (this includes reading any
  7091.   specified INI/DEF files).
  7092. The POVRAYOPT environment variable supported by previous POV-Ray
  7093. versions is no longer available.
  7094.  
  7095.  
  7096. 3.2  Options Reference
  7097. As explained in the previous section, options may be specified by
  7098. switches or INI-style options. Almost all INI-style options have
  7099. equivalent  +/ - switches and most switches have equivalent INI-
  7100. style option. The following sections give a detailed description
  7101. of each POV-Ray option. It includes both the INI-style settings
  7102. and the +/ - switches.
  7103.  
  7104. The notation and terminology used is described in the tables
  7105. below.
  7106. Keyword=bool     Turn Keyword on if bool equals true,
  7107.                  yes, on or 1 and    Turn it off if
  7108.                  it is any other value.
  7109. Keyword=true     Do this option if true, yes, on or 1 is
  7110.                specified.
  7111. Keyword=false    Do this option if false, no, off or 0 is
  7112.                specified.
  7113. Keyword=filen  Set Keyword to filename where filename
  7114. ame              is any valid file name. Note: some
  7115.                  options prohibit the use of any of
  7116.                  the above true or false values as a
  7117.                  file name. They are noted in later
  7118.                  sections.
  7119. n              Any integer such as in +W320
  7120. n.n              Any float such as in Clock=3.45
  7121. 0.n              Any float < 1.0 even if it has no leading
  7122.                0
  7123. s                Any string of text
  7124. x or y         Any single character
  7125. path             Any directory name, drive optional, no
  7126.                final path separator ("\" or "/",
  7127.                depending on the operating system)
  7128. Unless otherwise specifically noted, you may assume that either a
  7129. plus or minus sign before a switch will produce the same results.
  7130.  
  7131.  
  7132. 3.2.1     Animation Options
  7133. POV-Ray 3.0 greatly improved its animation capability with the
  7134. addition of an internal animation loop, automatic output file
  7135. name numbering and the ability to shell out to the operating
  7136. system to external utilities which can assemble individual frames
  7137. into an animation. The internal animation loop is simple yet
  7138. flexible. You may still use external programs or batch files to
  7139. create animations without the internal loop as you may have done
  7140. in POV-Ray 2.
  7141.  
  7142.  
  7143. 3.2.1.1   External Animation Loop
  7144. Clock=n.n      Sets clock float identifier
  7145.                to n.n
  7146. +Kn.n          Same as Clock=n.n
  7147. The Clock=n.n option or the +Kn.n switch may be used to pass a
  7148. single float value to the program for basic animation. The value
  7149. is stored in the float identifier clock.  If an object had a
  7150. rotate <0,clock,0> attached then you could rotate the object by
  7151. different amounts over different frames by setting
  7152. +K10.0,+K20.0... etc. on successive renderings. It is up to the
  7153. user to repeatedly invoke POV-Ray with a different Clock value
  7154. and a different Output_File_Name for each frame.
  7155.  
  7156.  
  7157. 3.2.1.2   Internal Animation Loop
  7158. Initial_Frame  Sets initial frame number to
  7159. =n             n
  7160. Final_Frame=n  Sets final frame number to n
  7161. Initial_Clock  Sets initial clock value to
  7162. =n.n           n.n
  7163. Final_Clock=n  Sets final clock value to
  7164. .n             n.n
  7165. +KFIn          Same as Initial_Frame=n
  7166. +KFFn          Same as Final_Frame=n
  7167. +KIn.n         Same as Initial_Clock=n.n
  7168. +KFn.n         Same as Final_Clock=n.n
  7169. The internal animation loop new to POV-Ray 3.0 relieves the user
  7170. of the task of generating complicated sets of batch files to
  7171. invoke POV-Ray multiple times with different settings. While the
  7172. multitude of options may look intimidating, the clever set of
  7173. default values means that you will probably only need to specify
  7174. the Final_Frame=n or the +KFFn option to specify the number of
  7175. frames. All other values may remain at their defaults.
  7176.  
  7177. Any Final_Frame setting other than -1 will trigger POV-Ray's
  7178. internal animation loop. For example Final_Frame=10 or +KFF10
  7179. causes POV-Ray to render your scene 10 times. If you specified
  7180. Output_File_Name=file.tga then each frame would be output as
  7181. file01.tga, file02.tga, file03.tga etc. The number of zero-padded
  7182. digits in the file name depends upon the final frame number. For
  7183. example +KFF100 would generate file001.tga through file100.tga.
  7184. The frame number may encroach upon the file name. On MS-DOS with
  7185. an eight character limit, myscene.pov would render to
  7186. mysce001.tga through mysce100.tga.
  7187.  
  7188. The default Initial_Frame=1 will probably never have to be
  7189. changed. You would only change it if you were assembling a long
  7190. animation sequence in pieces. One scene might run from frame 1 to
  7191. 50 and the next from 51 to 100. The Initial_Frame=n or +KFIn
  7192. option is for this purpose.
  7193.  
  7194. Note that if you wish to render a subset of frames such as 30
  7195. through 40 out of a 1 to 100 animation, you should not change
  7196. Frame_Initial or Frame_Final. Instead you should use the subset
  7197. commands described in section "Subsets of Animation Frames".
  7198.  
  7199. Unlike some animation packages, the action in POV-Ray animated
  7200. scenes does not depend upon the integer frame numbers. Rather you
  7201. should design your scenes based upon the float identifier clock.
  7202. By default, the clock value is 0.0 for the initial frame and 1.0
  7203. for the final frame. All other frames are interpolated between
  7204. these values. For example if your object is supposed to rotate
  7205. one full turn over the course of the animation, you could specify
  7206. rotate 360*clock*y. Then as clock runs from 0.0 to 1.0, the
  7207. object rotates about the y-axis from 0 to 360 degrees.
  7208.  
  7209. The major advantage of this system is that you can render a 10
  7210. frame animation or a 100 frame or 500 frame or 329 frame
  7211. animation yet you still get one full 360 degree rotation. Test
  7212. renders of a few frames work exactly like final renders of many
  7213. frames.
  7214.  
  7215. In effect you define the motion over a continuous float valued
  7216. parameter (the clock) and you take discrete samples at some fixed
  7217. intervals (the frames). If you take a movie or video tape of a
  7218. real scene it works the same way. An object's actual motion
  7219. depends only on time.  It does not depend on the frame rate of
  7220. your camera.
  7221.  
  7222. Many users have already created scenes for POV-Ray 2 that expect
  7223. clock values over a range other than the default 0.0 to 1.0. For
  7224. this reason we provide the Initial_Clock=n.n or +KIn.n and
  7225. Final_Clock=n.n or +KFn.n options. For example to run the clock
  7226. from 25.0 to 75.0 you would specify Initial_Clock=25.0 and
  7227. Final_Clock=75.0. Then the clock would be set to 25.0 for the
  7228. initial frame and 75.0 for the final frame. In-between frames
  7229. would have clock values interpolated from 25.0 through 75.0
  7230. proportionally.
  7231.  
  7232. Users who are accustomed to using frame numbers rather than clock
  7233. values could specify Initial_Clock=1.0 and Final_Clock=10.0 and
  7234. Frame_Final=10 for a 10 frame animation.
  7235.  
  7236. For new scenes, we recommend you do not change the Initial_Clock
  7237. or Final_Clock from their default 0.0 to 1.0 values. If you want
  7238. the clock to vary over a different range than the default 0.0 to
  7239. 3.0, we recommend you handle this inside your scene file as
  7240. follows...
  7241.  
  7242.   #declare Start    = 25.0;
  7243.   #declare End      = 75.0;
  7244.   #declare My_Clock = Start+(End-Start)*clock;
  7245. Then use My_Clock in the scene description. This keeps the
  7246. critical values 25.0 and 75.0 in your .pov file.
  7247.  
  7248. Note that more details concerning the inner workings of the
  7249. animation loop are in the section on shell-out operating system
  7250. commands in section "Shell-out to Operating System".
  7251.  
  7252.  
  7253. 3.2.1.3   Subsets of Animation Frames
  7254.  
  7255. Subset_Start_Frame  Set subset starting frame to
  7256. =n                  n
  7257. Subset_Start_Frame  Set subset starting frame to
  7258. =0.n                n percent
  7259. Subset_End_Frame=n  Set subset ending frame to n
  7260. Subset_End_Frame=0  Set subset ending frame to n
  7261. .n                  percent
  7262. +SFn or +SF0.n      Same as Subset_Start_Frame
  7263. +EFn or +EF0.n      Same as Subset_End_Frame
  7264. When creating a long animation, it may be handy to render only a
  7265. portion of the animation to see what it looks like. Suppose you
  7266. have 100 frames but only want to render frames 30 through 40. If
  7267. you set Initial_Frame=30 and Final_Frame=40 then the clock would
  7268. vary from 0.0 to 1.0 from frames 30 through 40 rather than 0.30
  7269. through 0.40 as it should. Therefore you should leave
  7270. Initial_Frame=1 and Final_Frame=100 and use Subset_Start_Frame=30
  7271. and Subset_End_Frame=40 to selectively render part of the scene.
  7272. POV-Ray will then properly compute the clock values.
  7273.  
  7274. Usually you will specify the subset using the actual integer
  7275. frame numbers however an alternate form of the subset commands
  7276. takes a float value in the range 0.0 <=n.nnn <=1.0 which is
  7277. interpreted as a fraction of the whole animation. For example,
  7278. Subset_Start_Frame=0.333 and Subset_End_Frame=0.667 would render
  7279. the middle 1/3rd of a sequence regardless of the number of
  7280. frames.
  7281.  
  7282.  
  7283. 3.2.1.4   Cyclic Animation
  7284. Cyclic_Animation=b       Turn cyclic animation
  7285. ool                 on/off
  7286. +KC                      Turn cyclic animation
  7287.                     on
  7288. -KC                      Turn cyclic animation
  7289.                     off
  7290. Many computer animation sequences are designed to be run in a
  7291. continuous loop. Suppose you have an object that rotates exactly
  7292. 360 degrees over the course of your animation and you did rotate
  7293. 360*clock*y to do so. Both the first and last frames would be
  7294. identical. Upon playback there would be a brief one frame
  7295. jerkiness. To eliminate this problem you need to adjust the clock
  7296. so that the last frame does not match the first. For example a
  7297. ten frame cyclic animation should not use clock 0.0 to 1.0. It
  7298. should run from 0.0 to 0.9 in 0.1 increments. However if you
  7299. change to 20 frames it should run from 0.0 to 0.95 in 0.05
  7300. increments. This complicates things because you would have to
  7301. change the final clock value every time you changed Final_Frame.
  7302. Setting Cyclic_Animation=on or using +KC will cause POV-Ray to
  7303. automatically adjust the final clock value for cyclic animation
  7304. regardless of how many total frames. The default value for this
  7305. setting is off.
  7306.  
  7307.  
  7308. 3.2.1.5   Field Rendering
  7309. Field_Render=boo Turn field rendering on/off
  7310. l
  7311. Odd_Field=bool   Set odd field flag
  7312. +UF              Turn field rendering on
  7313. -UF              Turn field rendering off
  7314. +UO              Set odd field flag on
  7315. -UO              Set odd field flag off
  7316. Field rendering is sometimes used for animations when the
  7317. animation is being output for television. TVs only display
  7318. alternate scan lines on each vertical refresh. When each frame is
  7319. being displayed the fields are interlaced to give the impression
  7320. of a higher resolution image. The even scan lines make up the
  7321. even field, and are drawn first (i.e. scan lines 0, 2, 4, etc.),
  7322. followed by the odd field, made up of the odd numbered scan lines
  7323. are drawn afterwards. If objects in an animation are moving
  7324. quickly, their position can change noticeably from one field to
  7325. the next. As a result, it may be desirable in these cases to have
  7326. POV-Ray render alternate fields at the actual field rate (which
  7327. is twice the frame rate), rather than rendering full frames at
  7328. the normal frame rate. This would save a great deal of time
  7329. compared to rendering the entire animation at twice the frame
  7330. rate, and then only using half of each frame.
  7331.  
  7332. By default, field rendering is not used. Setting Field_Render=on
  7333. or using +UF will cause alternate frames in an animation to be
  7334. only the even or odd fields of an animation. By default, the
  7335. first frame is the even field, followed by the odd field. You can
  7336. have POV-Ray render the odd field first by specifying
  7337. Odd_Field=on, or by using the +UO switch.
  7338.  
  7339.  
  7340. 3.2.2     Output Options
  7341.  
  7342. 3.2.2.1   General Output Options
  7343.  
  7344. 3.2.2.1.1 Height and Width of Output
  7345. Height=n       Sets screen height to n
  7346.                pixels
  7347. Width=n        Sets screen width to n
  7348.                pixels
  7349. +Hn            Same as Height=n (when n >
  7350.                8)
  7351. +Wn            Same as Width=n
  7352. These switches set the height and width of the image in pixels.
  7353. This specifies the image size for file output. The preview
  7354. display, if on, will generally attempt to pick a video mode to
  7355. accommodate this size but the display settings do not in any way
  7356. affect the resulting file output.
  7357.  
  7358.  
  7359. 3.2.2.1.2 Partial Output Options
  7360.  
  7361. Start_Column=n     Set first column to n pixels
  7362. Start_Column=0.n   Set first column to n
  7363.                  percent of width
  7364. +SCn or +SC0.n     Same as Start_Column
  7365. Start_Row=n        Set first row to n pixels
  7366. Start_Row=0.n      Set first row to n percent
  7367.                  of height
  7368. +SRn or +Sn        Same as Start_Row=n
  7369. +SR0.n or +S0.n    Same as Start_Row=0.n
  7370. End_Column=n       Set last column to n pixels
  7371. End_Column=0.n     Set last column to n percent
  7372.                  of width
  7373. +ECn or +EC0.n     Same as End_Column
  7374. End_Row=n          Set last row to n pixels
  7375. End_Row=0.n        Set last row to n percent of
  7376.                  height
  7377. +ERn or +En        Same as End_Row=n
  7378. +ER0.n or +E0.n    Same as End_Row=0.n
  7379. When doing test rendering it is often convenient to define a
  7380. small, rectangular sub-section of the whole screen so you can
  7381. quickly check out one area of the image. The Start_Row, End_Row,
  7382. Start_Column and End_Column options allow you to define the
  7383. subset area to be rendered. The default values are the full size
  7384. of the image from (1,1) which is the upper left to (w,h) on the
  7385. lower right where w and h are the Width=n and Height=n values you
  7386. have set.
  7387.  
  7388. Note if the number specified is greater than 1 then it is
  7389. interpreted as an absolute row or column number in pixels. If it
  7390. is a decimal value between 0.0 and 1.0 then it is interpreted as
  7391. a percent of the total width or height of the image. For example:
  7392. Start_Row=0.75 and Start_Column=0.75 starts on a row 75% down
  7393. from the top at a column 75% from the left. Thus it renders only
  7394. the lower-right 25% of the image regardless of the specified
  7395. width and height.
  7396.  
  7397. The +SR, +ER, +SC and +EC switches work in the same way as the
  7398. corresponding INI-style settings for both absolute settings or
  7399. percentages. Early versions of POV-Ray allowed only start and end
  7400. rows to be specified with +Sn and +En so they are still supported
  7401. in addition to +SR and +ER.
  7402.  
  7403.  
  7404. 3.2.2.1.3 Interrupting Options
  7405. Test_Abort=bool  Turn test for user abort
  7406.                  on/off
  7407. +X               Turn test abort on
  7408. -X               Turn test abort off
  7409. Test_Abort_Count Set to test for abort every
  7410. =n               n pixels
  7411. +Xn              Set to test for abort every
  7412.                  n pixels on
  7413. -Xn              Set to test for abort off
  7414.                  (in future test every n
  7415.                  pixels)
  7416. On some operating systems once you start a rendering you must let
  7417. it finish. The Test_Abort=on option or +X switch causes POV-Ray
  7418. to test the keyboard for keypress. If you have pressed a key, it
  7419. will generate a controlled user abort. Files will be flushed and
  7420. closed but only data through the last full row of pixels is
  7421. saved. POV-Ray exits with an error code 2 (normally POV-Ray
  7422. returns 0 for a successful run or 1 for a fatal error).
  7423.  
  7424. When this option is on, the keyboard is polled on every line
  7425. while parsing the scene file and on every pixel while rendering.
  7426. Because polling the keyboard can slow down a rendering, the
  7427. Test_Abort_Count=n option or +Xn switch causes the test to be
  7428. performed only every n pixels rendered or scene lines parsed.
  7429.  
  7430.  
  7431. 3.2.2.1.4 Resuming Options
  7432. Continue_Trace=b Sets continued trace on/off
  7433. ool
  7434. +C               Sets continued trace on
  7435. -C               Sets continued trace off
  7436. Create_Ini=file  Generate an INI file to file
  7437. Create_Ini=true  Generate file.ini where file
  7438.                  is scene name.
  7439. Create_Ini=false Turn off generation of
  7440.                  previously set file.ini
  7441. +GIfile          Same as Create_Ini=file
  7442. If you abort a render while it's in progress or if you used the
  7443. End_Row option to end the render prematurely, you can use
  7444. Continue_Trace=on or +C option to continue the render later at
  7445. the point where you left off. This option reads in the previously
  7446. generated output file, displays the partial image rendered so
  7447. far, then proceeds with the ray-tracing. This option cannot be
  7448. used if file output is disabled with Output_to_file=off or -F.
  7449.  
  7450. The Continue_Trace option may not work if the Start_Row option
  7451. has been set to anything but the top of the file, depending on
  7452. the output format being used.
  7453.  
  7454. POV-Ray tries to figure out where to resume an interrupted trace
  7455. by reading any previously generated data in the specified output
  7456. file. All file formats contain the image size, so this will
  7457. override any image size settings specified. Some file formats
  7458. (namely TGA and PNG) also store information about where the file
  7459. started (i. e. +SCn and +SRn options), alpha output +UA, and bit-
  7460. depth +FNn, which will override these settings. It is up to the
  7461. user to make sure that all other options are set the same as the
  7462. original render.
  7463.  
  7464. The Create_Ini option or +GI switch provides an easy way to
  7465. create an INI file with all of the rendering options, so you can
  7466. re-run files with the same options, or ensure you have all the
  7467. same options when resuming. This option creates an INI file with
  7468. every option set at the value used for that rendering. This
  7469. includes default values which you have not specified. For example
  7470. if you run POV-Ray with...
  7471.  
  7472.  POVRAY +Isimple.pov MYOPTS +GIrerun.ini MOREOPTS
  7473. POV-Ray will create a file called rerun.ini with all of the
  7474. options used to generate this scene. The file is not written
  7475. until all options have been processed. This means that in the
  7476. above example, the file will include options from both myopts.ini
  7477. and moreopts.ini despite the fact that the +GI switch is
  7478. specified between them. You may now re-run the scene with...
  7479.  
  7480.  POVRAY RERUN
  7481. or resume an interrupted trace with
  7482.  
  7483.  POVRAY RERUN +C
  7484. If you add other switches with the rerun.ini reference, they will
  7485. be included in future re-runs because the file is re-written
  7486. every time you use it.
  7487.  
  7488. The Create_Ini option is also useful for documenting how a scene
  7489. was rendered. If you render waycool.pov with Create_Ini=on then
  7490. it will create a file waycool.ini that you could distribute along
  7491. with your scene file so other users can exactly re-create your
  7492. image.
  7493.  
  7494.  
  7495. 3.2.2.2   Display Output Options
  7496.  
  7497. 3.2.2.2.1 Display Hardware Settings
  7498. Display=bool     Turns graphic display on/off
  7499. +D               Turns graphic display on
  7500. -D               Turns graphic display off
  7501. Video_Mode=x     Set video mode to x; does
  7502.                  not affect on/off
  7503. +Dx              Set display on; Set mode to
  7504.                  x
  7505. -Dx              Set display off; but for
  7506.                  future use mode x
  7507. Palette=y        Set display palette to y;
  7508.                  does not affect on/off
  7509. +Dxy             Set display on; Set mode x;
  7510.                  Set palette y
  7511. -Dxy             Set display off; use mode x,
  7512.                  palette y in future
  7513. Display_Gamma=n. Sets the display gamma to
  7514. n                n.n
  7515. The Display=on or +D switch will turn on the graphics display of
  7516. the image while it is being rendered. Even on some non-graphics
  7517. systems, POV-Ray may display an 80 by 24 character  "ASCII-Art"
  7518. version of your image. Where available, the display may be full,
  7519. 24-bit true color. Setting Display=off or using the -D switch
  7520. will turn off the graphics display which is the default.
  7521.  
  7522. The Video_Mode=x option sets the display mode or hardware type
  7523. chosen where x is a single digit or letter that is machine
  7524. dependent. Generally Video_Mode=0 means the default or an auto-
  7525. detected setting should be used. When using switches, this
  7526. character immediately follows the switch. For example the +D0
  7527. switch will turn on the graphics display in the default mode.
  7528.  
  7529. The Palette=y option selects the palette to be used. Typically
  7530. the single character parameter y is a digit which selects one of
  7531. several fixed palettes or a letter such G for gray scale, H for
  7532. 15-bit or 16-bit high color or T for 24-bit true color. When
  7533. using switches, this character is the 2nd character after the
  7534. switch. For example the +D0T switch will turn on the graphics
  7535. display in the default mode with a true color palette.
  7536.  
  7537. The Display_Gamma=n.n setting is new with POV-Ray 3.0, and is not
  7538. available as a command-line switch. The Display_Gamma setting
  7539. overcomes the problem of images (whether ray-traced or not)
  7540. having different brightness when being displayed on different
  7541. monitors, different video cards, and under different operating
  7542. systems. Note that the Display_Gamma is a setting based on your
  7543. computer's display hardware, and should be set correctly once and
  7544. not changed. The Display_Gamma INI setting works in conjunction
  7545. with the new assumed_gamma global setting to ensure that POV
  7546. scenes and the images they create look the same on all systems.
  7547. See section "Assumed_Gamma" which describes the assumed_gamma
  7548. global setting and describes gamma more thoroughly.
  7549.  
  7550. While the Display_Gamma can be different for each system, there
  7551. are a few general rules that can be used for setting
  7552. Display_Gamma if you don't know it exactly. If the Display_Gamma
  7553. keyword does not appear in the INI file, POV-Ray assumes that the
  7554. display gamma is 2.2. This is because most PC monitors have a
  7555. gamma value in the range 1.6 to 2.6 (newer models seem to have a
  7556. lower gamma value). Mac has the ability to do gamma correction
  7557. inside the system software (based on a user setting in the gamma
  7558. control panel). If the gamma control panel is turned off, or is
  7559. not available, the default Macintosh system gamma is 1.8. Some
  7560. high-end PC graphics cards can do hardware gamma correction and
  7561. should use the current Display_Gamma setting, usually 1.0. A
  7562. gamma test image is also available to help users to set their
  7563. Display_Gamma accurately.
  7564.  
  7565. For scene files that do not contain an assumed_gamma global
  7566. setting the INI file option Display_Gamma will not have any
  7567. affect on the preview output of POV-Ray or for most output file
  7568. formats. However, the Display_Gamma value is used when creating
  7569. PNG format output files, and also when rendering the POV-Ray
  7570. example files (because they have an assumed_gamma), so it should
  7571. still be correctly set for your system to ensure proper results.
  7572.  
  7573.  
  7574. 3.2.2.2.2 Display Related Settings
  7575. Pause_When_Done=bo  Sets pause when done
  7576. ol                  on/off
  7577. +P                  Sets pause when done on
  7578. -P                  Sets pause when done off
  7579. Verbose=bool        Set verbose messages
  7580.                     on/off
  7581. +V                  Set verbose messages on
  7582. -V                  Set verbose messages off
  7583. Draw_Vistas=bool    Turn draw vistas on/off
  7584. +UD                 Turn draw vistas on
  7585. -UD                 Turn draw vistas off
  7586. On some systems, when the image is complete, the graphics display
  7587. is cleared and POV-Ray switches back into text mode to print the
  7588. final statistics and to exit. Normally when the graphics display
  7589. is on, you want to look at the image awhile before continuing.
  7590. Using Pause_When_Done=on or +P causes POV-Ray to pause in
  7591. graphics mode until you press a key to continue. The default is
  7592. not to pause (-P).
  7593.  
  7594. When the graphics display is not used, it is often desirable to
  7595. monitor progress of the rendering. Using Verbose=on or +V turns
  7596. on verbose reporting of your rendering progress. This reports the
  7597. number of the line currently being rendered, the elapsed time for
  7598. the current frame and other information. On some systems, this
  7599. textual information can conflict with the graphics display. You
  7600. may need to turn this off when the display is on. The default
  7601. setting is off (-V).
  7602.  
  7603. The option Draw_Vistas=on or +UD was originally a debugging help
  7604. for POV-Ray's vista buffer feature but it was such fun we decided
  7605. to keep it. Vista buffering is a spatial sub-division method that
  7606. projects the 2-D extents of bounding boxes onto the viewing
  7607. window. POV-Ray tests the 2-D x, y pixel location against these
  7608. rectangular areas to determine quickly which objects, if any, the
  7609. viewing ray will hit. This option shows you the 2-D rectangles
  7610. used. The default setting is off (-UD) because the drawing of the
  7611. rectangles can take considerable time on complex scenes and it
  7612. serves no critical purpose. See section "Automatic Bounding
  7613. Control" for more details.
  7614.  
  7615.  
  7616. 3.2.2.2.3 Mosaic Preview
  7617. Preview_Start_Size=n  Set mosaic preview start
  7618.                     size to n
  7619. +SPn                Same as Preview_Start_Size=n
  7620. Preview_End_Size=n  Set mosaic preview end size
  7621.                     to n
  7622. +EPn                Same as Preview_End_Size=n
  7623. Typically, while you are developing a scene, you will do many low
  7624. resolution test renders to see if objects are placed properly.
  7625. Often this low resolution version doesn't give you sufficient
  7626. detail and you have to render the scene again at a higher
  7627. resolution. A feature called "mosaic preview" solves this problem
  7628. by automatically rendering your image in several passes.
  7629.  
  7630. The early passes paint a rough overview of the entire image using
  7631. large blocks of pixels that look like mosaic tiles. The image is
  7632. then refined using higher resolutions on subsequent passes. This
  7633. display method very quickly displays the entire image at a low
  7634. resolution, letting you look for any major problems with the
  7635. scene. As it refines the image, you can concentrate on more
  7636. details, like shadows and textures. You don't have to wait for a
  7637. full resolution render to find problems, since you can interrupt
  7638. the rendering early and fix the scene, or if things look good,
  7639. you can let it continue and render the scene at high quality and
  7640. resolution.
  7641.  
  7642. To use this feature you should first select a Width and Height
  7643. value that is the highest resolution you will need. Mosaic
  7644. preview is enabled by specifying how big the mosaic blocks will
  7645. be on the first pass using Preview_Start_Size=n or +SPn. The
  7646. value n should be a number greater than zero that is a power of
  7647. two (1, 2, 4, 8, 16, 32, etc.) If it is not a power of two, the
  7648. nearest power of two less than n is substituted. This sets the
  7649. size of the squares, measured in pixels. A value of 16 will draw
  7650. every 16th pixel as a 16*16 pixel square on the first pass.
  7651. Subsequent passes will use half the previous value (such as 8*8,
  7652. 4*4 and so on.)
  7653.  
  7654. The process continues until it reaches 1*1 pixels or until it
  7655. reaches the size you set with Preview_End_Size=n or +EPn. Again
  7656. the value n should be a number greater than zero that is a power
  7657. of two and less than or equal to Preview_Start_Size. If it is not
  7658. a power of two, the nearest power of two less than n is
  7659. substituted. The default ending value is 1. If you set
  7660. Preview_End_Size to a value greater than 1 the mosaic passes will
  7661. end before reaching 1*1, but POV-Ray will always finish with a
  7662. 1*1. For example, if you want a single 8*8 mosaic pass before
  7663. rendering the final image, set Preview_Start_Size=8 and
  7664. Preview_End_Size=8.
  7665.  
  7666. No file output is performed until the final 1*1 pass is reached.
  7667. Although the preliminary passes render only as many pixels as
  7668. needed, the 1*1 pass re-renders every pixel so that anti-aliasing
  7669. and file output streams work properly. This makes the scene take
  7670. up to 25% longer than the regular 1*1 pass to render, so it is
  7671. suggested that mosaic preview not be used for final rendering.
  7672. Also, the lack of file output until the final pass means that
  7673. renderings which are interrupted before the 1*1 pass can not be
  7674. resumed without starting over from the beginning.
  7675.  
  7676. Future versions of POV-Ray will include some system of temporary
  7677. files or buffers which will eliminate these inefficiencies and
  7678. limitations. Mosaic preview is still a very useful feature for
  7679. test renderings.
  7680.  
  7681.  
  7682. 3.2.2.3   File Output Options
  7683. Output_to_File=b Sets file output on/off
  7684. ool
  7685. +F               Sets file output on (use
  7686.                  default type)
  7687. -F               Sets file output off
  7688. By default, POV-Ray writes an image file to disk. When you are
  7689. developing a scene and doing test renders, the graphic preview
  7690. may be sufficient. To save time and disk activity you may turn
  7691. file output off with Output_to_File=off or -F.
  7692.  
  7693.  
  7694. 3.2.2.3.1 Output File Type
  7695. Output_File_Type Sets file output format to x
  7696. =x
  7697. +Fxn             Sets file output on; sets
  7698.                  format x, depth n
  7699. -Fxn             Sets file output off; but in
  7700.                  future use format x, depth n
  7701. Output_Alpha=boo Sets alpha output on/off
  7702. l
  7703. +UA              Sets alpha output on
  7704. -UA              Sets alpha output off
  7705. Bits_Per_Color=n Sets file output bits/color to
  7706.                  n
  7707. The default type of image file depends on which platform you are
  7708. using. MS-DOS and most others default to 24-bit uncompressed
  7709. Targa. See your platform-specific documentation to see what your
  7710. default file type is. You may select one of several different
  7711. file types using Output_File_Type=x or +Fx where x is one of the
  7712. following...
  7713. +FC Compressed Targa-24 format (RLE,
  7714.     run length encoded)
  7715. +FN New PNG (portable network
  7716.     graphics) format
  7717. +FP Unix PPM format
  7718. +FS System-specific such as Mac Pict
  7719.     or Windows BMP
  7720. +FT Uncompressed Targa-24 format
  7721. Note that the obsolete +FD dump format and +FR raw format have
  7722. been dropped from POV-Ray 3.0 because they were rarely used and
  7723. no longer necessary. PPM, PNG, and system specific formats have
  7724. been added. PPM format images are uncompressed, and have a simple
  7725. text header, which makes it a widely portable image format. PNG
  7726. is a new image format designed not only to replace GIF, but to
  7727. improve on its shortcomings. PNG offers the highest compression
  7728. available without loss for high quality applications, such as ray-
  7729. tracing. The system specific format depends on the platform used
  7730. and is covered in the appropriate system specific documentation.
  7731.  
  7732. Most of these formats output 24 bits per pixel with 8 bits for
  7733. each of red, green and blue data. PNG allows you to optionally
  7734. specify the output bit depth from 5 to 16 bits for each of the
  7735. red, green, and blue colors, giving from 15 to 48 bits of color
  7736. information per pixel. The default output depth for all formats
  7737. is 8 bits/color (16 million possible colors), but this may be
  7738. changed for PNG format files by setting Bits_Per_Color=n or by
  7739. specifying +FNn, where n is the desired bit depth.
  7740.  
  7741. Specifying a smaller color depth like 5 bits/color (32768 colors)
  7742. may be enough for people with 8- or 16-bit (256 or 65536 color)
  7743. displays, and will improve compression of the PNG file. Higher
  7744. bit depths like 10 or 12 may be useful for video or publishing
  7745. applications, and 16 bits/color is good for grayscale height
  7746. field output (See section "Height Field" for details on height
  7747. fields).
  7748.  
  7749. Targa format also allows 8 bits of alpha transparency data to be
  7750. output, while PNG format allows 5 to 16 bits of alpha
  7751. transparency data, depending on the color bit depth as specified
  7752. above. You may turn this option on with Output_Alpha=on or +UA.
  7753. The default is off or -UA. See section "Using the Alpha Channel"
  7754. for further details on transparency.
  7755.  
  7756. In addition to support for variable bit-depths, alpha channel,
  7757. and grayscale formats, PNG files also store the Display_Gamma
  7758. value so the image displays properly on all systems (see section
  7759. "Display Hardware Settings"). The hf_gray_16 global setting, as
  7760. described in section "HF_Gray_16" will also affect the type of
  7761. data written to the output file.
  7762.  
  7763.  
  7764. 3.2.2.3.2 Output File Name
  7765. Output_File_Name=fi Sets output file to
  7766. le                  file
  7767. +Ofile              Same as
  7768.                     Output_File_Name=file
  7769. The default output filename is created from the scene name and
  7770. need not be specified. The scene name is the input name with all
  7771. drive, path, and extension information stripped. For example if
  7772. the input file name is c:\povray3\mystuff\myfile.pov the scene
  7773. name is myfile. The proper extension is appended to the scene
  7774. name based on the file type. For example myfile.tga or myfile.png
  7775. might be used.
  7776.  
  7777. You may override the default output name using
  7778. Output_File_Name=file or +Ofile. For example:
  7779.  
  7780.  Input_File_Name=myinput.pov
  7781.  Output_File_Name=myoutput.tga
  7782. If an output file name of "-" is specified (a single minus sign),
  7783. then the image will be written to standard output, usually the
  7784. screen. The output can then be piped into another program or to a
  7785. GUI if desired.
  7786.  
  7787. If the file specified is actually a path or directory or folder
  7788. name and not a file name, then the default output name is used
  7789. but it is written to the specified directory.  For example:
  7790.  
  7791.  Input_File_Name=myscene.pov
  7792.  Output_File_Name=c:\povray3\myimages\
  7793. This will create c:\povray3\myimages\myscene.tga as the output
  7794. file.
  7795.  
  7796.  
  7797. 3.2.2.3.3 Output File Buffer
  7798. Buffer_Output=b  Turn output buffering on/off
  7799. ool
  7800. +B               Turn output buffering on
  7801. -B               Turn output buffering off
  7802. Buffer_Size=n    Set output buffer size to n
  7803.                  kilobytes.  If n is zero, no
  7804.                  buffering. If n < system
  7805.                  default, the system default
  7806.                  is used.
  7807. +Bn              Turn buffer on, set size n
  7808. -Bn              Turn buffer off, but for
  7809.                  future set size n
  7810. The Buffer_Output and Buffer_Size options and the +B switch
  7811. allows you to assign large buffers to the output file. This
  7812. reduces the amount of time spent writing to the disk. If this
  7813. parameter is not specified, then as each row of pixels is
  7814. finished, the line is written to the file and the file is
  7815. flushed. On most systems, this operation ensures that the file is
  7816. written to the disk so that in the event of a system crash or
  7817. other catastrophic event, at least a part of the picture has been
  7818. stored properly and retrievable on disk. The default is not to
  7819. use any buffer.
  7820.  
  7821.  
  7822. 3.2.2.4   CPU Utilization Histogram
  7823. The CPU utilization histogram is a way of finding out where POV-
  7824. Ray is spending its rendering time, as well as an interesting way
  7825. of generating heightfields. The histogram splits up the screen
  7826. into a rectangular grid of blocks. As POV-Ray renders the image,
  7827. it calculates the amount of time it spends rendering each pixel
  7828. and then adds this time to the total rendering time for each grid
  7829. block. When the rendering is complete, the histogram is a file
  7830. which represents how much time was spent computing the pixels in
  7831. each grid block.
  7832.  
  7833. Not all versions of POV-Ray allow the creation of histograms. The
  7834. histogram output is dependent on the file type and the system
  7835. that POV-Ray is being run on.
  7836.  
  7837.  
  7838. 3.2.2.4.1 File Type
  7839. Histogram_Type=y Set histogram type to y
  7840.                  (Turn off if type is 'X')
  7841. +HTy             Same as Histogram_Type=y
  7842. The histogram output file type is nearly the same as that used
  7843. for the image output file types in "Output File Type". The
  7844. available histogram file types are as follows.
  7845. +HTC      Comma separated values (CSV)
  7846.           often used in spreadsheets
  7847. +HTN      New PNG (portable network
  7848.           graphics) format grayscale
  7849. +HTP      Unix PPM format
  7850. +HTS      System-specific such as Mac Pict
  7851.           or Windows BMP
  7852. +HTT      Uncompressed Targa-24 format
  7853.           (TGA)
  7854. +HTX      No histogram file output is
  7855.           generated
  7856. Note that +HTC does not generate a compressed Targa-24 format
  7857. output file but rather a text file with a comma-separated list of
  7858. the time spent in each grid block, in left-to-right and top-to
  7859. bottom order. The units of time output to the CSV file are system
  7860. dependent. See the system specific documentation for further
  7861. details on the time units in CSV files.
  7862.  
  7863. The Targa and PPM format files are in the POV heightfield format
  7864. (see "Height Field"), so the histogram information is stored in
  7865. both the red and green parts of the image, which makes it
  7866. unsuitable for viewing. When used as a height field, lower values
  7867. indicate less time spent calculating the pixels in that block,
  7868. while higher indicate more time spent in that block.
  7869.  
  7870. PNG format images are stored as grayscale images and are useful
  7871. for both viewing the histogram data as well as for use as a
  7872. heightfield. In PNG files, the darker (lower) areas indicate less
  7873. time spent in that grid block, while the brighter (higher) areas
  7874. indicate more time spent in that grid block.
  7875.  
  7876.  
  7877. 3.2.2.4.2 File Name
  7878. Histogram_Name=f Set histogram name to file
  7879. ile
  7880. +HNfile          Same as Histogram_Name=file
  7881. The histogram file name is the name of the file in which to write
  7882. the histogram data. If the file name is not specified it will
  7883. default to histgram.ext, where ext is based on the file type
  7884. specified previously. Note that if the histogram name is
  7885. specified the file name extension should match the file type.
  7886.  
  7887.  
  7888. 3.2.2.4.3 Grid Size
  7889. Histogram_Grid_Size=n  Set histogram grid to nn by
  7890. n.mm                   mm
  7891. +HSnn.mm               Same as
  7892.                        Histogram_Grid_Size=nn.mm
  7893. The histogram grid size gives the number of times the image is
  7894. split up in both the horizontal and vertical directions. For
  7895. example
  7896.  
  7897.  povray +Isample +W640 +H480 +HTN +HS160.120 +HNhistogrm.png
  7898. will split the image into 160*120 grid blocks, each of size 4*4
  7899. pixels, and output a PNG file, suitable for viewing or for use as
  7900. a heightfield. Smaller numbers for the grid size mean more pixels
  7901. are put into the same grid block. With CSV output, the number of
  7902. values output is the same as the number of grid blocks specified.
  7903. For the other formats the image size is identical to the rendered
  7904. image rather than the specified grid size, to allow easy
  7905. comparison between the histogram and the rendered image. If the
  7906. histogram grid size is not specified, it will default to the same
  7907. size as the image, so there will be one grid block per pixel.
  7908.  
  7909. Note that on systems that do task-switching or multi-tasking the
  7910. histogram may not exactly represent the amount of time POV-Ray
  7911. spent in a given grid block since the histogram is based on real
  7912. time rather than CPU time. As a result, time may be spent for
  7913. operating system overhead or on other tasks running at the same
  7914. time. This will cause the histogram to have speckling, noise or
  7915. large spikes. This can be reduced by decreasing the grid size so
  7916. that more pixels are averaged into a given grid block.
  7917.  
  7918.  
  7919. 3.2.3     Scene Parsing Options
  7920. POV-Ray reads in your scene file and processes it to create an
  7921. internal model of your scene. The process is called parsing. As
  7922. your file is parsed other files may be read along the way. This
  7923. section covers options concerning what to parse, where to find it
  7924. and what version specific assumptions it should make while
  7925. parsing it.
  7926.  
  7927.  
  7928. 3.2.3.1   Input File Name
  7929. Input_File_Name=fi  Sets input file name to
  7930. le                  file
  7931. +Ifile              Same as
  7932.                     Input_File_Name=file
  7933. You will probably always set this option but if you do not the
  7934. default input filename is object.pov. If you do not have an
  7935. extension then .pov is assumed. On case-sensitive operating
  7936. systems both .pov and .POV are tried. A full path specification
  7937. may be used (on MS-DOS systems +Ic:\povray3\mystuff\myfile.pov is
  7938. allowed for example). In addition to specifying the input file
  7939. name this also establishes the scene name.
  7940.  
  7941. The scene name is the input name with drive, path and extension
  7942. stripped. In the above example the scene name is myfile. This
  7943. name is used to create a default output file name and it is
  7944. referenced other places.
  7945.  
  7946. If you use "-" as the input file name the input will be read from
  7947. standard input. Thus you can pipe a scene created by a program to
  7948. POV-Ray and render it without having a scene file.
  7949.  
  7950. Under MS-DOS you can try this feature by typing.
  7951.  
  7952.  type ANYSCENE.POV | povray +I-
  7953.  
  7954. 3.2.3.2   Library Paths
  7955. Library_Path=pat Add path to list of
  7956. h                library paths
  7957. +Lpath           Same as Library_Path=path
  7958. POV-Ray looks for files in the current directory. If it does not
  7959. find a file it needs it looks in various other library
  7960. directories which you specify. POV-Ray does not search your
  7961. operating system path. It only searches the current directory and
  7962. directories which you specify with this option. For example the
  7963. standard include files are usually kept in one special directory.
  7964. You tell POV-Ray to look there with...
  7965.  
  7966.  Library_Path=c:\povray3\include
  7967. You must not specify any final path separators ("\" or "/") at
  7968. the end.
  7969.  
  7970. Multiple uses of this option switch do not override previous
  7971. settings. Up to twenty unique paths may be specified. If you
  7972. specify the exact same path twice it is only counts once. The
  7973. current directory will be searched first followed by the
  7974. indicated library directories in the order in which you specified
  7975. them.
  7976.  
  7977.  
  7978. 3.2.3.3   Language Version
  7979. Version=n.n    Set initial language
  7980.                compatibility to version n.n
  7981. +MVn.n         Same as Version=n.n
  7982. As POV-Ray as evolved from version 1.0 through 3.1 we have made
  7983. every effort to maintain some amount of backwards compatibility
  7984. with earlier versions.  Some old or obsolete features can be
  7985. handled directly without any special consideration by the user.
  7986. Some old or obsolete features can no longer be handled at all.
  7987. However some old features can still be used if you warn POV-Ray
  7988. that this is an older scene.  In the POV-Ray scene language you
  7989. can use the #version directive to switch version compatibility to
  7990. different setting.  See section "The #version Directive" for more
  7991. details about the language version directive.  Additionally you
  7992. may use the Version=n.n option or the +MVn.n switch to establish
  7993. the initial setting.  For example one feature introduced in 2.0
  7994. that was incompatible with any 1.0 scene files is the parsing of
  7995. float expressions. Setting Version=1.0 or using +MV1.0 turns off
  7996. expression parsing as well as many warning messages so that
  7997. nearly all 1.0 files will still work. Naturally the default
  7998. setting for this option is Version=3.1.
  7999.  
  8000. NOTE: Some obsolete or re-designed features are totally
  8001. unavailable in POV-Ray 3.1 REGARDLES OF THE VERSION SETTING.
  8002. Details on these features are noted throughout this
  8003. documentation.
  8004.  
  8005.  
  8006. 3.2.4     Shell-out to Operating System
  8007. Pre_Scene_Command=  Set command before entire
  8008. s                   scene
  8009. Pre_Frame_Command=  Set command before each
  8010. s                   frame
  8011. Post_Scene_Command  Set command after entire
  8012. =s                  scene
  8013. Post_Frame_Command  Set command after each frame
  8014. =s
  8015. User_Abort_Command  Set command when user aborts
  8016. =s                  POV-Ray
  8017. Fatal_Error_Comman  Set command when POV-Ray has
  8018. d=s                 fatal error
  8019. Note that no + or - switches are available for these options.
  8020. They cannot be used from the command line. They may only be used
  8021. from INI files.
  8022.  
  8023. POV-Ray offers you the opportunity to shell-out to the operating
  8024. system at several key points to execute another program or batch
  8025. file. Usually this is used to manage files created by the
  8026. internal animation loop however the shell commands are available
  8027. for any scene. The string s is a single line of text which is
  8028. passed to the operating system to execute a program. For example
  8029.  
  8030.  Post_Scene_Command=tga2gif -d -m myfile
  8031. would use the utility tga2gif with the -D and -M parameters to
  8032. convert myfile.tga to myfile.gif after the scene had finished
  8033. rendering.
  8034.  
  8035.  
  8036. 3.2.4.1   String Substitution in Shell Commands
  8037. It could get cumbersome to change the Post_Scene_Command every
  8038. time you changed scene names. POV-Ray can substitute various
  8039. values into a command string for you. For example:
  8040.  
  8041.  Post_Scene_Command=tga2gif -d -m %s
  8042. POV-Ray will substitute the %s with the scene name in the
  8043. command. The scene name is the Input_File_Name or +I setting with
  8044. any drive, directory and extension removed. For example:
  8045.  
  8046.  Input_File_Name=c:\povray3\scenes\waycool.pov
  8047. is stripped down to the scene name waycool which results in...
  8048.  
  8049.  Post_Scene_Command=tga2gif -d -m waycool
  8050. In an animation it may be necessary to have the exact output file
  8051. name with the frame number included. The string %o will
  8052. substitute the output file name. Suppose you want to save your
  8053. output files in a zip archive using the utility program pkzip.
  8054. You could do...
  8055.  
  8056.  Post_Frame_Command=pkzip -m %s %o
  8057. After rendering frame 12 of myscene.pov POV-Ray would shell to
  8058. the operating system with
  8059.  
  8060.  pkzip -m myscene mysce012.tga
  8061. The -M switch in pkzip moves mysce012.tga to myscene.zip and
  8062. removes it from the directory. Note that %o includes frame
  8063. numbers only when in an animation loop. During the
  8064. Pre_Scene_Command and Post_Scene_Command there is no frame number
  8065. so the original, unnumbered Output_File_Name is used. Any
  8066. User_Abort_Command or Fatal_Error_Command not inside the loop
  8067. will similarly give an unnumbered %o substitution.
  8068.  
  8069. Here is the complete list of substitutions available for a
  8070. command string.
  8071. %o   Output file name with extension and
  8072.      embedded frame number if any
  8073. %s   Scene name derived by stripping path
  8074.      and ext from input name
  8075. %n   Frame number of this frame
  8076. %k   Clock value of this frame
  8077. %h   Height of image in pixels
  8078. %w   Width of image in pixels
  8079. %%   A single % sign.
  8080.  
  8081. 3.2.4.2   Shell Command Sequencing
  8082. Here is the sequence of events in an animation loop. Non-animated
  8083. scenes work the exact same way except there is no loop.
  8084.  
  8085. 1)Process all INI file keywords and command line switches just
  8086.   once.
  8087. 2)Open any text output streams and do Create_INI if any.
  8088. 3)Execute Pre_Scene_Command if any.
  8089. 4)Loop through frames (or just do once on non-animation).
  8090.   a)Execute Pre_Frame_Command if any.
  8091.   b)Parse entire scene file, open output file and read settings,
  8092.      turn on display, render the frame, destroy all objects,
  8093.      textures etc., close output file, close display.
  8094.   c)Execute Post_Frame_Command if any.
  8095.   d)Go back to (4a) until all frames are done.
  8096. 5)Execute Post_Scene_Command if any.
  8097. 6)Exit POV-Ray.
  8098. If the user interrupts processing the User_Abort_Command, if any,
  8099. is executed. User aborts can only occur during the parsing and
  8100. rendering parts of step (4b) above.
  8101.  
  8102. If a fatal error occurs that POV-Ray notices the
  8103. Fatal_Error_Command, if any, is executed. Sometimes an unforeseen
  8104. bug or memory error could cause a total crash of the program in
  8105. which case there is no chance to shell out. Fatal errors can
  8106. occur just about anywhere including during the processing of
  8107. switches or INI files. If a fatal error occurs before POV-Ray has
  8108. read the Fatal_Error_Command string then obviously no shell can
  8109. occur.
  8110.  
  8111. Note that the entire scene is re-parsed for every frame. Future
  8112. versions of POV-Ray may allow you to hold over parts of a scene
  8113. from one frame to the next but for now it starts from scratch
  8114. every time. Note also that the Pre_Frame_Command occurs before
  8115. the scene is parsed. You might use this to call some custom scene
  8116. generation utility before each frame. This utility could rewrite
  8117. your .pov or .inc files if needed. Perhaps you will want to
  8118. generate new .gif or .tga files for image maps or height fields
  8119. on each frame.
  8120.  
  8121.  
  8122. 3.2.4.3   Shell Command Return Actions
  8123. Pre_Scene_Return=s  Set pre scene return
  8124.                     actions
  8125. Pre_Frame_Return=s  Set pre frame return
  8126.                     actions
  8127. Post_Scene_Return=  Set post scene return
  8128. s                   actions
  8129. Post_Frame_Return=  Set post frame return
  8130. s                   actions
  8131. User_Abort_Return=  Set user abort return
  8132. s                   actions
  8133. Fatal_Error_Return  Set fatal return actions
  8134. =s
  8135. Note that no + or - switches are available for these options.
  8136. They cannot be used from the command line. They may only be used
  8137. from INI files.
  8138.  
  8139. Most operating systems allow application programs to return an
  8140. error code if something goes wrong. When POV-Ray executes a shell
  8141. command it can make use of this error code returned from the
  8142. shell process and take some appropriate action if the code is
  8143. zero or non-zero. POV-Ray itself returns such codes. It returns 0
  8144. for success, 1 for fatal error and 2 for user abort.
  8145.  
  8146. The actions are designated by a single letter in the different
  8147. ..._Return=s options. The possible actions are:
  8148. I  ignore the code
  8149. S  skip one step
  8150. A  all steps skipped
  8151. Q  quit POV-Ray
  8152.    immediately
  8153. U  generate a user abort
  8154.    in POV-Ray
  8155. F  generate a fatal error
  8156.    in POV-Ray
  8157. For example if your Pre_Frame_Command calls a program which
  8158. generates your height field data and that utility fails then it
  8159. will return a non-zero code. We would probably want POV-Ray to
  8160. abort as well. The option Pre_Frame_Return=F will cause POV-Ray
  8161. to do a fatal abort if the Pre_Frame_Command returns a non-zero
  8162. code.
  8163.  
  8164. Sometimes a non-zero code from the external process is a good
  8165. thing. Suppose you want to test if a frame has already been
  8166. rendered. You could use the S action to skip this frame if the
  8167. file is already rendered. Most utilities report an error if the
  8168. file is not found. For example the command...
  8169.  
  8170.  pkzip -V myscene mysce012.tga
  8171. tells pkzip you want to view the catalog of myscene.zip for the
  8172. file mysce012.tga. If the file isn't in the archive pkzip returns
  8173. a non-zero code.
  8174.  
  8175. However we want to skip if the file is found. Therefore we need
  8176. to reverse the action so it skips on zero and doesn't skip on non-
  8177. zero. To reverse the zero vs. non-zero triggering of an action
  8178. precede it with a "-" sign (note a "!" will also work since it is
  8179. used in many programming languages as a negate operator).
  8180.  
  8181. Pre_Frame_Return=S will skip if the code shows error (non-zero)
  8182. and will proceed normally on no error (zero). Pre_Frame_Return=-S
  8183. will skip if there is no error (zero) and will proceed normally
  8184. if there is an error (non-zero).
  8185.  
  8186. The default for all shells is I which means that the return
  8187. action is ignored no matter what. POV-Ray simply proceeds with
  8188. whatever it was doing before the shell command. The other actions
  8189. depend upon the context. You may want to refer back to the
  8190. animation loop sequence chart in the previous section "Shell
  8191. Command Sequencing". The action for each shell is as follows.
  8192.  
  8193. On return from any User_Abort_Command if there is an action
  8194. triggered...
  8195.  
  8196. and you have     ... then POV-Ray will..
  8197. specified...
  8198. F                Then turn this user abort
  8199.                  into a fatal error.
  8200.                  Do the
  8201.                  Fatal_Error_Command, if
  8202.                  any.
  8203.                  Exit POV-Ray with error
  8204.                  code 1.
  8205. S, A, Q, or U    Then proceed with the user
  8206.                  abort.
  8207.                  Exit POV-Ray with error
  8208.                  code 2.
  8209. On return from any Fatal_Error_Command then POV-Ray will proceed
  8210. with the fatal error no matter what. It will exit POV-Ray with
  8211. error code 1.
  8212.  
  8213. On return from any Pre_Scene_Command, Pre_Frame_Command,
  8214. Post_Frame_Command or Post_Scene_Commands if there is an action
  8215. triggered...
  8216. ...and you have  ... then POV-Ray will...
  8217. specified...
  8218. F                ...turn this user abort into
  8219.                     a fatal error. Do the
  8220.                     Fatal_Error_Command, if
  8221.                     any. Exit POV-Ray with
  8222.                     error code 1.
  8223. U                ...generate a user abort. Do
  8224.                     the User_Abort_Command, if
  8225.                     any. Exit POV-Ray with an
  8226.                     error code 2.
  8227. Q                ..quit POV-Ray immediately.
  8228.                     Acts as though POV-Ray
  8229.                     never really ran. Do no
  8230.                     further shells, (not even
  8231.                     a Post_Scene_Command) and
  8232.                     exit POV-Ray with an error
  8233.                     code 0.
  8234. On return from a Pre_Scene_Command if there is an action
  8235. triggered...
  8236. ...and you have  ... then POV-Ray will...
  8237. specified...
  8238. S                ...skip rendering all
  8239.                     frames. Acts as though the
  8240.                     scene completed all frames
  8241.                     normally. Do not do any
  8242.                     Pre_Frame_Command or
  8243.                     Post_Frame_Commands. Do
  8244.                     the Post_Scene_Command, if
  8245.                     any. Exit POV-Ray with
  8246.                     error code 0. On the
  8247.                     earlier chart this means
  8248.                     skip step #4.
  8249. A                ...skip all scene activity.
  8250.                     Works exactly like Q quit.
  8251.                     On the earlier chart this
  8252.                     means skip to step #6.
  8253.                     Acts as though POV-Ray
  8254.                     never really ran. Do no
  8255.                     further shells, (not even
  8256.                     a Post_Scene_Command) and
  8257.                     exit POV-Ray with an error
  8258.                     code 0.
  8259. On return from a Pre_Frame_Command if there is an action
  8260. triggered...
  8261. ...and you have  ... then POV-Ray will...
  8262. specified...
  8263. S                ...skip only this frame.
  8264.                     Acts as though this frame
  8265.                     never existed. Do not do
  8266.                     the Post_Frame_Command.
  8267.                     Proceed with the next
  8268.                     frame. On the earlier
  8269.                     chart this means skip
  8270.                     steps (4b) and (4c) but
  8271.                     loop back as needed in
  8272.                     (4d).
  8273. A                ...skip rendering this frame
  8274.                     and all remaining frames.
  8275.                     Acts as though the scene
  8276.                     completed all frames
  8277.                     normally. Do not do any
  8278.                     further
  8279.                     Post_Frame_Commands. Do
  8280.                     the Post_Scene_Command, if
  8281.                     any. Exit POV-Ray with
  8282.                     error code 0. On the
  8283.                     earlier chart this means
  8284.                     skip the rest of step (4)
  8285.                     and proceed at step (5).
  8286. On return from a Post_Frame_Command if there is an action
  8287. triggered...
  8288. ...and you have  ... then POV-Ray will...
  8289. specified...
  8290. S or A           ...skip all remaining
  8291.                     frames. Acts as though the
  8292.                     scene completed all frames
  8293.                     normally. Do not do any
  8294.                     further
  8295.                     Post_Frame_Commands. Do
  8296.                     the Post_Scene_Command, if
  8297.                     any. Exit POV-Ray with
  8298.                     error code 0. On the
  8299.                     earlier chart this means
  8300.                     skip the rest of step (4)
  8301.                     and proceed at step (5).
  8302. On return from any Post_Scene_Command if there is an action
  8303. triggered and you have specified S or A then no special action
  8304. occurs.  This is the same as I for this shell command.
  8305.  
  8306.  
  8307. 3.2.5     Text Output
  8308. Text output is an important way that POV-Ray keeps you informed
  8309. about what it is going to do, what it is doing and what it did.
  8310. New to POV-Ray 3.0, the program splits its text messages into 7
  8311. separate streams. Some versions of POV-Ray color-codes the
  8312. various types of text. Some versions allow you to scroll back
  8313. several pages of messages. All versions allow you to turn some of
  8314. these text streams off/on or to direct a copy of the text output
  8315. to one or several files. This section details the options which
  8316. give you control over text output.
  8317.  
  8318.  
  8319. 3.2.5.1   Text Streams
  8320. There are seven distinct text streams that POV-Ray uses for
  8321. output. On some versions each stream is designated by a
  8322. particular color. Text from these streams are displayed whenever
  8323. it is appropriate so there is often an intermixing of the text.
  8324. The distinction is only important if you choose to turn some of
  8325. the streams off or to direct some of the streams to text files.
  8326. On some systems you may be able to review the streams separately
  8327. in their own scroll-back buffer.
  8328.  
  8329. Here is a description of each stream.
  8330.  
  8331. Banner: This stream displays the program's sign-on banner,
  8332. copyright, contributor's list, and some help screens. It cannot
  8333. be turned off or directed to a file because most of this text is
  8334. displayed before any options or switches are read. Therefore you
  8335. cannot use an option or switch to control it. There are switches
  8336. which display the help screens. They are covered in section "Help
  8337. Screen Switches".
  8338.  
  8339. Debug: This stream displays debugging messages. It was primarily
  8340. designed for developers but this and other streams may also be
  8341. used by the user to display messages from within their scene
  8342. files. See section "Text Message Streams" for details on this
  8343. feature. This stream may be turned off and/or directed to a text
  8344. file.
  8345.  
  8346. Fatal: This stream displays fatal error messages. After
  8347. displaying this text, POV-Ray will terminate. When the error is a
  8348. scene parsing error, you may be shown several lines of scene text
  8349. that leads up to the error. This stream may be turned off and/or
  8350. directed to a text file.
  8351.  
  8352. Render: This stream displays information about what options you
  8353. have specified to render the scene. It includes feedback on all
  8354. of the major options such as scene name, resolution, animation
  8355. settings, anti-aliasing and others. This stream may be turned off
  8356. and/or directed to a text file.
  8357.  
  8358. Statistics: This stream displays statistics after a frame is
  8359. rendered. It includes information about the number of rays
  8360. traced, the length of time of the processing and other
  8361. information. This stream may be turned off and/or directed to a
  8362. text file.
  8363.  
  8364. Status: This stream displays one-line status messages that
  8365. explain what POV-Ray is doing at the moment. On some systems this
  8366. stream is displayed on a status line at the bottom of the screen.
  8367. This stream cannot be directed to a file because there is
  8368. generally no need to. The text displayed by the Verbose option or
  8369. +V switch is output to this stream so that part of the status
  8370. stream may be turned off.
  8371.  
  8372. Warning: This stream displays warning messages during the parsing
  8373. of scene files and other warnings. Despite the warning, POV-Ray
  8374. can continue to render the scene. You will be informed if POV-Ray
  8375. has made any assumptions about your scene so that it can proceed.
  8376. In general any time you see a warning, you should also assume
  8377. that this means that future versions of POV-Ray will not allow
  8378. the warned action. Therefore you should attempt to eliminate
  8379. warning messages so your scene will be able to run in future
  8380. versions of POV-Ray. This stream may be turned off and/or
  8381. directed to a text file.
  8382.  
  8383.  
  8384. 3.2.5.2   Console Text Output
  8385. Debug_Console=bool   Turn console display of
  8386.                      debug info text on/off
  8387. +GD                  Same as Debug_Console=On
  8388. -GD                  Same as Debug_Console=Off
  8389. Fatal_Console=bool   Turn console display of
  8390.                      fatal error text on/off
  8391. +GF                  Same as Fatal_Console=On
  8392. -GF                  Same as Fatal_Console=Off
  8393. Render_Console=bool  Turn console display of
  8394.                      render info text on/off
  8395. +GR                  Same as Render_Console=On
  8396. -GR                  Same as Render_Console=Off
  8397. Statistic_Console=bo Turn console display of
  8398. ol                   statistic text on/off
  8399. +GS                  Same as Statistic_Console=On
  8400. -GS                  Same as
  8401.                      Statistic_Console=Off
  8402. Warning_Console=bool Turn console display of
  8403.                      warning text on/off
  8404. +GW                  Same as Warning_Console=On
  8405. -GW                  Same as Warning_Console=Off
  8406. All_Console=bool     Turn on/off all debug,
  8407.                         fatal, render, statistic
  8408.                         and warning text to
  8409.                         console.
  8410. +GA                  Same as All_Console=On
  8411. -GA                  Same as All_Console=Off
  8412. You may suppress the output to the console of the debug, fatal,
  8413. render, statistic or warning text streams. For example the
  8414. Statistic_Console=off option or the -GS switch can turn off the
  8415. statistic stream. Using on or +GS you may turn it on again. You
  8416. may also turn all five of these streams on or off at once using
  8417. the All_Console option or +GA switch.
  8418.  
  8419. Note that these options take effect immediately when specified.
  8420. Obviously any error or warning messages that might occur before
  8421. the option is read are not be affected.
  8422.  
  8423.  
  8424. 3.2.5.3   Directing Text Streams to Files
  8425. Debug_File=true    Echo debug info text to DEBUG.OUT
  8426. Debug_File=false   Turn off file output of debug info
  8427. Debug_File=file      Echo debug info text to file
  8428. +GDfile            Both Debug_Console=On, Debug_File=file
  8429. -GDfile              Both Debug_Console=Off,
  8430.                    Debug_File=file
  8431. Fatal_File=true    Echo fatal text to FATAL.OUT
  8432. Fatal_File=false   Turn off file output of fatal
  8433. Fatal_File=file      Echo fatal info text to file
  8434. +GFfile            Both Fatal_Console=On, Fatal_File=file
  8435. -GFfile              Both Fatal_Console=Off,
  8436.                    Fatal_File=file
  8437. Render_File=true   Echo render info text to RENDER.OUT
  8438. Render_File=false  Turn off file output of render info
  8439. Render_File=file     Echo render info text to file
  8440. +GRfile            Both Render_Console=On,
  8441.                    Render_File=file
  8442. -GRfile              Both Render_Console=Off,
  8443.                    Render_File=file
  8444. Statistic_File=tr  Echo statistic text to STATS.OUT
  8445. ue
  8446. Statistic_File=fa  Turn off file output of statistics
  8447. lse
  8448. Statistic_File=file  Echo statistic text to file
  8449. +GSfile            Both Statistic_Console=On,
  8450.                      Statistic_File=file
  8451. -GSfile            Both Statistic_Console=Off,
  8452.                      Statistic_File=file
  8453. Warning_File=true  Echo warning info text to
  8454.                    WARNING.OUT
  8455. Warning_File=fals  Turn off file output of warning info
  8456. e
  8457. Warning_File=file    Echo warning info text to file
  8458. +GWfile            Both Warning_Console=On,
  8459.                    Warning_File=file
  8460. -GWfile              Both Warning_Console=Off,
  8461.                    Warning_File=file
  8462. All_File=true      Echo all debug, fatal, render,
  8463.                      statistic, and warning text to
  8464.                      ALLTEXT.OUT
  8465. All_File=false     Turn off file output of all debug,
  8466.                      fatal, render, statistic, and
  8467.                      warning text.
  8468. All_File=file        Echo all debug, fatal, render,
  8469.                    statistic, and warning text to file
  8470. +GAfile            Both All_Console=On, All_File=file
  8471. -GAfile              Both All_Console=Off, All_File=file
  8472. You may direct a copy of the text streams to a text file for the
  8473. debug, fatal, render, statistic, or warning text streams. For
  8474. example the Statistic_File=s option or the +GSs switch. If the
  8475. string s is true or any of the other valid true strings then that
  8476. stream is redirected to a file with a default name. Valid true
  8477. values are true, yes, on or 1. If the value is false the
  8478. direction to a text file is turned off. Valid false values are
  8479. false, no, off or 0. Any other string specified turns on file
  8480. output and the string is interpreted as the output file name.
  8481.  
  8482. Similarly you may specify such a true, false or file name string
  8483. after a switch such as +GSfile. You may also direct all five
  8484. streams to the same file using the All_File option or +GA switch.
  8485. You may not specify the same file for two or more streams because
  8486. POV-Ray will fail when it tries to open or close the same file
  8487. twice.
  8488.  
  8489. Note that these options take effect immediately when specified.
  8490. Obviously any error or warning messages that might occur before
  8491. the option is read will not be affected.
  8492.  
  8493.  
  8494. 3.2.5.4   Help Screen Switches
  8495. +H or +?       Show help screen 0 if this
  8496.                is the only switch
  8497. +H0 to +H8     Show help screen 0 to 8 if
  8498.                this is the only switch
  8499. +?0 to +?8     Same as +H0 to +H8
  8500. Note that there are no INI style equivalents to these options.
  8501.  
  8502. Graphical interface versions of POV-Ray such as Mac or Windows
  8503. have extensive online help. Other versions of POV-Ray have only a
  8504. few quick-reference help screens. The +? switch, optionally
  8505. followed by a single digit from 0 to 8, will display these help
  8506. screens to the banner text stream. After displaying the help
  8507. screens, POV-Ray terminates. Because some operating systems do
  8508. not permit a question mark as a command line switch you may also
  8509. use the +H switch. Note however that this switch is also used to
  8510. specify the height of the image in pixels. Therefore the +H
  8511. switch is only interpreted as a help switch if it is the only
  8512. switch on the command line and if the value after the switch is
  8513. less than or equal to 8.
  8514.  
  8515.  
  8516. 3.2.6     Tracing Options
  8517. There is more than one way to trace a ray. Sometimes there is a
  8518. trade-off between quality and speed. Sometimes options designed
  8519. to make tracing faster can slow things down. This section covers
  8520. options that tell POV-Ray how to trace rays with the appropriate
  8521. speed and quality settings.
  8522.  
  8523.  
  8524. 3.2.6.1   Quality Settings
  8525. Quality=  Set quality value to n
  8526. n         (0 <= n <= 11)
  8527. +Qn       Same as Quality=n
  8528. The Quality=n option or +Qn switch allows you to specify the
  8529. image rendering quality. You may choose to lower the quality for
  8530. test rendering and raise it for final renders. The quality
  8531. adjustments are made by eliminating some of the calculations that
  8532. are normally performed. For example settings below 4 do not
  8533. render shadows. Settings below 8 do not use reflection or
  8534. refraction. The duplicate values allow for future expansion.  The
  8535. values correspond to the following quality levels:
  8536. 0,  Just show quick colors. Use
  8537. 1      full ambient lighting only.
  8538.        Quick colors are used only at
  8539.        5 or below.
  8540. 2,  Show specified diffuse and
  8541. 3      ambient light.
  8542. 4   Render shadows, but no extended
  8543.        lights.
  8544. 5   Render shadows, including
  8545.        extended lights.
  8546. 6,  Compute texture patterns.
  8547. 7
  8548. 8   Compute reflected, refracted,
  8549.        and transmitted rays.
  8550. 9   Compute media.
  8551. 10  Compute radiosity but no media
  8552. 11  Compute radiosity and media
  8553. The default is 9 if not specified.
  8554.  
  8555.  
  8556. 3.2.6.2   Radiosity Setting
  8557. Radiosity=boo Turns radiosity
  8558. l             on/off
  8559. +QR           Turns radiosity on
  8560. -QR           Turns radiosity on
  8561. Radiosity is an additional calculation which computes diffuse
  8562. inter-reflection. It is an extremely slow calculation that is
  8563. somewhat experimental. By default, radiosity is off.  The
  8564. parameters which control how radiosity calculations are performed
  8565. are specified in the radiosity section of the global_settings
  8566. statement. See section "Radiosity" for further details.
  8567.  
  8568.  
  8569. 3.2.6.3   Automatic Bounding Control
  8570. Bounding=bool       Turn bounding on/off
  8571. +MB                 Turn bounding on; Set
  8572.                       threshold to 25 or
  8573.                       previous amount
  8574. -MB                 Turn bounding off
  8575. Bounding_Threshold  Set bound threshold to n
  8576. =n
  8577. +MBn                Turn bounding on; bound
  8578.                       threshold to n
  8579. -MBn                Turn bounding off; for
  8580.                       future threshold to n
  8581. Light_Buffer=bool   Turn light buffer on/off
  8582. +UL                 Turn light buffer on
  8583. -UL                 Turn light buffer off
  8584. Vista_Buffer=bool   Turn vista buffer on/off
  8585. +UV                 Turn vista buffer on
  8586. -UV                 Turn vista buffer off
  8587. POV-Ray uses a variety of spatial sub-division systems to speed
  8588. up ray-object intersection tests. The primary system uses a
  8589. hierarchy of nested bounding boxes. This system compartmentalizes
  8590. all finite objects in a scene into invisible rectangular boxes
  8591. that are arranged in a tree-like hierarchy. Before testing the
  8592. objects within the bounding boxes the tree is descended and only
  8593. those objects are tested whose bounds are hit by a ray. This can
  8594. greatly improve rendering speed. However for scenes with only a
  8595. few objects the overhead of using a bounding system is not worth
  8596. the effort. The Bounding=off option or -MB switch allows you to
  8597. force bounding off. The default value is on.
  8598.  
  8599. The Bounding_Threshold=n or +MBn switch allows you to set the
  8600. minimum number of objects necessary before bounding is used. The
  8601. default is +MB25 which means that if your scene has fewer than 25
  8602. objects POV-Ray will automatically turn bounding off because the
  8603. overhead isn't worth it. Generally it's a good idea to use a much
  8604. lower threshold like +MB5.
  8605.  
  8606. Additionally POV-Ray uses systems known as vista buffers and
  8607. light buffers to further speed things up. These systems only work
  8608. when bounding is on and when there are a sufficient number of
  8609. objects to meet the bounding threshold. The vista buffer is
  8610. created by projecting the bounding box hierarchy onto the screen
  8611. and determining the rectangular areas that are covered by each of
  8612. the elements in the hierarchy. Only those objects whose
  8613. rectangles enclose a given pixel are tested by the primary
  8614. viewing ray. The vista buffer can only be used with perspective
  8615. and orthographic cameras because they rely on a fixed viewpoint
  8616. and a reasonable projection (i. e. straight lines have to stay
  8617. straight lines after the projection).
  8618.  
  8619. The light buffer is created by enclosing each light source in an
  8620. imaginary box and projecting the bounding box hierarchy onto each
  8621. of its six sides. Since this relies on a fixed light source,
  8622. light buffers will not be used for area lights.
  8623.  
  8624. Reflected and transmitted rays do not take advantage of the light
  8625. and vista buffer.
  8626.  
  8627. The default settings are Vista_Buffer=on or +UV and
  8628. Light_Buffer=on or +UL. The option to turn these features off is
  8629. available to demonstrate their usefulness and as protection
  8630. against unforeseen bugs which might exist in any of these
  8631. bounding systems.
  8632.  
  8633. In general, any finite object and many types of CSG of finite
  8634. objects will properly respond to this bounding system. In
  8635. addition blobs and meshes use an additional internal bounding
  8636. system. These systems are not affected by the above switch. They
  8637. can be switched off using the appropriate syntax in the scene
  8638. file (see "Blob" and "Mesh" for details). Text objects are split
  8639. into individual letters that are bounded using the bounding box
  8640. hierarchy. Some CSG combinations of finite and infinite objects
  8641. are also automatically bound. The end result is that you will
  8642. rarely need to add manual bounding objects as was necessary in
  8643. earlier versions of POV-Ray unless you use many infinite objects.
  8644.  
  8645.  
  8646. 3.2.6.4   Removing User Bounding
  8647. Remove_Bounds=bo Turn unnecessary bounds
  8648. ol               removal on/off
  8649. +UR              Turn unnecessary bounds
  8650.                  removal on
  8651. -UR              Turn unnecessary bounds
  8652.                  removal off
  8653. Split_Unions=boo Turn split bounded unions
  8654. l                on/off
  8655. +SU              Turn split bounded unions on
  8656. -SU              Turn split bounded unions
  8657.                  off
  8658. Early versions of POV-Ray had no system of automatic bounding or
  8659. spatial sub-division to speed up ray-object intersection tests.
  8660. Users had to manually create bounding boxes to speed up the
  8661. rendering. Since version 3.0, POV-Ray has had more sophisticated
  8662. automatic bounding than any previous version. In many cases the
  8663. manual bounding on older scenes is slower than the new automatic
  8664. systems. Therefore POV-Ray removes manual bounding when it knows
  8665. it will help. In rare instances you may want to keep manual
  8666. bounding. Some older scenes incorrectly used bounding when they
  8667. should have used clipping. If POV-Ray removes the bounds in these
  8668. scenes the image will not look right. To turn off the automatic
  8669. removal of manual bounds you should specify Remove_Bounds=off or
  8670. use -UR. The default is Remove_Bounds=on.
  8671.  
  8672. One area where the jury is still out is the splitting of manually
  8673. bounded unions. Unbounded unions are always split into their
  8674. component parts so that automatic bounding works better. Most
  8675. users do not bound unions because they know that doing so is
  8676. usually slower. If you do manually bound a union we presume you
  8677. really want it bound. For safety sake we do not presume to remove
  8678. such bounds. If you want to remove manual bounds from unions you
  8679. should specify Split_Unions=on or use +SU. The default is
  8680. Split_Unions=off.
  8681.  
  8682.  
  8683. 3.2.6.5   Anti-Aliasing Options
  8684. Antialias=bool        Turns anti-aliasing on/off
  8685. +A                    Turns aa on with threshold 0.3 or
  8686.                       previous amount
  8687. -A                    Turns anti-aliasing off
  8688. Sampling_Method=n     Sets aa-sampling method (only 1 or 2
  8689.                       are valid)
  8690. +AMn                  Same as Sampling_Method=n
  8691. Antialias_Threshold=n Sets anti-aliasing threshold
  8692. .n
  8693. +An.n                 Sets aa on with aa-threshold at n.n
  8694. -An.n                 Sets aa off (aa-threshold n.n in
  8695.                       future)
  8696. Jitter=bool           Sets aa-jitter on/off
  8697. +J                    Sets aa-jitter on with 1.0 or previous
  8698.                       amount
  8699. -J                    Sets aa-jitter off
  8700. Jitter_Amount=n.n     Sets aa-jitter amount to n.n. If n.n
  8701.                       <= 0 aa-jitter is set off
  8702. +Jn.n                 Sets aa-jitter on; jitter amount to
  8703.                       n.n. If n.n <= 0 aa-jitter is set off
  8704. -Jn.n                 Sets aa-jitter off (jitter amount n.n
  8705.                       in future)
  8706. Antialias_Depth=n     Sets aa-depth (1 <= n <= 9)
  8707. +Rn                   Same as Antialias_Depth=n
  8708. The ray-tracing process is in effect a discrete, digital sampling
  8709. of the image with typically one sample per pixel. Such sampling
  8710. can introduce a variety of errors. This includes a jagged, stair-
  8711. step appearance in sloping or curved lines, a broken look for
  8712. thin lines, moirΘ patterns of interference and lost detail or
  8713. missing objects, which are so small they reside between adjacent
  8714. pixels. The effect that is responsible for those errors is called
  8715. aliasing.
  8716.  
  8717. Anti-aliasing is any technique used to help eliminate such errors
  8718. or to reduce the negative impact they have on the image. In
  8719. general, anti-aliasing makes the ray-traced image look smoother.
  8720. The Antialias=on option or +A switch turns on POV-Ray's anti-
  8721. aliasing system.
  8722.  
  8723. When anti-aliasing is turned on, POV-Ray attempts to reduce the
  8724. errors by shooting more than one viewing ray into each pixel and
  8725. averaging the results to determine the pixel's apparent color.
  8726. This technique is called super-sampling and can improve the
  8727. appearance of the final image but it drastically increases the
  8728. time required to render a scene since many more calculations have
  8729. to be done.
  8730.  
  8731. POV-Ray gives you the option to use one of two alternate super-
  8732. sampling methods. The Sampling_Method=n option or +AMn switch
  8733. selects either type 1 or type 2. Selecting one of those methods
  8734. does not turn anti-aliasing on. This has to be done by using the
  8735. +A command line switch or Antialias=on option.
  8736.  
  8737. Type 1 is an adaptive, non-recursive super-sampling method.  It
  8738. is adaptive because not every pixel is super-sampled.  Type 2 is
  8739. an adaptive and recursive super-sampling method.  It is recursive
  8740. because the pixel is sub-divided and sub-sub-divided recursively.
  8741. The adaptive nature of type 2 is the variable depth of recursion.
  8742.  
  8743. In the default, non-recursive method (+AM1), POV-Ray initially
  8744. traces one ray per pixel. If the color of a pixel differs from
  8745. its neighbors (to the left or above) by more than a threshold
  8746. value then the pixel is super-sampled by shooting a given, fixed
  8747. number of additional rays. The default threshold is 0.3 but it
  8748. may be changed using the Antialias_Threshold=n.n option. When the
  8749. switches are used, the threshold may optionally follow the +A.
  8750. For example +A0.1 turns anti-aliasing on and sets the threshold
  8751. to 0.1.
  8752.  
  8753. The threshold comparison is computed as follows. If r1, g1, b1
  8754. and r2, g2, b2 are the rgb components of two pixels then the
  8755. difference between pixels is computed by
  8756.  
  8757.   diff = abs(r1-r2) + abs(g1-g2) + abs(b1-b2)
  8758. If this difference is greater than the threshold then both pixels
  8759. are super-sampled. The rgb values are in the range from 0.0 to
  8760. 3.0 thus the most two pixels can differ is 3.0. If the anti-
  8761. aliasing threshold is 0.0 then every pixel is super-sampled. If
  8762. the threshold is 3.0 then no anti-aliasing is done. Lower
  8763. threshold means more anti-aliasing and less speed. Use anti-
  8764. aliasing for your final version of a picture, not the rough
  8765. draft. The lower the contrast, the lower the threshold should be.
  8766. Higher contrast pictures can get away with higher tolerance
  8767. values. Good values seem to be around 0.2 to 0.4.
  8768.  
  8769. When using the non-recursive method, the default number of super-
  8770. samples is nine per pixel, located on a 3*3 grid. The
  8771. Antialias_Depth=n option or +Rn switch controls the number of
  8772. rows and columns of samples taken for a super-sampled pixel. For
  8773. example +R4 would give 4*4=16 samples per pixel.
  8774.  
  8775. The second, adaptive, recursive super-sampling method starts by
  8776. tracing four rays at the corners of each pixel. If the resulting
  8777. colors differ more than the threshold amount additional samples
  8778. will be taken. This is done recursively, i.e. the pixel is
  8779. divided into four sub-pixels that are separately traced and
  8780. tested for further subdivision. The advantage of this method is
  8781. the reduced number of rays that have to be traced. Samples that
  8782. are common among adjacent pixels and sub-pixels are stored and
  8783. reused to avoid re-tracing of rays. The recursive character of
  8784. this method makes the super-sampling concentrate on those parts
  8785. of the pixel that are more likely to need super-sampling (see
  8786. figure below).
  8787.  
  8788.                                 
  8789.                                 
  8790.        Example of how the recursive super-sampling works.
  8791.                                 
  8792. The maximum number of subdivisions is specified by the
  8793. Antialias_Depth=n option or +Rn switch. This is different from
  8794. the adaptive, non-recursive method were the total number of super-
  8795. samples is specified. A maximum number of n subdivisions results
  8796. in a maximum number of samples per pixel that is given by the
  8797. following table.
  8798. +Rn     Number of      Maximum number of
  8799.        samples per          samples
  8800.       super-sampled    per super-sampled
  8801.       pixel for the        pixel for
  8802.       non-recursive      the recursive
  8803.        method +AM1        method +AM2
  8804.  1          1                  9
  8805.  2          4                 25
  8806.  3          9                 81
  8807.  4         16                 289
  8808.  5         25                1089
  8809.  6         36                4225
  8810.  7         49                16641
  8811.  8         64                66049
  8812.  9         81               263169
  8813. You should note that the maximum number of samples in the
  8814. recursive case is hardly ever reached for a given pixel. If the
  8815. recursive method is used with no anti-aliasing each pixel will be
  8816. the average of the rays traced at its corners. In most cases a
  8817. recursion level of three is sufficient.
  8818.  
  8819. Another way to reduce aliasing artifacts is to introduce noise
  8820. into the sampling process. This is called jittering and works
  8821. because the human visual system is much more forgiving to noise
  8822. than it is to regular patterns. The location of the super-samples
  8823. is jittered or wiggled a tiny amount when anti-aliasing is used.
  8824. Jittering is used by default but it may be turned off with the
  8825. Jitter=off option or -J switch. The amount of jittering can be
  8826. set with the Jitter_Amount=n.n option. When using switches the
  8827. jitter scale may be specified after the +Jn.n switch. For example
  8828. +J0.5 uses half the normal jitter. The default amount of 1.0 is
  8829. the maximum jitter which will insure that all super-samples
  8830. remain inside the original pixel. Note that the jittering noise
  8831. is random and non-repeatable so you should avoid using jitter in
  8832. animation sequences as the anti-aliased pixels will vary and
  8833. flicker annoyingly from frame to frame.
  8834.  
  8835. If anti-aliasing is not used one sample per pixel is taken
  8836. regardless of the super-sampling method specified.
  8837.  
  8838.  
  8839.  
  8840. 4.0    Scene Description Language
  8841. The reference section describes the POV-Ray scene description
  8842. language.  It is supposed to be used as a reference for looking
  8843. up things. It does not contain detailed explanations on how
  8844. scenes are written or how POV-Ray is used. It just explains all
  8845. features, their syntax, applications, limits, drawbacks, etc.
  8846.  
  8847. The scene description language allows you to describe the world
  8848. in a readable and convenient way. Files are created in plain
  8849. ASCII text using an editor of your choice. The input file name is
  8850. specified using the Input_File_Name=file option or +Ifile switch.
  8851. By default the files have the extension .pov. POV-Ray reads the
  8852. file, processes it by creating an internal model of the scene and
  8853. then renders the scene.
  8854.  
  8855. The overall syntax of a scene is shown below.  See "Notation and
  8856. Basic Assumptions" for more information on syntax notation.
  8857.  
  8858. SCENE:
  8859.   SCENE_ITEM...
  8860. SCENE_ITEM:
  8861.   LANGUAGE_DIRECTIVES      |
  8862.   camera { CAMERA_ITEMS... }    |
  8863.   OBJECTS                  |
  8864.   ATMOSPHERIC_EFFECTS      |
  8865.   global_settings { GLOBAL_ITEMS }
  8866. In plain English, this means that a scene contains one or more
  8867. scene items and that a scene item may be any of the five items
  8868. listed below it.  The items may appear in any order.  None is a
  8869. required item.  In addition to the syntax depicted above, a
  8870. LANGUAGE_DIRECTIVE may also appear anywhere embedded in other
  8871. statements between any two tokens.  There are some restrictions
  8872. on nesting directives also.
  8873.  
  8874. For details on those five items see section "Language
  8875. Directives", section "Objects", section "Camera", section
  8876. "Atmospheric Effects" and section "Global Settings" for details.
  8877.  
  8878.  
  8879. 4.1  C41-Language Basics
  8880. The POV-Ray language consists of identifiers, reserved keywords,
  8881. floating point expressions, strings, special symbols and
  8882. comments. The text of a POV-Ray scene file is free format. You
  8883. may put statements on separate lines or on the same line as you
  8884. desire. You may add blank lines, spaces or indentations as long
  8885. as you do not split any keywords or identifiers.
  8886.  
  8887.  
  8888. 4.1.1     Identifiers and Keywords
  8889. POV-Ray allows you to define identifiers for later use in the
  8890. scene file. An identifier may be 1 to 40 characters long. It may
  8891. consist of upper or lower case letters, the digits 0 through 9 or
  8892. an underscore character ("_"). The first character must be an
  8893. alphabetic character. The declaration of identifiers is covered
  8894. later.
  8895.  
  8896. POV-Ray has a number of reserved keywords which are listed below.
  8897. abs        dimension_s  merge        sky_sphere
  8898. absorption ize          mesh         slice
  8899. acos       direction    metallic     slope_map
  8900. acosh      disc         min          smooth
  8901. adaptive   distance     minimum_reu  smooth_tri
  8902. adc_bailou distance_ma  se           angle
  8903. t          ximum        mod          sor
  8904. agate      div          mortar       specular
  8905. agate_turb eccentricit  nearest_cou  sphere
  8906. all        y            nt           spherical
  8907. alpha      else         no           spiral1
  8908. ambient    emission     normal       spiral2
  8909. ambient_li end          normal_map   spotlight
  8910. ght        error        no_shadow    spotted
  8911. angle      error_bound  number_of_w  sqr
  8912. aperture   exp          aves         sqrt
  8913. append     extinction   object       statistics
  8914. arc_angle  fade_distan  octaves      str
  8915. area_light ce           off          strcmp
  8916. array      fade_power   offset       strength
  8917. asc        falloff      omega        strlen
  8918. asin       falloff_ang  omnimax      strlwr
  8919. asinh      le           on           strupr
  8920. assumed_ga false        once         sturm
  8921. mma        fclose       onion        substr
  8922. atan       file_exists  open         superellip
  8923. atan2      filter       orthographi  soid
  8924. atanh      finish       c            switch
  8925. average    fisheye      panoramic    sys
  8926. background flatness     perspective  t
  8927. bezier_spl flip         pgm          tan
  8928. ine        floor        phase        tanh
  8929. bicubic_pa focal_point  phong        text
  8930. tch        fog          phong_size   texture
  8931. black_hole fog_alt      pi           texture_ma
  8932. blob       fog_offset   pigment      p
  8933. blue       fog_type     pigment_map  tga
  8934. blur_sampl fopen        planar       thickness
  8935. es         frequency    plane        threshold
  8936. bounded_by gif          png          tightness
  8937. box        global_sett  point_at     tile2
  8938. boxed      ings         poly         tiles
  8939. bozo       gradient     polygon      torus
  8940. break      granite      poly_wave    track
  8941. brick      gray_thresh  pot          transform
  8942. brick_size old          pow          translate
  8943. brightness green        ppm          transmit
  8944. brilliance height_fiel  precision    triangle
  8945. bumps      d            prism        triangle_w
  8946. bump_map   hexagon      pwr          ave
  8947. bump_size  hf_gray_16   quadratic_s  true
  8948. camera     hierarchy    pline        ttf
  8949. case       hollow       quadric      turbulence
  8950. caustics   hypercomple  quartic      turb_depth
  8951. ceil       x            quaternion   type
  8952. checker    if           quick_color  u
  8953. chr        ifdef        quick_colou  ultra_wide
  8954. clipped_by iff          r            _angle
  8955. clock      ifndef       quilted      undef
  8956. clock_delt image_map    radial       union
  8957. a          include      radians      up
  8958. color      int          radiosity    use_color
  8959. color_map  interior     radius       use_colour
  8960. colour     interpolate  rainbow      use_index
  8961. colour_map intersectio  ramp_wave    u_steps
  8962. component  n            rand         v
  8963. composite  intervals    range        val
  8964. concat     inverse      ratio        variance
  8965. cone       ior          read         vaxis_rota
  8966. confidence irid         reciprocal   te
  8967. conic_swee irid_wavele  recursion_l  vcross
  8968. p          ngth         imit         vdot
  8969. control0   jitter       red          version
  8970. control1   julia_fract  reflection   vlength
  8971. cos        al           reflection_  vnormalize
  8972. cosh       lambda       exponent     vrotate
  8973. count      lathe        refraction   v_steps
  8974. crackle    leopard      render       warning
  8975. crand      light_sourc  repeat       warp
  8976. cube       e            rgb          water_leve
  8977. cubic      linear_spli  rgbf         l
  8978. cubic_spli ne           rgbft        waves
  8979. ne         linear_swee  rgbt         while
  8980. cubic_wave p            right        width
  8981. cylinder   local        ripples      wood
  8982. cylindrica location     rotate       wrinkles
  8983. l          log          roughness    write
  8984. debug      looks_like   samples      x
  8985. declare    look_at      scale        y
  8986. default    low_error_f  scallop_wav  yes
  8987. defined    actor        e            z
  8988. degrees    macro        scattering
  8989. density    mandel       seed
  8990. density_fi map_type     shadowless
  8991. le         marble       sin
  8992. density_ma material     sine_wave
  8993. p          material_ma  sinh
  8994. dents      p            sky
  8995. difference matrix
  8996. diffuse    max
  8997. dimensions max_interse
  8998.            ctions
  8999.            max_iterati
  9000.            on
  9001.            max_trace_l
  9002.            evel
  9003.            media
  9004.            media_atten
  9005.            uation
  9006.            media_inter
  9007.            action
  9008. All reserved words are fully lower case. Therefore it is
  9009. recommended that your identifiers contain at least one upper case
  9010. character so it is sure to avoid conflict with reserved words.
  9011.  
  9012.  
  9013. 4.1.2     Comments
  9014. Comments are text in the scene file included to make the scene
  9015. file easier to read or understand. They are ignored by the ray-
  9016. tracer and are there for your information. There are two types of
  9017. comments in POV-Ray.
  9018.  
  9019. Two slashes are used for single line comments. Anything on a line
  9020. after a double slash (//) is ignored by the ray-tracer. For
  9021. example:
  9022.  
  9023.  // This line is ignored
  9024. You can have scene file information on the line in front of the
  9025. comment as in:
  9026.  
  9027.  object { FooBar } // this is an object
  9028. The other type of comment is used for multiple lines. It starts
  9029. with "/*" and ends with "*/". Everything in-between is ignored.
  9030. For example:
  9031.  
  9032.  /* These lines
  9033.    are ignored
  9034.    by the
  9035.    ray-tracer */
  9036. This can be useful if you want to temporarily remove elements
  9037. from a scene file. /* ... */ comments can comment out lines
  9038. containing other // comments and thus can be used to temporarily
  9039. or permanently comment out parts of a scene. /* ... */ comments
  9040. can be nested, the following is legal:
  9041.  
  9042.  /* This is a comment
  9043.  // This too
  9044.  /* This also */
  9045.  */
  9046. Use comments liberally and generously. Well used, they really
  9047. improve the readability of scene files.
  9048.  
  9049.  
  9050. 4.1.3     Float Expressions
  9051. Many parts of the POV-Ray language require you to specify one or
  9052. more floating point numbers. A floating point number is a number
  9053. with a decimal point. Floats may be specified using literals,
  9054. identifiers or functions which return float values. You may also
  9055. create very complex float expressions from combinations of any of
  9056. these using various familiar operators.
  9057.  
  9058. Where POV-Ray needs an integer value it allows you to specify a
  9059. float value and it truncates it to an integer. When POV-Ray needs
  9060. a logical or boolean value it interprets any non-zero float as
  9061. true and zero as false. Because float comparisons are subject to
  9062. rounding errors POV-Ray accepts values extremely close to zero as
  9063. being false when doing boolean functions. Typically values whose
  9064. absolute values are less than a preset value epsilon are
  9065. considered false for logical expressions. The value of epsilon is
  9066. system dependent but is generally about 1.0e-10. Two floats a and
  9067. b are considered to be equal if abs(a-b) < epsilon.
  9068.  
  9069. The full syntax for float expressions is given below.  Detailed
  9070. explanations are given in the following sub-sections.
  9071.  
  9072. FLOAT:
  9073.   NUMERIC_TERM  [SIGN  NUMERIC_TERM]
  9074. SIGN:
  9075.   +    |    -
  9076. NUMERIC_TERM:
  9077.   NUMERIC_FACTOR  [MULT  NUMERIC_FACTOR]
  9078. MULT:
  9079.   *    |    /
  9080. NUMERIC_FACTOR:
  9081.   FLOAT_LITERAL       |
  9082.   FLOAT_IDENTIFIER         |
  9083.   SIGN  NUMERIC_FACTOR     |
  9084.   FLOAT_FUNCTION      |
  9085.   FLOAT_BUILT-IN_IDENT     |
  9086.   ( FULL_EXPRESSION ) |
  9087.   !  NUMERIC_FACTOR   |
  9088.   VECTOR DECIMAL_POINT DOT_ITEM
  9089.   
  9090. FLOAT_LITERAL:
  9091.   [DIGIT...] [DECIMAL_POINT] DIGIT... [EXP [SIGN] DIGIT...]
  9092. DIGIT:
  9093.   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |
  9094.   8   |   9
  9095. DECIMAL_POINT:
  9096.   .
  9097. EXP:
  9098.   e   |   E
  9099. DOT_ITEM:
  9100.   x   |   y   |   z   |   t   |   u   |   v   |   red   |   blue
  9101.   |   green   |   filter   |   transmit
  9102. FLOAT_FUNCTION:
  9103.   abs( FLOAT )   |   acos( FLOAT )   |   val( STRING )   |
  9104.   asc( STRING )   |
  9105.   asin( FLOAT )   |   atan2( FLOAT , FLOAT )   |   ceil( FLOAT )
  9106.   |   cos( FLOAT )   |
  9107.   defined(IDENTIFIER )   |   degrees( FLOAT )   |   div( FLOAT ,
  9108.   FLOAT )   |   exp( FLOAT )   |
  9109.   file_exists( STRING )   |   floor( FLOAT )   |   int( FLOAT )
  9110.   |   log( FLOAT )   |
  9111.   max( FLOAT , FLOAT )   |   min( FLOAT , FLOAT )   |   mod(
  9112.   FLOAT , FLOAT )   |
  9113.   pow( FLOAT , FLOAT )   |   radians( FLOAT )   |   sin( FLOAT )
  9114.   |   sqrt( FLOAT )   |
  9115.   strcmp( STRING , STRING )   |   strlen( STRING )   |   tan(
  9116.   FLOAT )   |
  9117.   vdot( VECTOR , VECTOR )   |   vlength( VECTOR )   |   seed(
  9118.   FLOAT )   |   rand( FLOAT )   |
  9119.   dimensions( ARRAY_IDENTIFIER )   |   dimension_size(
  9120.   ARRAY_IDENTIFIER , FLOAT )
  9121. FLOAT_BUILT-IN_IDENT:
  9122.   clock   |   pi   |   version   |   true   |   yes   |   on   |
  9123.   false   |   no   |
  9124.   off   |   clock_delta
  9125. FULL_EXPRESSION:
  9126.   LOGICAL_EXPRESSION  [? FULL_EXPRESSION : FULL_EXPRESSION]
  9127. LOGICAL_EXPRESSION:
  9128.   REL_TERM  [LOGICAL_OPERATOR  REL_TERM]
  9129. LOGICAL_OPERATOR:
  9130.   &   |   |        (note this means an ampersand or a vertical
  9131.   bar is a logical operator)
  9132. REL_TERM:
  9133.   FLOAT  [REL_OPERATOR  FLOAT]
  9134. REL_OPERATOR:
  9135.   <   |   <=   |   =   |   >=   |   >   |   !=
  9136. INT:
  9137.   FLOAT     (note any syntax which requires a integer INT will
  9138.   accept a FLOAT and it will be truncated
  9139.             to an integer internally by POV-Ray).
  9140. Note: FLOAT_IDENTIFIERS are identifiers previously declared to
  9141. have float values.  The DOT_ITEM syntax is actually a vector or
  9142. color operator but it returns a float value.  See "Vector
  9143. Operators" or "Color Operators" for details.  An ARRAY_IDENTIFIER
  9144. is just the identifier name of a previously declared array, it
  9145. does not include the [] braces nor the index.  The syntax for
  9146. STRING is in the section "Strings".
  9147.  
  9148.  
  9149. 4.1.3.1   Float Literals
  9150. Float literals are represented by an optional sign ("+" or "-")
  9151. digits, an optional decimal point and more digits. If the number
  9152. is an integer you may omit the decimal point and trailing zero.
  9153. If it is all fractional you may omit the leading zero. POV-Ray
  9154. supports scientific notation for very large or very small
  9155. numbers. The following are all valid float literals:
  9156.  
  9157.  -2.0  -4  34  3.4e6  2e-5  .3  0.6
  9158.  
  9159. 4.1.3.2   Float Identifiers
  9160. Float identifiers may be declared to make scene files more
  9161. readable and to parameterize scenes so that changing a single
  9162. declaration changes many values. An identifier is declared as
  9163. follows.
  9164.  
  9165. FLOAT_DECLARATION:
  9166.   #declare IDENTIFIER = EXPRESSION;  |
  9167.   #local IDENTIFIER = EXPRESSION;
  9168. Where IDENTIFIER is the name of the identifier up to 40
  9169. characters long and EXPRESSION is any valid expression which
  9170. evaluates to a float value. Note that there should be a semi-
  9171. colon after the expression in a float declaration. This semi-
  9172. colon is new with POV-Ray version 3.1. If omitted, it generates a
  9173. warning and some macros may not work properly. See "#declare vs.
  9174. #local" for information on identifier scope.  Here are some
  9175. examples.
  9176.  
  9177.  #declare Count = 0;
  9178.  #declare Rows = 5.3;
  9179.  #declare Cols = 6.15;
  9180.  #declare Number = Rows*Cols;
  9181.  #declare Count = Count+1;
  9182. As the last example shows, you can re-declare a float identifier
  9183. and may use previously declared values in that re-declaration.
  9184. There are several built-in identifiers which POV-Ray declares for
  9185. you. See "Built-in Float Identifiers" for details.
  9186.  
  9187.  
  9188. 4.1.3.3   Float Operators
  9189. Arithmetic expressions: Basic math expressions can be created
  9190. from float literals, identifiers or functions using the following
  9191. operators in this order of precedence...
  9192. (  )      expressions in
  9193.           parentheses first
  9194. +A  -A    unary minus, unary plus
  9195. !A        and logical "not"
  9196. A*B A/B   multiplication and
  9197.           division
  9198. A+B A-B   addition and
  9199.           subtraction
  9200. Relational, logical and conditional expressions may also be
  9201. created. However there is a restriction that these types of
  9202. expressions must be enclosed in parentheses first. This
  9203. restriction, which is not imposed by most computer languages, is
  9204. necessary because POV-Ray allows mixing of float and vector
  9205. expressions. Without the parentheses there is an ambiguity
  9206. problem. Parentheses are not required for the unary logical not
  9207. operator "!" as shown above. The operators and their precedence
  9208. are shown here.
  9209.  
  9210. Relational expressions: The operands are arithmetic expressions
  9211. and the result is always boolean with 1 for true and 0 for false.
  9212. All relational operators have the same precedence.
  9213.  
  9214.  
  9215. (A < B)   A is less than B
  9216. (A <= B)  A is less than or equal to B
  9217. (A = B)   A is equal to B (actually abs(A-
  9218.           B)<EPSILON)
  9219. (A != B)  A is not equal to B (actually
  9220.           abs(A-B)>=EPSILON)
  9221. (A >= B)  A is greater than or equal to B
  9222. (A > B)   A is greater than B
  9223. Logical expressions: The operands are converted to boolean values
  9224. of 0 for false and 1 for true. The result is always boolean. All
  9225. logical operators have the same precedence. Note that these are
  9226. not bit-wise operations, they are logical.
  9227. (A & B)   true only if both A and B are
  9228.           true, false otherwise
  9229. (A | B)   true if either A or B or both
  9230.           are true
  9231. Conditional expressions: The operand C is boolean while operands
  9232. A and B are any expressions. The result is of the same type as A
  9233. and B.
  9234. (C ? A : B) if C then A else B
  9235. Assuming the various identifiers have been declared, the
  9236. following are examples of valid expressions...
  9237.  
  9238. 1+2+3    2*5     1/3     Row*3    Col*5
  9239. (Offset-5)/2      This/That+Other*Thing
  9240. ((This<That) & (Other>=Thing)?Foo:Bar)
  9241. Expressions are evaluated left to right with innermost
  9242. parentheses evaluated first, then unary +, - or !, then multiply
  9243. or divide, then add or subtract, then relational, then logical,
  9244. then conditional.
  9245.  
  9246.  
  9247. 4.1.3.4   Built-in Float Identifiers
  9248. There are several built-in float identifiers. You can use them to
  9249. specify values or to create expressions but you cannot re-declare
  9250. them to change their values.  They are:
  9251.  
  9252. FLOAT_BUILT-IN_IDENT:
  9253.   clock   |   pi   |   version   |   true   |   yes   |   on   |
  9254.   false   |   no   |
  9255.   off   |   clock_delta
  9256. Most built-in identifiers never change value. They are defined as
  9257. though the following lines were at the start of every scene.
  9258.  
  9259.  #declare pi = 3.1415926535897932384626;
  9260.  #declare true = 1;
  9261.  #declare yes = 1;
  9262.  #declare on = 1;
  9263.  #declare false = 0;
  9264.  #declare no = 0;
  9265.  #declare off = 0;
  9266. The built-in float identifier pi is obviously useful in math
  9267. expressions involving circles.  The built-in float identifiers
  9268. on, off, yes, no, true, and false are designed for use as boolean
  9269. constants.
  9270.  
  9271. The built-in float identifier clock is used to control animations
  9272. in POV-Ray. Unlike some animation packages, the action in POV-Ray
  9273. animated scenes does not depend upon the integer frame numbers.
  9274. Rather you should design your scenes based upon the float
  9275. identifier clock. For non-animated scenes its default value is 0
  9276. but you can set it to any float value using the INI file option
  9277. Clock=n.n or the command-line switch +Kn.n to pass a single float
  9278. value your scene file.
  9279.  
  9280. Other INI options and switches may be used to animate scenes by
  9281. automatically looping through the rendering of frames using
  9282. various values for clock. By default, the clock value is 0 for
  9283. the initial frame and 1 for the final frame. All other frames are
  9284. interpolated between these values. For example if your object is
  9285. supposed to rotate one full turn over the course of the animation
  9286. you could specify rotate 360*clock*y. Then as clock runs from 0
  9287. to 1, the object rotates about the y-axis from 0 to 360 degrees.
  9288.  
  9289. Although the value of clock will change from frame-to-frame, it
  9290. will never change throughout the parsing of a scene.
  9291.  
  9292. The built-in float identifier clock_delta returns the amount of
  9293. time between clock values in animations in POV-Ray. While most
  9294. animations only need the clock value itself, some animation
  9295. calculations are easier if you know how long since the last
  9296. frame. Caution must be used when designing such scenes. If you
  9297. render a scene with too few frames, the results may be different
  9298. than if you render with more frames in a given time period.  On
  9299. non-animated scenes, clock_delta defaults to 1.0.  See section
  9300. "Animation Options" for more details.
  9301.  
  9302. The built-in float identifier version contains the current
  9303. setting of the version compatibility option. Although this value
  9304. defaults to 3.1 which is the current POV-Ray version number, the
  9305. initial value of version may be set by the INI file option
  9306. Version=n.n or by the +MVn.n command-line switch. This tells POV-
  9307. Ray to parse the scene file using syntax from an earlier version
  9308. of POV-Ray.
  9309.  
  9310. The INI option or switch only affects the initial setting. Unlike
  9311. other built-in identifiers, you may change the value of version
  9312. throughout a scene file. You do not use #declare to change it
  9313. though. The #version language directive is used to change modes.
  9314. Such changes may occur several times within scene files.
  9315.  
  9316. Together with the built-in version identifier the #version
  9317. directive allows you to save and restore the previous values of
  9318. this compatibility setting. The new #local identifier option is
  9319. especially useful here. For example suppose mystuff.inc is in
  9320. version 1 format. At the top of the file you could put:
  9321.  
  9322.  #local Temp_Vers = version;  // Save previous value
  9323.  #version 1.0;         // Change to 1.0 mode
  9324.  ... // Version 1.0 stuff goes here...
  9325.  #version Temp_Vers;      // Restore previous version
  9326. Note that there should be a semi-colon after the float expression
  9327. in a #version directive. This semi-colon is new with POV-Ray
  9328. version 3.1. If omitted, it generates a warning and some macros
  9329. may not work properly.
  9330.  
  9331.  
  9332. 4.1.3.5   Boolean Keywords
  9333. The built-in float identifiers on, off, yes, no, true, and false
  9334. are most often used as boolean values with object modifiers or
  9335. parameters such as sturm, hollow, hierarchy, smooth,
  9336. media_attenuation, and media_interaction.  Whenever you see
  9337. syntax of the form keyword [Bool], if you simply specify the
  9338. keyword without the optional boolean then it assumes keyword on.
  9339. You need not use the boolean but for readability it is a good
  9340. idea.  You must use one of the false booleans or an expression
  9341. which evaluates to zero to turn it off.  Note some of these
  9342. keywords default on if no keyword is specified.  For example:
  9343.  
  9344.   object{MyBlob}  //sturm defaults off but hierarchy defaults on
  9345.   object{MyBlob sturm}      //turn sturm on
  9346.   object{MyBlob sturm on}   //turn sturm on
  9347.   object{MyBlob sturm off}  //turn sturm off
  9348.   object{MyBlob hierarchy}  //does nothing, hierarchy was already
  9349. on
  9350.   object{MyBlob hierarchy off}  //turn hierarchy off
  9351.  
  9352. 4.1.3.6   Float Functions
  9353. POV-Ray defines a variety of built-in functions for manipulating
  9354. floats, vectors and strings. Function calls consist of a keyword
  9355. which specifies the name of the function followed by a parameter
  9356. list enclosed in parentheses. Parameters are separated by commas.
  9357. For example:
  9358.  
  9359.  keyword(param1,param2)
  9360. The following are the functions which return float values. They
  9361. take one or more float, integer, vector, or string parameters.
  9362. Assume that A and B are any valid expression that evaluates to a
  9363. float; I is a float which is truncated to integer internally, S,
  9364. S1, S2 etc. are strings, and V, V1, V2 etc. are any vector
  9365. expressions.
  9366.  
  9367. abs(A)    Absolute value of A. If A is negative, returns -A
  9368. otherwise returns A.
  9369.  
  9370. acos(A)   Arc-cosine of A. Returns the angle, measured in
  9371. radians, whose cosine is A.
  9372.  
  9373. asc(S)    Returns an integer value in the range 0 to 255 that is
  9374. the ASCII value of the first character of the string S. For
  9375. example asc("ABC") is 65 because that is the value of the
  9376. character "A".
  9377.  
  9378. asin(A)   Arc-sine of A. Returns the angle, measured in radians,
  9379. whose sine is A.
  9380.  
  9381. atan2(A,B)     Arc-tangent of (A/B). Returns the angle, measured
  9382. in radians, whose tangent is (A/B). Returns appropriate value
  9383. even if B is zero. Use atan2(A,1) to compute usual atan(A)
  9384. function.
  9385.  
  9386. ceil(A)   Ceiling of A. Returns the smallest integer greater than
  9387. A. Rounds up to the next higher integer.
  9388.  
  9389. cos(A)    Cosine of A. Returns the cosine of the angle A, where A
  9390. is measured in radians.
  9391.  
  9392. defined(IDENTIFIER )     Returns true if the identifier is
  9393. currently defined, false otherwise.  This is especially useful
  9394. for detecting end-of-file after a #read directive because the
  9395. file identifer is automatically undefined when end-of-file is
  9396. reached.  See "The #read Directive" for details.
  9397.  
  9398. degrees(A)     Convert radians to degrees. Returns the angle
  9399. measured in degrees whose value in radians is A. Formula is
  9400. degrees=A/pi*180.0.
  9401.  
  9402. dimensions( ARRAY_IDENTIFIER )     Returns the number of
  9403. dimensions of a previously declared array identifier.  For
  9404. example if you do #declare MyArray=array[6][10] then
  9405. dimensions(MyArray) returns the value 2.
  9406.  
  9407. dimension_size( ARRAY_IDENTIFIER, FLOAT )    Returns the size of
  9408. a given dimension of a previously declared array identifier.
  9409. Dimensions are numbered left-to-right starting with 1. For
  9410. example if you do #declare MyArray=array[6][10] then
  9411. dimension_size(MyArray,2) returns the value 10.
  9412.  
  9413. div(A,B)  Integer division. The integer part of (A/B).
  9414.  
  9415. exp(A)    Exponential of A. Returns the value of e raised to the
  9416. power A where e is the base of the natural logarithm, i.e. the
  9417. non-repeating value approximately equal to 2.71828182846.
  9418.  
  9419. file_exists(S) Attempts to open the file specified by the string
  9420. S. The current directory and all library directories specified by
  9421. the Library_Path or +L options are also searched.  See "Library
  9422. Paths" for details.  Returns 1 if successful and 0 if
  9423. unsuccessful.
  9424.  
  9425. floor(A)  Floor of A. Returns the largest integer less than A.
  9426. Rounds down to the next lower integer.
  9427.  
  9428. int(A)    Integer part of A. Returns the truncated integer part
  9429. of A. Rounds towards zero.
  9430.  
  9431. log(A)    Natural logarithm of A. Returns the natural logarithm
  9432. base e of the value A.
  9433.  
  9434. max(A,B)  Maximum of A and B. Returns A if A larger than B.
  9435. Otherwise returns B.
  9436.  
  9437. min(A,B)  Minimum of A and B. Returns A if A smaller than B.
  9438. Otherwise returns B.
  9439.  
  9440. mod(A,B)  Value of A modulo B. Returns the remainder after the
  9441. integer division of A/B. Formula is mod=((A/B)-int(A/B))*B.
  9442.  
  9443. pow(A,B)  Exponentiation. Returns the value of A raised to the
  9444. power B.
  9445.  
  9446. radians(A)     Convert degrees to radians. Returns the angle
  9447. measured in radians whose value in degrees is A. Formula is
  9448. radians=A*pi/180.0.
  9449.  
  9450. rand(I)   Returns the next pseudo-random number from the stream
  9451. specified by the positive integer I. You must call seed() to
  9452. initialize a random stream before calling rand(). The numbers are
  9453. uniformly distributed, and have values between 0.0 and 1.0,
  9454. inclusively. The numbers generated by separate streams are
  9455. independent random variables.
  9456.  
  9457. seed(A)   Initializes a new pseudo-random stream with the initial
  9458. seed value A. The number corresponding to this random stream is
  9459. returned. Any number of pseudo-random streams may be used as
  9460. shown in the example below:
  9461.  
  9462.  #declare R1 = seed(0);
  9463.  #declare R2 = seed(12345);
  9464.  #sphere { <rand(R1), rand(R1), rand(R1)>, rand(R2) }
  9465. Multiple random generators are very useful in situations where
  9466. you use rand() to place a group of objects, and then decide to
  9467. use rand() in another location earlier in the file to set some
  9468. colors or place another group of objects. Without separate rand()
  9469. streams, all of your objects would move when you added more calls
  9470. to rand(). This is very annoying.
  9471.  
  9472. sin(A)    Sine of A. Returns the sine of the angle A, where A is
  9473. measured in radians.
  9474.  
  9475. strcmp(S1,S2)  Compare string S1 to S2. Returns a float value
  9476. zero if the strings are equal, a positive number if S1 comes
  9477. after S2 in the ASCII collating sequence, else a negative number.
  9478.  
  9479. strlen(S) Length of S. Returns an integer value that is the
  9480. number of characters in the string S.
  9481.  
  9482. sqrt(A)   Square root of A. Returns the value whose square is A.
  9483.  
  9484. tan(A)    Tangent of A. Returns the tangent of the angle A, where
  9485. A is measured in radians.
  9486.  
  9487. val(S)    Convert string S to float. Returns a float value that
  9488. is represented by the text in string S. For example val("123.45")
  9489. is 123.45 as a float.
  9490.  
  9491. vdot(V1,V2)    Dot product of V1 and V2. Returns a float value
  9492. that is the dot product (sometimes called scalar product of V1
  9493. with V2. Formula is vdot=V1.x*V2.x + V1.y*V2.y + V1.z*V2.z. See
  9494. the animated demo scene VECT2.POV for an illustration.
  9495.  
  9496. vlength(V)     Length of V. Returns a float value that is the
  9497. length of vector V. Formula is vlength=sqrt(vdot(A,A)).  Can be
  9498. used to compute the distance between two points. Dist=vlength(V2-
  9499. V1).
  9500.  
  9501. See section "Vector Functions" and section "String Functions" for
  9502. other functions which are somewhat float-related but which return
  9503. vectors and strings.  In addition to the above built-in
  9504. functions, you may also define your own functions using the new
  9505. #macro directive. See the section "User Defined Macros" for more
  9506. details.
  9507.  
  9508.  
  9509. 4.1.4     Vector Expressions
  9510. POV-Ray often requires you to specify a vector. A vector is a set
  9511. of related float values. Vectors may be specified using literals,
  9512. identifiers or functions which return vector values. You may also
  9513. create very complex vector expressions from combinations of any
  9514. of these using various familiar operators.
  9515.  
  9516. POV-Ray vectors may have from two to five components but the vast
  9517. majority of vectors have three components. Unless specified
  9518. otherwise, you should assume that the word "vector" means a three
  9519. component vector. POV-Ray operates in a 3D x, y, z coordinate
  9520. system and you will use three component vectors to specify x, y
  9521. and z values. In some places POV-Ray needs only two coordinates.
  9522. These are often specified by a 2D vector called an UV vector.
  9523. Fractal objects use 4D vectors. Color expressions use 5D vectors
  9524. but allow you to specify 3, 4 or 5 components and use default
  9525. values for the unspecified components. Unless otherwise noted,
  9526. all 2, 4 or 5 component vectors work just like 3D vectors but
  9527. they have a different number of components.
  9528.  
  9529. The syntax for combining vector literals into vector expressions
  9530. is almost identical to the rules for float expressions.  In the
  9531. syntax for vector expressions below, some of the syntax items are
  9532. defined in the section for float expressions.  See "Float
  9533. Expressions" for those definitions.  Detailed explanations of
  9534. vector-specific issues are given in the following sub-sections.
  9535.  
  9536. VECTOR:
  9537.   NUMERIC_TERM  [SIGN  NUMERIC_TERM]
  9538. NUMERIC_TERM:
  9539.   NUMERIC_FACTOR  [MULT  NUMERIC_FACTOR]
  9540. NUMERIC_FACTOR:
  9541.   VECTOR_LITERAL      |
  9542.   VECTOR_IDENTIFIER   |
  9543.   SIGN  NUMERIC_FACTOR     |
  9544.   VECTOR_FUNCTION     |
  9545.   VECTOR_BUILT-IN_IDENT    |
  9546.   ( FULL_EXPRESSION ) |
  9547.   !  NUMERIC_FACTOR   |
  9548.   FLOAT
  9549. VECTOR_LITERAL:
  9550.   < FLOAT , FLOAT , FLOAT >
  9551. VECTOR_FUNCTION:
  9552.   vaxis_rotate( VECTOR , VECTOR , FLOAT )   |
  9553.   vcross( VECTOR , VECTOR )   |
  9554.   vrotate( VECTOR , VECTOR )   |
  9555.   vnormalize( VECTOR )
  9556. VECTOR_BUILT-IN_IDENT:
  9557.   x   |   y   |   z   |   t   |   u   |   v
  9558. Note: VECTOR_IDENTIFIERS are identifiers previously declared to
  9559. have vector values.
  9560.  
  9561.  
  9562. 4.1.4.1   Vector Literals
  9563. Vectors literals consist of two to five float expressions that
  9564. are bracketed by angle brackets < and >. The terms are separated
  9565. by commas. For example here is a typical three component vector:
  9566.  
  9567.  < 1.0, 3.2, -5.4578 >
  9568. The commas between components are necessary to keep the program
  9569. from thinking that the 2nd term is the single float expression
  9570. 3.2-5.4578 and that there is no 3rd term. If you see an error
  9571. message such as "Float expected but '>' found instead" then you
  9572. probably have missed a comma.
  9573.  
  9574. Sometimes POV-Ray requires you to specify floats and vectors side-
  9575. by-side. The rules for vector expressions allow for mixing of
  9576. vectors with vectors or vectors with floats so commas are
  9577. required separators whenever an ambiguity might arise. For
  9578. example <1,2,3>-4 evaluates as a mixed float and vector
  9579. expression where 4 is subtracted from each component resulting in
  9580. <-3,-2,-1>. However the comma in <1,2,3>,-4 means this is a
  9581. vector followed by a float.
  9582.  
  9583. Each component may be a full float expression. For example
  9584. <This+3,That/3,5*Other_Thing> is a valid vector.
  9585.  
  9586.  
  9587. 4.1.4.2   Vector Identifiers
  9588. Vector identifiers may be declared to make scene files more
  9589. readable and to parameterize scenes so that changing a single
  9590. declaration changes many values. An identifier is declared as
  9591. follows.
  9592.  
  9593. VECTOR_DECLARATION:
  9594.   #declare IDENTIFIER = EXPRESSION;  |
  9595.   #local IDENTIFIER = EXPRESSION;
  9596. Where IDENTIFIER is the name of the identifier up to 40
  9597. characters long and EXPRESSION is any valid expression which
  9598. evaluates to a vector value. Note that there should be a semi-
  9599. colon after the expression in a vector declaration. This semi-
  9600. colon is new with POV-Ray version 3.1. If omitted, it generates a
  9601. warning and some macros may not work properly. See "#declare vs.
  9602. #local" for information on identifier scope.  Here are some
  9603. examples....
  9604.  
  9605.  #declare Here = <1,2,3>;
  9606.  #declare There = <3,4,5>;
  9607.  #declare Jump = <Foo*2,Bar-1,Bob/3>;
  9608.  #declare Route = There-Here;
  9609.  #declare Jump = Jump+<1,2,3>;
  9610. Note that you invoke a vector identifier by using its name
  9611. without any angle brackets. As the last example shows, you can re-
  9612. declare a vector identifier and may use previously declared
  9613. values in that re-declaration. There are several built-in
  9614. identifiers which POV-Ray declares for you. See section "Built-in
  9615. Vector Identifiers" for details.
  9616.  
  9617.  
  9618. 4.1.4.3   Vector Operators
  9619. Vector literals, identifiers and functions may also be combined
  9620. in expressions the same as float values. Operations are performed
  9621. on a component-by-component basis. For example <1,2,3> + <4,5,6>
  9622. evaluates the same as <1+4,2+5,3+6> or <5,7,9>. Other operations
  9623. are done on a similar component-by-component basis. For example
  9624. (<1,2,3> = <3,2,1>) evaluates to <0,1,0> because the middle
  9625. components are equal but the others are not. Admittedly this
  9626. isn't very useful but its consistent with other vector
  9627. operations.
  9628.  
  9629. Conditional expressions such as (C ? A : B) require that C is a
  9630. float expression but A and B may be vector expressions. The
  9631. result is that the entire conditional evaluates as a valid
  9632. vector. For example if Foo and Bar are floats then (Foo < Bar ?
  9633. <1,2,3> : <5,6,7>) evaluates as the vector <1,2,3> if Foo is less
  9634. than Bar and evaluates as <5,6,7> otherwise.
  9635.  
  9636. You may use the dot operator to extract a single float component
  9637. from a vector. Suppose the identifier Spot was previously defined
  9638. as a vector. Then Spot.x is a float value that is the first
  9639. component of this x, y, z vector. Similarly Spot.y and Spot.z
  9640. reference the 2nd and 3rd components. If Spot was a two component
  9641. UV vector you could use Spot.u and Spot.v to extract the first
  9642. and second component. For a 4D vector use .x, .y, .z, and .t to
  9643. extract each float component. The dot operator is also used in
  9644. color expressions which are covered later.
  9645.  
  9646.  
  9647. 4.1.4.4   Operator Promotion
  9648. You may use a lone float expression to define a vector whose
  9649. components are all the same. POV-Ray knows when it needs a vector
  9650. of a particular type and will promote a float into a vector if
  9651. need be. For example the POV-Ray scale statement requires a three
  9652. component vector. If you specify scale 5 then POV-Ray interprets
  9653. this as scale <5,5,5> which means you want to scale by 5 in every
  9654. direction.
  9655.  
  9656. Versions of POV-Ray prior to 3.0 only allowed such use of a float
  9657. as a vector in various limited places such as scale and
  9658. turbulence. However you may now use this trick anywhere. For
  9659. example...
  9660.  
  9661.  box{0,1}  // Same as box{<0,0,0>,<1,1,1>}
  9662.  sphere{0,1} // Same as sphere{<0,0,0>,1}
  9663. When promoting a float into a vector of 2, 3, 4 or 5 components,
  9664. all components are set to the float value, however when promoting
  9665. a vector of a lower number of components into a higher order
  9666. vector, all remaining components are set to zero. For example if
  9667. POV-Ray expects a 4D vector and you specify 9 the result is
  9668. <9,9,9,9> but if you specify <7,6> the result is <7,6,0,0>.
  9669.  
  9670.  
  9671. 4.1.4.5   Built-in Vector Identifiers
  9672. There are several built-in vector identifiers. You can use them
  9673. to specify values or to create expressions but you cannot re-
  9674. declare them to change their values.  They are:
  9675.  
  9676. VECTOR_BUILT-IN_IDENT:
  9677.   x   |   y   |   z   |   t   |   u   |   v
  9678. All built-in vector identifiers never change value. They are
  9679. defined as though the following lines were at the start of every
  9680. scene.
  9681.  
  9682.  #declare x = <1, 0, 0>;
  9683.  #declare y = <0, 1, 0>;
  9684.  #declare z = <0, 0, 1>;
  9685.  #declare t = <0, 0, 0, 1>;
  9686.  #declare u = <1, 0>;
  9687.  #declare v = <0, 1>;
  9688. The built-in vector identifiers x, y, and z provide much greater
  9689. readability for your scene files when used in vector expressions.
  9690. For example....
  9691.  
  9692.  plane { y, 1}    // The normal vector is obviously "y".
  9693.  plane { <0,1,0>, 1} // This is harder to read.
  9694.  translate 5*x    // Move 5 units in the "x" direction.
  9695.  translate <5,0,0>  // This is less obvious.
  9696. An expression like 5*x evaluates to 5*<1,0,0> or <5,0,0>.
  9697.  
  9698. Similarly u and v may be used in 2D vectors. When using 4D
  9699. vectors you should use x, y, z, and t and POV-Ray will promote x,
  9700. y, and z to 4D when used where 4D is required.
  9701.  
  9702.  
  9703. 4.1.4.6   Vector Functions
  9704. POV-Ray defines a variety of built-in functions for manipulating
  9705. floats, vectors and strings. Function calls consist of a keyword
  9706. which specifies the name of the function followed by a parameter
  9707. list enclosed in parentheses. Parameters are separated by commas.
  9708. For example:
  9709.  
  9710.  keyword(param1,param2)
  9711. The following are the functions which return vector values. They
  9712. take one or more float, integer, vector, or string parameters.
  9713. Assume that A and B are any valid expression that evaluates to a
  9714. vector; and F is any float expression.
  9715.  
  9716. vaxis_rotate(A,B,F) Rotate A about B by F. Given the x,y,z
  9717. coordinates of a point in space designated by the vector A,
  9718. rotate that point about an arbitrary axis defined by the vector
  9719. B. Rotate it through an angle specified in degrees by the float
  9720. value F. The result is a vector containing the new x,y,z
  9721. coordinates of the point.
  9722.  
  9723. vcross(A,B)    Cross product of A and B. Returns a vector that is
  9724. the vector cross product of the two vectors. The resulting vector
  9725. is perpendicular to the two original vectors and its length is
  9726. proportional to the angle between them. See the animated demo
  9727. scene VECT2.POV for an illustration.
  9728.  
  9729. vnormalize(A)  Normalize vector A. Returns a unit length vector
  9730. that is the same direction as A. Formula is
  9731. vnormalize=A/vlength(A).
  9732.  
  9733. vrotate(A,B)   Rotate A about origin by B. Given the x,y,z
  9734. coordinates of a point in space designated by the vector A,
  9735. rotate that point about the origin by an amount specified by the
  9736. vector B. Rotate it about the x-axis by an angle specified in
  9737. degrees by the float value B.x. Similarly B.y and B.z specify the
  9738. amount to rotate in degrees about the y-axis and z-axis. The
  9739. result is a vector containing the new x,y,z coordinates of the
  9740. point.
  9741.  
  9742. See section "Float Functions" for other functions which are
  9743. somewhat vector-related but which return floats.  In addition to
  9744. the above built-in functions, you may also define your own
  9745. functions using the new #macro directive. See the section "User
  9746. Defined Macros" for more details.
  9747.  
  9748.  
  9749. 4.1.5     Specifying Colors
  9750. POV-Ray often requires you to specify a color. Colors consist of
  9751. five values or color components. The first three are called red,
  9752. green, and blue. They specify the intensity of the primary colors
  9753. red, green and blue using an additive color system like the one
  9754. used by the red, green and blue color phosphors on a color
  9755. monitor.
  9756.  
  9757. The 4th component, called filter, specifies the amount of
  9758. filtered transparency of a substance. Some real-world examples of
  9759. filtered transparency are stained glass windows or tinted
  9760. cellophane. The light passing through such objects is tinted by
  9761. the appropriate color as the material selectively absorbs some
  9762. frequencies of light while allowing others to pass through. The
  9763. color of the object is subtracted from the light passing through
  9764. so this is called subtractive transparency.
  9765.  
  9766. The 5th component, called transmit, specifies the amount of non-
  9767. filtered light that is transmitted through a surface. Some real-
  9768. world examples of non-filtered transparency are thin see-through
  9769. cloth, fine mesh netting and dust on a surface. In these
  9770. examples, all frequencies of light are allowed to pass through
  9771. tiny holes in the surface. Although the amount of light passing
  9772. through is diminished, the color of the light passing through is
  9773. unchanged. The color of the object is added to the light passing
  9774. through so this is called additive transparency.
  9775.  
  9776. Note that early versions of POV-Ray used the keyword alpha to
  9777. specify filtered transparency. However that word is often used to
  9778. describe non-filtered transparency. For this reason alpha is no
  9779. longer used.
  9780.  
  9781. Each of the five components of a color are float values which are
  9782. normally in the range between 0.0 and 1.0. However any values,
  9783. even negatives may be used.
  9784.  
  9785. Under most circumstances the keyword color is optional and may be
  9786. omitted. We also support the British or Canadian spelling colour.
  9787. Colors may be specified using vectors, keywords with floats or
  9788. identifiers. You may also create very complex color expressions
  9789. from combinations of any of these using various familiar
  9790. operators. The syntax for specifying a color has evolved since
  9791. POV-Ray was first released. We have maintained the original
  9792. keyword-based syntax and added a short-cut vector notation.
  9793. Either the old or new syntax is acceptable however the vector
  9794. syntax is easier to use when creating color expressions.
  9795.  
  9796. The syntax for combining color literals into color expressions is
  9797. almost identical to the rules for vector and float expressions.
  9798. In the syntax for vector expressions below, some of the syntax
  9799. items are defined in the section for float expressions.  See
  9800. "Float Expressions" for those definitions.  Detailed explanations
  9801. of color-specific issues are given in the following sub-sections.
  9802.  
  9803. COLOR:
  9804.   COLOR_BODY               |
  9805.   color COLOR_BODY         |    (this means the keyword color or
  9806.   colour may
  9807.   colour COLOR_BODY               optionally precede any color
  9808.   specification)
  9809. COLOR_BODY:
  9810.   COLOR_VECTOR             |
  9811.   COLOR_KEYWORD_GROUP      |
  9812.   COLOR_IDENTIFIER
  9813. COLOR_VECTOR:
  9814.   rgb <3_Term_Vector>      |
  9815.   rgbf <4_Term_Vector>          |
  9816.   rgbt <4_Term_Vector>          |
  9817.   [ rgbft ] <5_Term_Vector>
  9818. COLOR_KEYWORD_GROUP:
  9819.   [ COLOR_KEYWORD_ITEM ]...
  9820. COLOR_KEYWORD_ITEM:
  9821.   COLOR_IDENTIFIER         |
  9822.   red Red_Amount   |   blue Blue_Amount   |   green Green_Amount
  9823.   |
  9824.   filter Filter_Amount   |   transmit Transmit_Amount
  9825. Note: COLOR_IDENTIFIERS are identifiers previously declared to
  9826. have color values.  The 3, 4, and 5 term vectors are usually
  9827. vector literals but may be vector expressions or floats promoted
  9828. to vectors.  See "Operator Promotion" and the sections below.
  9829.  
  9830.  
  9831. 4.1.5.1   Color Vectors
  9832. The syntax for a color vector is...
  9833.  
  9834. COLOR_VECTOR:
  9835.   rgb <3_Term_Vector>      |
  9836.   rgbf <4_Term_Vector>          |
  9837.   rgbt <4_Term_Vector>          |
  9838.   [ rgbft ] <5_Term_Vector>
  9839. ...where the vectors are any valid vector expressions of 3, 4 or
  9840. 5 components. For example
  9841.  
  9842.  color rgb <1.0, 0.5, 0.2>
  9843. This specifies a color whose red component is 1.0 or 100% of full
  9844. intensity. The green component is 0.5 or 50% of full intensity
  9845. and the blue component is 0.2 or 20% of full intensity. Although
  9846. the filter and transmit components are not explicitly specified,
  9847. they exist and are set to their default values of 0 or no
  9848. transparency.
  9849.  
  9850. The rgbf keyword requires a four component vector. The 4th
  9851. component is the filter component and the transmit component
  9852. defaults to zero. Similarly the rgbt keyword requires four
  9853. components where the 4th value is moved to the 5th component
  9854. which is transmit and then the filter component is set to zero.
  9855.  
  9856. The rgbft keyword allows you to specify all five components.
  9857. Internally in expressions all five are always used.
  9858.  
  9859. Under some circumstances, if the vector expression is a 5
  9860. component expression or there is a color identifier in the
  9861. expression then the rgbtf keyword is optional.
  9862.  
  9863.  
  9864. 4.1.5.2   Color Keywords
  9865. The older keyword method of specifying a color is still useful
  9866. and many users prefer it.
  9867.  
  9868. COLOR_KEYWORD_GROUP:
  9869.   [ COLOR_KEYWORD_ITEM ]...
  9870. COLOR_KEYWORD_ITEM:
  9871.   COLOR_IDENTIFIER         |
  9872.   red Red_Amount   |   blue Blue_Amount   |   green Green_Amount
  9873.   |
  9874.   filter Filter_Amount   |   transmit Transmit_Amount
  9875. Although the color keyword at the beginning is optional, it is
  9876. more common to see it in this usage. This is followed by any of
  9877. five additional keywords red, green, blue, filter, or transmit.
  9878. Each of these component keywords is followed by a float
  9879. expression. For example
  9880.  
  9881.  color red 1.0 green 0.5
  9882. This specifies a color whose red component is 1.0 or 100% of full
  9883. intensity and the green component is 0.5 or 50% of full
  9884. intensity. Although the blue, filter and transmit components are
  9885. not explicitly specified, they exist and are set to their default
  9886. values of 0. The component keywords may be given in any order and
  9887. if any component is unspecified its value defaults to zero.  A
  9888. COLOR_IDENTIFIER can also be specified but it should always be
  9889. first in the group.  See "Common Color Pitfalls" for details.
  9890.  
  9891.  
  9892. 4.1.5.3   Color Identifiers
  9893. Color identifiers may be declared to make scene files more
  9894. readable and to parameterize scenes so that changing a single
  9895. declaration changes many values. An identifier is declared as
  9896. follows.
  9897.  
  9898. COLOR_DECLARATION:
  9899.   #declare IDENTIFIER = COLOR;  |
  9900.   #local IDENTIFIER = COLOR;
  9901. Where IDENTIFIER is the name of the identifier up to 40
  9902. characters long and COLOR is any valid specification. Note that
  9903. there should be a semi-colon at the end of the declaration. This
  9904. semi-colon is new with POV-Ray version 3.1. If omitted, it
  9905. generates a warning and some macros may not work properly. See
  9906. "#declare vs. #local" for information on identifier scope.  Here
  9907. are some examples....
  9908.  
  9909.  #declare White = rgb <1,1,1>;
  9910.  #declare Cyan = color blue 1.0 green 1.0;
  9911.  #declare Weird = rgb <Foo*2,Bar-1,Bob/3>;
  9912.  #declare LightGray = White*0.8;
  9913.  #declare LightCyan = Cyan red 0.6;
  9914. As the LightGray example shows you do not need any color keywords
  9915. when creating color expressions based on previously declared
  9916. colors. The last example shows you may use a color identifier
  9917. with the keyword style syntax. Make sure that the identifier
  9918. comes first before any other component keywords.
  9919.  
  9920. Like floats and vectors, you may re-define colors throughout a
  9921. scene but the need to do so is rare.
  9922.  
  9923.  
  9924. 4.1.5.4   Color Operators
  9925. Color vectors may be combined in expressions the same as float or
  9926. vector values. Operations are performed on a component-by-
  9927. component basis. For example rgb <1.0,0.5,0.2>*0.9 evaluates the
  9928. same as rgb<1.0,0.5,0.2>*<0.9,0.9,0.9> or rgb<0.9,0.45,0.18>.
  9929. Other operations are done on a similar component-by-component
  9930. basis.
  9931.  
  9932. You may use the dot operator to extract a single component from a
  9933. color. Suppose the identifier Shade was previously defined as a
  9934. color. Then Shade.red is the float value of the red component of
  9935. Shade. Similarly Shade.green, Shade.blue, Shade.filter and
  9936. Shade.transmit extract the float value of the other color
  9937. components.
  9938.  
  9939.  
  9940. 4.1.5.5   Common Color Pitfalls
  9941. The variety and complexity of color specification methods can
  9942. lead to some common mistakes. Here are some things to consider
  9943. when specifying a color.
  9944.  
  9945. When using filter transparency, the colors which come through are
  9946. multiplied by the primary color components. For example if gray
  9947. light such as rgb<0.9,0.9,0.9> passes through a filter such as
  9948. rgbf<1.0,0.5,0.0,1.0> the result is rgb<0.9,0.45,0.0> with the
  9949. red let through 100%, the green cut in half from 0.9 to 0.45 and
  9950. the blue totally blocked. Often users mistakenly specify a clear
  9951. object by
  9952.  
  9953.  color filter 1.0
  9954. but this has implied red, green and blue values of zero. You've
  9955. just specified a totally black filter so no light passes through.
  9956. The correct way is either
  9957.  
  9958.  color red 1.0  green 1.0  blue 1.0  filter 1.0
  9959. or
  9960.  
  9961.  color transmit 1.0
  9962. In the 2nd example it doesn't matter what the rgb values are. All
  9963. of the light passes through untouched.
  9964.  
  9965. Another pitfall is the use of color identifiers and expressions
  9966. with color keywords. For example...
  9967.  
  9968.  color My_Color red 0.5
  9969. this substitutes whatever was the red component of My_Color with
  9970. a red component of 0.5 however...
  9971.  
  9972.  color My_Color + red 0.5
  9973. adds 0.5 to the red component of My_Color and even less
  9974. obvious...
  9975.  
  9976.  color My_Color * red 0.5
  9977. that cuts the red component in half as you would expect but it
  9978. also multiplies the green, blue, filter and transmit components
  9979. by zero! The part of the expression after the multiply operator
  9980. evaluates to rgbft<0.5,0,0,0,0> as a full 5 component color.
  9981.  
  9982. The following example results in no change to My_Color.
  9983.  
  9984.  color red 0.5 My_Color
  9985. This is because the identifier fully overwrites the previous
  9986. value. When using identifiers with color keywords, the identifier
  9987. should be first.
  9988.  
  9989. Another issue to consider: some POV-Ray syntax allows full color
  9990. specifications but only uses the rgb part. In these cases it is
  9991. legal to use a float where a color is needed. For example:
  9992.  
  9993.  finish { ambient 1 }
  9994. The ambient keyword expects a color so the value 1 is promoted to
  9995. <1,1,1,1,1> which is no problem. However
  9996.  
  9997.  pigment { color 0.4 }
  9998. is legal but it may or may not be what you intended. The 0.4 is
  9999. promoted to <0.4,0.4,0.4,0.4,0.4> with the filter and transmit
  10000. set to 0.4 as well. It is more likely you wanted...
  10001.  
  10002.  pigment { color rgb 0.4 }
  10003. in which case a 3 component vector is expected. Therefore the 0.4
  10004. is promoted to <0.4,0.4,0.4,0.0,0.0> with default zero for filter
  10005. and transmit.
  10006.  
  10007. Finally there is another problem which arises when using color
  10008. dot operators in #declare or #local directives.  Consider the
  10009. directive:
  10010.  
  10011.  #declare MyColor = rgb <0.75, 0.5, 0.75>;
  10012.  #declare RedAmt = MyColor.red;
  10013. Now RedAmt should be a float but unfortunately it is a color.
  10014. POV-Ray looks at the first keyword after the equals to try to
  10015. guess what type of identifier you want.  It sees the color
  10016. identifier MyColor and assumes you want to declare a color.  It
  10017. then computes the float value as 0.75 then promotes that into
  10018. rgbft<0.75,0.75,0.75,0.75,0.75>.
  10019.  
  10020. It would take a major rewrite to fix this problem so we're just
  10021. warning you about it.  Any of the following work-arounds will
  10022. work properly.
  10023.  
  10024.  #declare RedAmt = 0.0+MyColor.red;
  10025.  #declare RedAmt = 1.0*MyColor.red;
  10026.  #declare RedAmt = (MyColor.red);
  10027.  
  10028. 4.1.6     Strings
  10029. The POV-Ray language requires you to specify a string of
  10030. characters to be used as a file name, text for messages or text
  10031. for a text object. Strings may be specified using literals,
  10032. identifiers or functions which return string values. See "String
  10033. Functions" for details on string functions.  Although you cannot
  10034. build string expressions from symbolic operators such as are used
  10035. with floats, vectors or colors, you may perform various string
  10036. operations using string functions. Some applications of strings
  10037. in POV-Ray allow for non-printing formatting characters such as
  10038. newline or form-feed.
  10039.  
  10040. STRING:
  10041.   STRING_FUNCTION          |
  10042.   STRING_IDENTIFIER   |
  10043.   STRING_LITERAL
  10044. STRING_LITERAL:
  10045.   "up to 256 ASCII characters"
  10046. STRING_FUNCTION:
  10047.   str( FLOAT , INT , INT )   |   concat( STRING , STRING ,
  10048.   [STRING ,...])   |   chr( INT )   |
  10049.   substr( STRING , INT , INT )   |   strupr( STRING )   |
  10050.   strlwr( STRING )
  10051.  
  10052. 4.1.6.1   String Literals
  10053. String literals begin with a double quote mark '"' which is
  10054. followed by up to 256 printable ASCII characters and are
  10055. terminated by another double quote mark. The following are all
  10056. valid string literals:
  10057.  
  10058.  "Here"  "There"  "myfile.gif"  "textures.inc"
  10059. Note if you need to specify a quote mark in a string literal you
  10060. must precede it with a backslash. For example
  10061.  
  10062.  "Joe said \"Hello\" as he walked in."
  10063. is converted to
  10064.  
  10065.  Joe said "Hello" as he walked in.
  10066. If you need to specify a backslash, most of the time you need do
  10067. nothing special. However if the string ends in a backslash, you
  10068. will have to specify two. For example:
  10069.  
  10070.  "This is a backslash \ and so is this\\"
  10071. Is converted to:
  10072.  
  10073.  This is a backslash \ and so is this\
  10074. The substitution of \" with a " occurs in all POV-Ray string
  10075. literals regardless usage however other formatting codes such as
  10076. \n for new line are only supported in user message streams. See
  10077. "Text Formatting" for details.
  10078.  
  10079.  
  10080. 4.1.6.2   String Identifiers
  10081. String identifiers may be declared to make scene files more
  10082. readable and to parameterize scenes so that changing a single
  10083. declaration changes many values. An identifier is declared as
  10084. follows.
  10085.  
  10086. STRING_DECLARATION:
  10087.   #declare IDENTIFIER = STRING  |
  10088.   #local IDENTIFIER = STRING
  10089. Where IDENTIFIER is the name of the identifier up to 40
  10090. characters long and STRING is any valid string specification.
  10091. Note that unlike floats, vectors, or colors, there need not be a
  10092. semi-colon at the end of the declaration. See "#declare vs.
  10093. #local" for information on identifier scope.  Here are some
  10094. examples...
  10095.  
  10096.  #declare Font_Name = "ariel.ttf"
  10097.  #declare Inc_File = "myfile.inc"
  10098.  #declare Name = "John"
  10099.  #declare Name = concat(Name," Doe")
  10100. As the last example shows, you can re-declare a string identifier
  10101. and may use previously declared values in that re-declaration.
  10102.  
  10103.  
  10104. 4.1.6.3   String Functions
  10105. POV-Ray defines a variety of built-in functions for manipulating
  10106. floats, vectors and strings. Function calls consist of a keyword
  10107. which specifies the name of the function followed by a parameter
  10108. list enclosed in parentheses. Parameters are separated by commas.
  10109. For example:
  10110.  
  10111.  keyword(param1,param2)
  10112. The following are the functions which return string values. They
  10113. take one or more float, integer, vector, or string parameters.
  10114. Assume that A is any valid expression that evaluates to a float;
  10115. B, L, and P are floats which are truncated to integers
  10116. internally, S, S1, S2 etc are strings.
  10117.  
  10118. chr(B)    Character whose ASCII value is B. Returns a single
  10119. character string. The ASCII value of the character is specified
  10120. by an integer B which must be in the range 0 to 255. For example
  10121. chr(70) is the string "F". When rendering text objects you should
  10122. be aware that the characters rendered for values of B > 127 are
  10123. dependent on the (TTF) font being used. Many (TTF) fonts use the
  10124. Latin-1 (ISO 8859-1) character set, but not all do.
  10125.  
  10126. concat(S1,S2,...)   Concatenate strings S1 and S2. Returns a
  10127. string that is the concatenation of all parameter strings. Must
  10128. have at least 2 parameters but may have more. For example:
  10129.  
  10130.  concat("Value is ", str(A,3,1), " inches")
  10131. If the float value A was 12.34321 the result is "Value is 12.3
  10132. inches" which is a string.
  10133.  
  10134. str(A,L,P): Convert float A to a formatted string. Returns a
  10135. formatted string representation of float value A. The integer
  10136. parameter L specifies the minimum length of the string and the
  10137. type of left padding used if the string's representation is
  10138. shorter than the minimum. If L is positive then the padding is
  10139. with blanks. If L is negative then the padding is with zeros. The
  10140. overall minimum length of the formatted string is abs(L). If the
  10141. string needs to be longer, it will be made as long as necessary
  10142. to represent the value.
  10143.  
  10144. The integer parameter P specifies the number of digits after the
  10145. decimal point. If P is negative then a compiler-specific default
  10146. precision is use. Here are some examples:
  10147.  
  10148.  str(123.456,0,3)  "123.456"
  10149.  str(123.456,4,3)  "123.456"
  10150.  str(123.456,9,3)  "  123.456"
  10151.  str(123.456,-9,3) "00123.456"
  10152.  str(123.456,0,2)  "123.46"
  10153.  str(123.456,0,0)  "123"
  10154.  str(123.456,5,0)  "  123"
  10155.  str(123.000,7,2)  "  123.00"
  10156.  str(123.456,0,-1) "123.456000" (platform specific)
  10157. strlwr(S) Lower case of S. Returns a new string in which all
  10158. upper case letters in the string S1 are converted to lower case.
  10159. The original string is not affected. For example strlwr("Hello
  10160. There!") results in "hello there!".
  10161.  
  10162. substr(S,P,L)  Sub-string from S. Returns a string that is a
  10163. subset of the characters in parameter S starting at the position
  10164. specified by the integer value P for a length specified by the
  10165. integer value L. For example substr("ABCDEFGHI",4,2) evaluates to
  10166. the string "EF". If P+L>strlen(S) an error occurs.
  10167.  
  10168. strupr(S) Upper case of S. Returns a new string in which all
  10169. lower case letters in the string S are converted to upper case.
  10170. The original string is not affected. For example strupr("Hello
  10171. There!") results in "HELLO THERE!".
  10172.  
  10173. See section "Float Functions" for other functions which are
  10174. somewhat string-related but which return floats.  In addition to
  10175. the above built-in functions, you may also define your own
  10176. functions using the new #macro directive. See the section "User
  10177. Defined Macros" for more details.
  10178.  
  10179.  
  10180. 4.1.7     Array Identifiers
  10181. New in POV-Ray 3.1 you may now declare arrays of identifiers of
  10182. up to five dimensions. Any item that can be declared as an
  10183. identifier can be declared in an array.
  10184.  
  10185.  
  10186. 4.1.7.1   Declaring Arrays
  10187. The syntax for declaring an array is as follows:
  10188.  
  10189. STRING_DECLARATION:
  10190.   #declare IDENTIFIER = array[ INT ][ [ INT ]
  10191.   ]...[ARRAY_INITIALIZER]  |
  10192.   #local IDENTIFIER = array[ INT ][ [ INT ]
  10193.   ]...[ARRAY_INITIALIZER]
  10194. ARRAY_INITIALIZER:
  10195.   {ARRAY_ITEM, [ARRAY_ITEM, ]... }
  10196. ARRAY_ITEM:
  10197.   RVALUE              |
  10198.   ARRAY_INITIALIZER
  10199. Where IDENTIFIER is the name of the identifier up to 40
  10200. characters long and INT is a valid float expression which is
  10201. internally truncated to an integer which specifies the size of
  10202. the array. The optional ARRAY_INITIALIZER is discussed in the
  10203. next section "Array Initalizers".  Here is an example of a one-
  10204. dimensional, uninitalized array.
  10205.  
  10206.  #declare MyArray = array[10]
  10207. This declares an uninitalized array of ten elements. The elements
  10208. are referenced as MyArray[0] through MyArray[9]. As yet, the type
  10209. of the elements are undetermined. Once you have initialized any
  10210. element of the array, all other elements can only be defined as
  10211. that type. An attempt to reference an uninitalized element
  10212. results in an error. For example:
  10213.  
  10214.  #declare MyArray = array[10];
  10215.  #declare MyArray[5] = pigment{White}  //all other elements must
  10216. be
  10217.                      //pigments too.
  10218.  #declare MyArray[2] = normal{bumps 0.2} //generates an error
  10219.  #declare Thing = MyArray[4] //error: uninitalized array element
  10220. Multi-dimensional arrays up to five dimensions may be declared.
  10221. For example:
  10222.  
  10223.  #declare MyGrid = array[4][5]
  10224. declares a 20 element array of 4 rows and 5 columns. Elements are
  10225. referenced from MyGrid[0][0] to MyGrid[3][4]. Although it is
  10226. permissible to reference an entire array as a whole, you may not
  10227. reference just one dimension of a multi-dimensional array. For
  10228. example:
  10229.  
  10230.  #declare MyArray = array[10]
  10231.  #declare MyGrid = array[4][5]
  10232.  #declare YourArray = MyArray  //this is ok
  10233.  #declare YourGrid = MyGrid   //so is this
  10234.  #declare OneRow  = MyGrid[2] //this is illegal
  10235. Large uninitalized arrays do not take much memory. Internally
  10236. they are arrays of pointers so they probably use just 4 bytes per
  10237. element. Once initialized with values, they consume memory
  10238. depending on what you put in them.
  10239.  
  10240. The rules for local vs. global arrays are the same as any other
  10241. identifier. Note that this applies to the entire array. You
  10242. cannot mix local and global elements in the same array.  See
  10243. "#declare vs. #local" for information on identifier scope.
  10244.  
  10245.  
  10246. 4.1.7.2   Array Initalizers
  10247. Because it is cumbersome to individually initialize the elements
  10248. of an array, you may initialize it as it is created using array
  10249. initializer syntax. For example:
  10250.  
  10251.  #include "colors.inc"
  10252.  #declare FlagColors = array[3] {Red,White,Blue}
  10253. Multi-dimensional arrays may also be initialized this way. For
  10254. example:
  10255.  
  10256.  #declare Digits =
  10257.  array[4][10]
  10258.  {
  10259.   {7,6,7,0,2,1,6,5,5,0},
  10260.   {1,2,3,4,5,6,7,8,9,0},
  10261.   {0,9,8,7,6,5,4,3,2,1},
  10262.   {1,1,2,2,3,3,4,4,5,5}
  10263.  }
  10264. The commas are required between elements and between dimensions
  10265. as shown in the example.
  10266.  
  10267.  
  10268.  
  10269. 4.2  Language Directives
  10270. The POV Scene Language contains several statements called
  10271. language directives which tell the file parser how to do its job.
  10272. These directives can appear in almost any place in the scene file
  10273. - even in the middle of some other statements. They are used to
  10274. include other text files in the stream of commands, to declare
  10275. identifiers, to define macros, conditional, or looped parsing and
  10276. to control other important aspects of scene file processing.
  10277.  
  10278. Each directive begins with the hash character # (often called a
  10279. number sign or pound sign). It is followed by a keyword and
  10280. optionally other parameters.
  10281.  
  10282. In versions of POV-Ray prior to 3.0, the use of this # character
  10283. was optional. Language directives could only be used between
  10284. objects, camera or light_source statements and could not appear
  10285. within those statements. The exception was the #include which
  10286. could appear anywhere. Now that all language directives can be
  10287. used almost anywhere, the # character is mandatory.
  10288.  
  10289. The following keywords introduce language directives.
  10290. #break      #case        #debug      #declare
  10291. #default    #else        #end        #fclose
  10292. #fopen      #local       #macro      #read
  10293. #render     #statistics  #switch     #undef
  10294. #version    #warning     #write      
  10295. Earlier versions of POV-Ray considered the keyword
  10296. #max_intersections and the keyword #max_trace_level to be
  10297. language directives but they have been moved to the
  10298. global_settings statement and should be placed there without the
  10299. # sign. Their use as a directive still works but it generates a
  10300. warning and may be discontinued in the future.
  10301.  
  10302.  
  10303. 4.2.1     Include Files and the #include Directive.
  10304. The language allows include files to be specified by placing the
  10305. line
  10306.  
  10307.  #include "filename.inc"
  10308. at any point in the input file. The filename may be specified by
  10309. any valid string expression but it usually is a literal string
  10310. enclosed in double quotes. It may be up to 40 characters long (or
  10311. your computer's limit), including the two double-quote
  10312. characters.
  10313.  
  10314. The include file is read in as if it were inserted at that point
  10315. in the file. Using include is almost the same as cutting and
  10316. pasting the entire contents of this file into your scene.
  10317.  
  10318. Include files may be nested. You may have at most 10 nested
  10319. include files. There is no limit on un-nested include files.
  10320.  
  10321. Generally, include files have data for scenes but are not scenes
  10322. in themselves. By convention scene files end in .pov and include
  10323. files end with .inc.
  10324.  
  10325. It is legal to specify drive and directory information in the
  10326. file specification however it is discouraged because it makes
  10327. scene files less portable between various platforms.  Use of full
  10328. lower case is also recommended but not required.
  10329.  
  10330. It is typical to put standard include files in a special sub-
  10331. directory. POV-Ray can only read files in the current directory
  10332. or one referenced by the Library_Path option or +L switch.  See
  10333. section "Library Paths".
  10334.  
  10335. You may use the #local directive to declare identifiers which are
  10336. temporary in duration and local to the include file in scope. For
  10337. details see "#declare vs. #local".
  10338.  
  10339.  
  10340. 4.2.2     The #declare and #local Directives
  10341. Identifiers may be declared and later referenced to make scene
  10342. files more readable and to parameterize scenes so that changing a
  10343. single declaration changes many values. There are several built-
  10344. in identifiers which POV-Ray declares for you. See section "Built-
  10345. in Float Identifiers" and "Built-in Vector Identifiers" for
  10346. details.
  10347.  
  10348.  
  10349. 4.2.2.1   Declaring identifiers
  10350. An identifier is declared as follows.
  10351.  
  10352. DECLARATION:
  10353.   #declare IDENTIFIER = RVALUE  |
  10354.   #local IDENTIFIER = RVALUE
  10355. RVALUE:
  10356.   FLOAT;   |   VECTOR;   |   COLOR;   |   STRING   |
  10357.   OBJECT   |   TEXTURE   |   PIGMENT   |   NORMAL   |   FINISH
  10358.   |
  10359.   INTERIOR   |   MEDIA   |   DENSITY
  10360.   COLOR_MAP   |   PIGMENT_MAP   |   SLOPE_MAP   |   NORMAL_MAP
  10361.   |   DENSITY_MAP   |
  10362.   CAMERA   |   LIGHT_SOURCE   |
  10363.   FOG   |    RAINBOW   |    SKY_SPHERE   |    TRANSFORM
  10364. Where IDENTIFIER is the name of the identifier up to 40
  10365. characters long and RVALUE is any of the listed items.  They are
  10366. called that because they are values that can appear to the right
  10367. of the equals sign.  The syntax for each is in the corresponding
  10368. section of this language reference.
  10369.  
  10370. Here are some examples.
  10371.  
  10372.  #declare Rows = 5;
  10373.  #declare Count = Count+1;
  10374.  #local  Here = <1,2,3>;
  10375.  #declare White = rgb <1,1,1>;
  10376.  #declare Cyan = color blue 1.0 green 1.0;
  10377.  #declare Font_Name = "ariel.ttf"
  10378.  #declare Rod = cylinder {-5*x,5*x,1}
  10379.  #declare Ring = torus {5,1}
  10380.  #local  Checks = pigment { checker White, Cyan }
  10381.  object{ Rod scale y*5 }     // not "cylinder { Rod }"
  10382.  object {
  10383.   Ring
  10384.   pigment { Checks scale 0.5 }
  10385.   transform Skew
  10386.  }
  10387. Note that there should be a semi-colon after the expression in
  10388. all float, vector and color identifier declarations. This semi-
  10389. colon is new with POV-Ray version 3.1. If omitted, it generates a
  10390. warning and some macros may not work properly.
  10391.  
  10392. Declarations, like most language directives, can appear anywhere
  10393. in the file - even within other statements. For example:
  10394.  
  10395.  #declare Here=<1,2,3>;
  10396.  #declare Count=0;         // initialize Count
  10397.  union {
  10398.   object { Rod translate Here*Count }
  10399.   #declare Count=Count+1;     // re-declare inside union
  10400.   object { Rod translate Here*Count }
  10401.   #declare Count=Count+1;     // re-declare inside union
  10402.   object { Rod translate Here*Count }
  10403.  }
  10404. As this example shows, you can re-declare an identifier and may
  10405. use previously declared values in that re-declaration. However if
  10406. you attempt to re-declare an identifier as anything other than
  10407. its original type, it will generate a warning message.
  10408.  
  10409. Note that object identifiers use the generic wrapper statement
  10410. object{ ... }. You do not need to know what kind of object it is.
  10411.  
  10412. Declarations may be nested inside each other within limits. In
  10413. the example in the previous section you could declare the entire
  10414. union as a object. However for technical reasons there are
  10415. instances where you may not use any language directive inside the
  10416. declaration of floats, vectors or color expressions. Although
  10417. these limits have been loosened somewhat for POV-Ray 3.1, they
  10418. still exist.
  10419.  
  10420. Identifiers declared within #macro ... #end blocks are not
  10421. created at the time the macro is defined. They are only created
  10422. at the time the macro is actually invoked. Like all other items
  10423. inside such a #macro definition, they are ignored when the macro
  10424. is defined.
  10425.  
  10426.  
  10427. 4.2.2.2   #declare vs. #local
  10428. Identifiers may be declared either global using #declare or local
  10429. using the #local directive.
  10430.  
  10431. Those created by the #declare directive are permanent in duration
  10432. and global in scope. Once created, they are available throughout
  10433. the scene and they are not released until all parsing is complete
  10434. or until they are specifically released using #undef. See
  10435. "Destroying Identifiers".
  10436.  
  10437. Those created by the #local directive are temporary in duration
  10438. and local in scope. They temporarily override any identifiers
  10439. with the same name. See "Identifier Name ".
  10440.  
  10441. If #local is used inside a #macro then the identifier is local to
  10442. that macro. When the macro is invoked and the #local directive is
  10443. parsed, the identifier is created. It persists until the #end
  10444. directive of the macro is reached. At the #end directive, the
  10445. identifier is destroyed. Subsequent invocations of the macro
  10446. create totally new identifiers.
  10447.  
  10448. Use of #local within an include file but not in a macro, also
  10449. creates a temporary identifier that is local to that include
  10450. file. When the include file is included and the #local directive
  10451. is parsed, the identifier is created. It persists until the end
  10452. of the include file is reached. At the end of file the identifier
  10453. is destroyed. Subsequent inclusions of the file totally new
  10454. identifiers.
  10455.  
  10456. Use of #local in the main scene file (not in an include file and
  10457. not in a macro) is identical to #declare. For clarity sake you
  10458. should not use #local in a main file except in a macro.
  10459.  
  10460. There is currently no way to create permanent, yet local
  10461. identifiers in POV-Ray.
  10462.  
  10463. Local identifiers may be specifically released early using #undef
  10464. but in general there is no need to do so. See "Destroying
  10465. Identifiers".
  10466.  
  10467.  
  10468. 4.2.2.3   Identifier Name Collisions
  10469. Local identifiers may have the same names as previously declared
  10470. identifiers. In this instance, the most recent, most local
  10471. identifier takes precedence. Upon entering an include file or
  10472. invoking a macro, a new symbol table is created. When referencing
  10473. identifiers, the most recently created symbol table is searched
  10474. first, then the next most recent and so on back to the global
  10475. table of the main scene file. As each macro or include file is
  10476. exited, its table and identifiers are destroyed. Parameters
  10477. passed by value reside in the same symbol table as the one used
  10478. for identifiers local to the macro.
  10479.  
  10480. The rules for duplicate identifiers may seem complicated when
  10481. multiply-nested includes and macros are involved, but in actual
  10482. practice the results are generally what you intended.
  10483.  
  10484. Consider this example: You have a main scene file called
  10485. myscene.pov and it contains
  10486.  
  10487.  #declare A = 123;
  10488.  #declare B = rgb<1,2,3>;
  10489.  #declare C = 0;
  10490.  #include "myinc.inc"
  10491. Inside the include file you invoke a macro called MyMacro(J,K,L).
  10492. Note it isn't important where MyMacro is defined as long as it is
  10493. defined before it is invoked. In this example, it is important
  10494. that the macro is invoked from within myinc.inc.
  10495.  
  10496. The identifiers A, B, and C are generally available at all
  10497. levels. If either myinc.inc or MyMacro contain a line such as
  10498. #declare C=C+1; then the value C is changed everywhere as you
  10499. might expect.
  10500.  
  10501. Now suppose inside myinc.inc you do...
  10502.  
  10503.  #local A = 546;
  10504. The main version of A is hidden and a new A is created. This new
  10505. A is also available inside MyMacro because MyMacro is nested
  10506. inside myinc.inc. Once you exit myinc.inc, the local A is
  10507. destroyed and the original A with its value of 123 is now in
  10508. effect. Once you have created the local A inside myinc.inc, there
  10509. is no way to reference the original global A unless you #undef A
  10510. or exit the include file. Using #undef always undefines the most
  10511. local version of an identifier.
  10512.  
  10513. Similarly if MyMacro contained...
  10514.  
  10515.  #local B = box{0,1}
  10516. then a new identifier B is created local to the macro only. The
  10517. original value of B remains hidden but is restored when the macro
  10518. is finished. Note that the local B need not have the same type as
  10519. the original.
  10520.  
  10521. The complication comes when trying to assign a new value to an
  10522. identifier at one level that was declared local at an earlier
  10523. level. Suppose inside myinc.inc you do...
  10524.  
  10525.  #local D = 789;
  10526. If you are inside myinc.inc and you want to increment D by one,
  10527. you might try to do...
  10528.  
  10529.  #local D = D + 1;
  10530. but if you try to do that inside MyMacro you'll create a new D
  10531. which is local to MyMacro and not the D which is external to
  10532. MyMacro but local to myinc.inc. Therefore you've said "create a
  10533. MyMacro D from the value of myinc.inc's D plus one". That's
  10534. probably not what you wanted. Instead you should do...
  10535.  
  10536.  #declare D = D + 1;
  10537. You might think this creates a new D that is global but it
  10538. actually increments the myinc.inc version of D. Confusing isn't
  10539. it? Here are the rules:
  10540.  
  10541. 1.) When referencing an identifier, you always get the most
  10542. recent, most local version. By "referencing" we mean using the
  10543. value of the identifier in a POV-Ray statement or using it on the
  10544. right of an equals sign in either a #declare or #local.
  10545.  
  10546. 2.) When declaring an identifier using the #local keyword, the
  10547. identifier which is created or has a new value assigned, is
  10548. ALWAYS created at the current nesting level of macros or include
  10549. files.
  10550.  
  10551. 3.) When declaring a NEW, NON-EXISTANT identifier using #declare,
  10552. it is created as fully global. It is put in the symbol table of
  10553. the main scene file.
  10554.  
  10555. 4.) When ASSIGNING A VALUE TO AN EXISTING identifier using
  10556. #declare, it assigns it to the most recent, most local version at
  10557. the time.
  10558.  
  10559. In summary, #local always means "the current level", and #declare
  10560. means "global" for new identifiers and "most recent" for existing
  10561. identifiers.
  10562.  
  10563.  
  10564. 4.2.2.4   Destroying Identifiers with #undef
  10565. Identifiers created with #declare will generally persist until
  10566. parsing is complete. Identifiers created with #local will persist
  10567. until the end of the macro or include file in which they were
  10568. created. You may however un-define an identifier using the #undef
  10569. directive. For example:
  10570.  
  10571.  #undef MyValue
  10572. If multiple local nested versions of the identifier exist, the
  10573. most local most recent version is deleted and any identically
  10574. named identifiers which were created at higher levels will still
  10575. exist.
  10576.  
  10577. See also "The #ifdef and #ifndef Directives".
  10578.  
  10579.  
  10580. 4.2.3     File I/O Directives
  10581. New in POV-Ray 3.1 you may now open, read, write, append, and
  10582. close plain ASCII text files while parsing POV-Ray scenes. This
  10583. feature is primarily intended to help pass information between
  10584. frames of an animation. Values such as an object's position can
  10585. be written while parsing the current frame and read back during
  10586. the next frame. Clever use of this feature could allow a POV-Ray
  10587. scene to generate its own include files or write self-modifying
  10588. scripts. We trust that users will come up with other interesting
  10589. uses for this feature.
  10590.  
  10591.  
  10592. 4.2.3.1   The #fopen Directive
  10593. Users may open a text file using the #fopen directive. The syntax
  10594. is as follows:
  10595.  
  10596. FOPEN_DIRECTIVE:
  10597.   #fopen IDENTIFIER "filename" OPEN_TYPE
  10598. OPEN_TYPE:
  10599.   read   |   write   |   append
  10600. Where IDENTIFIER is an undefined identifier used to reference
  10601. this file as a file handle, "filename" is any string literal or
  10602. string expression which specifies the file name.  Files opened
  10603. with the read are open for read only. Those opened with write
  10604. create a new file with the specified name and it overwrites any
  10605. existing file with that name. Those opened with append opens a
  10606. file for writing but appends the text to the end of any existing
  10607. file.
  10608.  
  10609. The file handle identifier created by #fopen is always global and
  10610. remains in effect (and the file remains open) until the scene
  10611. parsing is complete or until you #fclose the file. You may use
  10612. #ifdef FILE_HANDLE_IDENTIFIER to see if a file is open.
  10613.  
  10614.  
  10615. 4.2.3.2   The #fclose Directive
  10616. Files opened with the #fopen directive are automatically closed
  10617. when scene parsing completes however you may close a file using
  10618. the #fclose directive. The syntax is as follows:
  10619.  
  10620. FCLOSE_DIRECTIVE:
  10621.   #fclose FILE_HANDLE_IDENTIFIER
  10622. Where FILE_HANDLE_IDENTIFIER is previously opened file opened
  10623. with the #fopen directive. See "The #fopen Directive".
  10624.  
  10625.  
  10626. 4.2.3.3   The #read Directive
  10627. You may read string, float or vector values from a plain ASCII
  10628. text file directly into POV-Ray variables using the #read
  10629. directive. The file must first be opened in "read" mode using the
  10630. #fopen directive. The syntax for #read is as follows:
  10631.  
  10632. READ_DIRECTIVE:
  10633.   #read( FILE_HANDLE_IDENTIFIER,
  10634.   DATA_IDENTIFIER[,DATA_IDENTIFIER]...)
  10635. DATA_IDENTIFIER:
  10636.   UNDECLARED_IDENTIFIER   |   FLOAT_IDENTIFIER   |
  10637.   VECTOR_IDENTIFIER   |   STRING_IDENTIFIER
  10638. Where FILE_HANDLE_IDENTIFIER is the previously opened file. It is
  10639. followed by one or more DATA_IDENTIFIERs separated by commas. The
  10640. parentheses around the identifier list are required. A
  10641. DATA_IDENTIFIER is any undeclared identifier or any previously
  10642. declared string identifier, float identifier, or vector
  10643. identifier. Undefined identifiers will be turned into global
  10644. identifiers of the type determined by the data which is read.
  10645. Previously defined identifiers remain at whatever global/local
  10646. status they had when originally created. Type checking is
  10647. performed to insure that the proper type data is read into these
  10648. identifiers.
  10649.  
  10650. The format of the data to be read must be a series of valid
  10651. string literals, float literals, or vector literals separated by
  10652. commas. Expressions or identifiers are not permitted in the data
  10653. file however unary minus signs and exponential notation are
  10654. permitted on float values.
  10655.  
  10656. If you attempt to read past end-of-file, the file is
  10657. automatically closed and the FILE_HANDLE_IDENTIFIER is deleted
  10658. from the symbol table.  This means that the boolean function
  10659. defined(IDENTIFIER) can be used to detect end-of-file.  For
  10660. example:
  10661.  
  10662.   #fopen MyFile "mydata.txt" read
  10663.   #while (defined(MyFile))
  10664.     #read (MyFile,Var1,Var2,Var3)
  10665.     ...
  10666.   #end
  10667.  
  10668. 4.2.3.4   The #write Directive
  10669. You may write string, float or vector values to a plain ASCII
  10670. text file from POV-Ray variables using the #write directive. The
  10671. file must first be opened in either write or append mode using
  10672. the #fopen directive. The syntax for #write is as follows:
  10673.  
  10674. WRITE_DIRECTIVE:
  10675.   #write( FILE_HANDLE_ITEM, DATA_ITEM[,DATA_ITEM]...)
  10676. DATA_ITEM:
  10677.   FLOAT   |   VECTOR   |   STRING
  10678. Where FILE_HANDLE_IDENTIFIER is the previously opened file. It is
  10679. followed by one or more DATA_ITEMs separated by commas. The
  10680. parentheses around the identifier list are required. A DATA_ITEM
  10681. is any valid string expression, float expression, or vector
  10682. expression. Float expressions are evaluated and written as signed
  10683. float literals. If you require format control, you should use the
  10684. str(VALUE,L,P) function to convert it to a formatted string. See
  10685. "String Functions" for details on the str function. Vector
  10686. expressions are evaluated into three signed float constants and
  10687. are written with angle brackets and commas in standard POV-Ray
  10688. vector notation. String expressions are evaluated and written as
  10689. specified.
  10690.  
  10691. Note that data read by the #read directive must have comma
  10692. delimiters between values and quotes around string data but the
  10693. #write directive does not automatically output commas or quotes.
  10694. For example the following #read directive reads a string, float
  10695. and vector.
  10696.  
  10697.  #read (MyFile,MyString,MyFloat,MyVect)
  10698. It expects to read something like:
  10699.  
  10700.  "A quote delimeted string" , -123.45, <1,2,-3>
  10701. The POV-Ray code to write this might be:
  10702.  
  10703.  #declare Val1 = -123.45;
  10704.  #declare Vect1 = <1,2,-3>;
  10705.  #write (MyFile,"\"A quote delimited
  10706. string\",",Val1,",",Vect1,"\n")
  10707. See "String Literals" and "Text Formatting" for details on
  10708. writing special characters such as quotes, newline, etc.
  10709.  
  10710.  
  10711. 4.2.4     The #default Directive
  10712. POV-Ray creates a default texture when it begins processing. You
  10713. may change those defaults as described below. Every time you
  10714. specify a texture statement, POV-Ray creates a copy of the
  10715. default texture. Anything you put in the texture statement
  10716. overrides the default settings. If you attach a pigment, normal,
  10717. or finish to an object without any texture statement then POV-Ray
  10718. checks to see if a texture has already been attached. If it has a
  10719. texture then the pigment, normal or finish will modify the
  10720. existing texture. If no texture has yet been attached to the
  10721. object then the default texture is copied and the pigment, normal
  10722. or finish will modify that texture.
  10723.  
  10724. You may change the default texture, pigment, normal or finish
  10725. using the language directive #default as follows:
  10726.  
  10727. DEFAULT_DIRECTIVE:
  10728.   #default {DEFAULT_ITEM }
  10729. DEFAULT_ITEM:
  10730.   TEXTURE   |   PIGMENT   |   NORMAL   |   FINISH
  10731. For example:
  10732.  
  10733.  #default{
  10734.    texture{
  10735.      pigment{rgb <1,0,0>}
  10736.      normal{bumps 0.3}
  10737.      finish{ambient 0.4}
  10738.    }
  10739.  }
  10740. means objects will default to red bumps and slightly high ambient
  10741. finish.  Note also you may change just part of it like this:
  10742.  
  10743.  #default {
  10744.   pigment {rgb <1,0,0>}
  10745.  }
  10746. This still changes the pigment of the default texture. At any
  10747. time there is only one default texture made from the default
  10748. pigment, normal and finish. The example above does not make a
  10749. separate default for pigments alone. Note that the special
  10750. textures tiles and material_map or a texture with a texture_map
  10751. may not be used as defaults.
  10752.  
  10753. You may change the defaults several times throughout a scene as
  10754. you wish. Subsequent #default statements begin with the defaults
  10755. that were in effect at the time. If you wish to reset to the
  10756. original POV-Ray defaults then you should first save them as
  10757. follows:
  10758.  
  10759.  //At top of file
  10760.  #declare Original_Default = texture {}
  10761. later after changing defaults you may restore it with...
  10762.  
  10763.  #default {texture {Original_Default}}
  10764. If you do not specify a texture for an object then the default
  10765. texture is attached when the object appears in the scene. It is
  10766. not attached when an object is declared. For example:
  10767.  
  10768.  #declare My_Object =
  10769.   sphere{ <0,0,0>, 1 } // Default texture not applied
  10770.   object{ My_Object }  // Default texture added here
  10771. You may force a default texture to be added by using an empty
  10772. texture statement as follows:
  10773.  
  10774.  #declare My_Thing =
  10775.   sphere { <0,0,0>, 1 texture {} } // Default texture applied
  10776. The original POV-Ray defaults for all items are given throughout
  10777. the documentation under each appropriate section.
  10778.  
  10779.  
  10780. 4.2.5     The #version Directive
  10781. As POV-Ray as evolved from version 1.0 through 3.1 we have made
  10782. every effort to maintain some amount of backwards compatibility
  10783. with earlier versions.  Some old or obsolete features can be
  10784. handled directly without any special consideration by the user.
  10785. Some old or obsolete features can no longer be handled at all.
  10786. However some old features can still be used if you warn POV-Ray
  10787. that this is an older scene.  The #version directive can be used
  10788. to switch version compatibility to different setting several
  10789. times throughout a scene file.  The syntax is:
  10790.  
  10791. VERSION_DIRECTIVE:
  10792.   #version FLOAT;
  10793. Note that there should be a semi-colon after the float expression
  10794. in a #version directive. This semi-colon is new with POV-Ray
  10795. version 3.1. If omitted, it generates a warning and some macros
  10796. may not work properly.
  10797.  
  10798. Additionally you may use the Version=n.n option or the +MVn.n
  10799. switch to establish the initial setting.  See "Language Version"
  10800. for details. For example one feature introduced in 2.0 that was
  10801. incompatible with any 1.0 scene files is the parsing of float
  10802. expressions. Using #version 1.0 turns off expression parsing as
  10803. well as many warning messages so that nearly all 1.0 files will
  10804. still work. Naturally the default setting for this option is
  10805. #version 3.1.
  10806.  
  10807. NOTE: Some obsolete or re-designed features are totally
  10808. unavailable in POV-Ray 3.1 REGARDLES OF THE VERSION SETTING.
  10809. Details on these features are noted throughout this
  10810. documentation.
  10811.  
  10812. The built-in float identifier version contains the current
  10813. setting of the version compatibility option. See "Built-in Float
  10814. Identifiers".  Together with the built-in version identifier the
  10815. #version directive allows you to save and restore the previous
  10816. values of this compatibility setting. The new #local identifier
  10817. option is especially useful here. For example suppose mystuff.inc
  10818. is in version 1 format. At the top of the file you could put:
  10819.  
  10820.  #local Temp_Vers = version;  // Save previous value
  10821.  #version 1.0;         // Change to 1.0 mode
  10822.  ... // Version 1.0 stuff goes here...
  10823.  #version Temp_Vers;      // Restore previous version
  10824. Future versions of POV-Ray may not continue to maintain full
  10825. backward compatibility even with the #version directive. We
  10826. strongly encourage you to phase in 3.1 syntax as much as
  10827. possible.
  10828.  
  10829.  
  10830. 4.2.6     Conditional Directives
  10831. POV-Ray 3.0 allows a variety of new language directives to
  10832. implement conditional parsing of various sections of your scene
  10833. file. This is especially useful in describing the motion for
  10834. animations but it has other uses as well. Also available is a
  10835. #while loop directive. You may nest conditional directives 200
  10836. levels deep.
  10837.  
  10838.  
  10839. 4.2.6.1   The #if...#else...#end Directives
  10840. The simplest conditional directive is a traditional #if
  10841. directive. It is of the form...
  10842.  
  10843. IF_DIRECTIVE:
  10844.   #if ( Cond ) TOKENS...  [#else TOKENS...] #end
  10845. The TOKENS are any number of POV-Ray keyword, identifiers, or
  10846. punctuation and ( Cond ) is a float expression that is
  10847. interpreted as a boolean value. The parentheses are required.
  10848. The #end directive is required.  A value of 0.0 is false and any
  10849. non-zero value is true. Note that extremely small values of about
  10850. 1e-10 are considered zero in case of round off errors. If Cond is
  10851. true, the first group of tokens is parsed normally and the second
  10852. set is skipped.  If false, the first set is skipped and the
  10853. second set is parsed.  For example:
  10854.  
  10855.  #declare Which=1;
  10856.  #if (Which)
  10857.    box{0,1}
  10858.  #else
  10859.    sphere{0,1}
  10860.  #end
  10861. The box is parsed and the sphere is skipped.  Changing the value
  10862. of Which to 0 means the box is skipped and the sphere is used.
  10863. The #else directive and second token group is optional. For
  10864. example:
  10865.  
  10866.  #declare Which=1;
  10867.  #if (Which)
  10868.    box{0,1}
  10869.  #end
  10870. Changing the value of Which to 0 means the box is removed.
  10871.  
  10872.  
  10873. 4.2.6.2   The #ifdef and #ifndef Directives
  10874. The #ifdef and #ifndef directive are similar to the #if directive
  10875. however they is used to determine if an identifier has been
  10876. previously declared.
  10877.  
  10878. IFDEF_DIRECTIVE:
  10879.   #ifdef ( IDENTIFIER ) TOKENS...  [#else TOKENS...] #end
  10880. IFNDEF_DIRECTIVE:
  10881.   #ifndef ( IDENTIFIER ) TOKENS...  [#else TOKENS...] #end
  10882. If the IDENTIFIER exists then the first group of tokens is parsed
  10883. normally and the second set is skipped.  If false, the first set
  10884. is skipped and the second set is parsed.  This is especially
  10885. useful for replacing an undefined item with a default.  For
  10886. example:
  10887.  
  10888.  #ifdef (User_Thing)
  10889.  
  10890.   // This section is parsed if the
  10891.   // identifier "User_Thing" was
  10892.   // previously declared
  10893.   object{User_Thing} // invoke identifier
  10894.  #else
  10895.   // This section is parsed if the
  10896.   // identifier "User_Thing" was not
  10897.   // previously declared
  10898.   box{<0,0,0>,<1,1,1>} // use a default
  10899.  #end
  10900.   // End of conditional part
  10901. The #ifndef directive works the opposite.  The first group is
  10902. parsed if the identifier is not defined.  As with the #if
  10903. directive, the #else clause is optional and the #end directive is
  10904. required.
  10905.  
  10906.  
  10907. 4.2.6.3   The #switch, #case, #range and #break Directives
  10908. A more powerful conditional is the #switch directive. The syntax
  10909. is as follows...
  10910.  
  10911. SWITCH_DIRECTIVE:
  10912.   #switch ( Switch_Value ) SWITCH_CLAUSE...  [#else TOKENS...]
  10913.   #end
  10914. SWITCH_CLAUSE:
  10915.   #case( Case_Value ) TOKENS...  [#break]      |
  10916.   #range( Low_Value , High_Value ) TOKENS...  [#break]
  10917. The TOKENS are any number of POV-Ray keyword, identifiers, or
  10918. punctuation and ( Switch_Value ) is a float expression. The
  10919. parentheses are required.  The #end directive is required.  The
  10920. SWITCH_CLAUSE comes in two varieties.  In the #case variety, the
  10921. float Switch_Value is compared to the float Case_Value.  If they
  10922. are equal, the condition is true.  Note that values whose
  10923. difference is less than 1e-10 are considered equal in case of
  10924. round off errors.  In the #range variety, Low_Value Switch and
  10925. High_Value are floats separated by a comma and enclosed in
  10926. parentheses.  If Low_Value <= Switch_Value and
  10927. Switch_Value<=High_Value then the condition is true.
  10928.  
  10929. In either variety, if the clause's condition is true, that
  10930. clause's tokens are parsed normally and parsing continues until a
  10931. #break, #else or #end directive is reached. If the condition is
  10932. false, POV-Ray skips until another #case or #range is found.
  10933.  
  10934. There may be any number of #case or #range clauses in any order
  10935. you want. If a clause evaluates true but no #break is specified,
  10936. the parsing will fall through to the next #case or #range and
  10937. that clause conditional is evaluated.  Hitting #break while
  10938. parsing a successful section causes an immediate jump to the #end
  10939. without processing subsequent sections, even if a subsequent
  10940. condition would also have been satisfied.
  10941.  
  10942. An optional #else clause may be the last clause.  It is only
  10943. executed if the clause before it was a false clause.
  10944.  
  10945. Here is an example:
  10946.  
  10947.  #switch (VALUE)
  10948.   #case (TEST_1)
  10949.    // This section is parsed if VALUE=TEST_1
  10950.   #break //First case ends
  10951.   #case (TEST_2)
  10952.    // This section is parsed if VALUE=TEST_2
  10953.   #break //Second case ends
  10954.   #range (LOW_1,HIGH_1)
  10955.    // This section is parsed if (VALUE>=LOW_1)&(VALUE<=HIGH_1)
  10956.   #break //Third case ends
  10957.   #range (LOW_2,HIGH_2)
  10958.    // This section is parsed if (VALUE>=LOW_2)&(VALUE<=HIGH_2)
  10959.   #break //Fourth case ends
  10960.   #else
  10961.    // This section is parsed if no other case or
  10962.    // range is true.
  10963.  #end // End of conditional part
  10964.  
  10965. 4.2.6.4   The #while...#end Directive
  10966. The #while directive is a looping feature that makes it easy to
  10967. place multiple objects in a pattern or other uses.
  10968.  
  10969. WHILE_DIRECTIVE:
  10970.   #while ( Cond ) TOKENS... #end
  10971. The TOKENS are any number of POV-Ray keyword, identifiers, or
  10972. punctuation marks which are the body of the loop.  The #while
  10973. directive is followed by a float expression that evaluates to a
  10974. boolean value. A value of 0.0 is false and any non-zero value is
  10975. true. Note that extremely small values of about 1e-10 are
  10976. considered zero in case of round off errors. The parentheses
  10977. around the expression are required. If the condition is true
  10978. parsing continues normally until an #end directive is reached. At
  10979. the end, POV-Ray loops back to the #while directive and the
  10980. condition is re-evaluated. Looping continues until the condition
  10981. fails. When it fails, parsing continues after the #end directive.
  10982. Note it is possible for the condition to fail the first time and
  10983. the loop is totally skipped.  It is up to the user to insure that
  10984. something inside the loop changes so that it eventually
  10985. terminates.  Here is a properly constructed loop example:
  10986.  
  10987.  #declare Count=0;
  10988.  #while (Count < 5)
  10989.   object{MyObject translate x*3*Count}
  10990.   #declare Count=Count+1;
  10991.  #end
  10992. This example places five copies of MyObject in a row spaced three
  10993. units apart in the x-direction.
  10994.  
  10995.  
  10996. 4.2.7     User Message Directives
  10997. With the addition of conditional and loop directives, the POV-Ray
  10998. language has the potential to be more like an actual programming
  10999. language. This means that it will be necessary to have some way
  11000. to see what is going on when trying to debug loops and
  11001. conditionals. To fulfill this need we have added the ability to
  11002. print text messages to the screen. You have a choice of five
  11003. different text streams to use including the ability to generate a
  11004. fatal error if you find it necessary. Limited formatting is
  11005. available for strings output by this method.
  11006.  
  11007.  
  11008. 4.2.7.1   Text Message Streams
  11009. The syntax for a text message is any of the following:
  11010.  
  11011. TEXT_STREAM_DIRECTIVE:
  11012.   #debug STRING       |
  11013.   #error STRING       |
  11014.   #render STRING      |
  11015.   #statistics STRING  |
  11016.   #warning STRING
  11017. Where STRING is any valid string of text including string
  11018. identifiers or functions which return strings. For example:
  11019.  
  11020.  #switch (clock*360)
  11021.   #range (0,180)
  11022.    #render "Clock in 0 to 180 range\n"
  11023.   #break
  11024.   #range (180,360)
  11025.    #render "Clock in 180 to 360 range\n"
  11026.   #break
  11027.   #else
  11028.    #warning "Clock outside expected range\n"
  11029.    #warning concat("Value is:",str(clock*360,5,0),"\n")
  11030.  #end
  11031. There are seven distinct text streams that POV-Ray uses for
  11032. output. You may output only to five of them. On some versions of
  11033. POV-Ray, each stream is designated by a particular color. Text
  11034. from these streams are displayed whenever it is appropriate so
  11035. there is often an intermixing of the text. The distinction is
  11036. only important if you choose to turn some of the streams off or
  11037. to direct some of the streams to text files. On some systems you
  11038. may be able to review the streams separately in their own scroll-
  11039. back buffer. See "Directing Text Streams to Files" for details on
  11040. re-directing the streams to a text file.
  11041.  
  11042. Here is a description of how POV-Ray uses each stream. You may
  11043. use them for whatever purpose you want except note that use of
  11044. the #error stream causes a fatal error after the text is
  11045. displayed.
  11046.  
  11047. Debug: This stream displays debugging messages. It was primarily
  11048. designed for developers but this and other streams may also be
  11049. used by the user to display messages from within their scene
  11050. files.
  11051.  
  11052. Fatal: This stream displays fatal error messages. After
  11053. displaying this text, POV-Ray will terminate. When the error is a
  11054. scene parsing error, you may be shown several lines of scene text
  11055. that leads up to the error.
  11056.  
  11057. Render: This stream displays information about what options you
  11058. have specified to render the scene. It includes feedback on all
  11059. of the major options such as scene name, resolution, animation
  11060. settings, anti-aliasing and others.
  11061.  
  11062. Statistics: This stream displays statistics after a frame is
  11063. rendered. It includes information about the number of rays
  11064. traced, the length of time of the processing and other
  11065. information.
  11066.  
  11067. Warning: This stream displays warning messages during the parsing
  11068. of scene files and other warnings. Despite the warning, POV-Ray
  11069. can continue to render the scene.
  11070.  
  11071. The banner and status streams can not be accessed by the user.
  11072.  
  11073.  
  11074. 4.2.7.2   Text Formatting
  11075. Some escape sequences are available to include non-printing
  11076. control characters in your text. These sequences are similar to
  11077. those used in string literals in the C programming language. The
  11078. sequences are:
  11079. "\a" Bell or       0x0
  11080.      alarm,        7
  11081. "\b" Backspace,    0x0
  11082.                    8
  11083. "\f" Form feed,    0x0
  11084.                    C
  11085. "\n" New line      0x0
  11086.      (line feed)   A
  11087. "\r" Carriage      0x0
  11088.      return        D
  11089. "\t" Horizontal    0x0
  11090.      tab           9
  11091. "\v" Vertical      0x0
  11092.      tab           B
  11093. "\0" Null          0x0
  11094.                    0
  11095. "\\" Backslash     0x5
  11096.                    C
  11097. "\'" Single        0x2
  11098.      quote         7
  11099. "\"" Double        0x2
  11100.      quote         2
  11101. For example:
  11102.  
  11103.  #debug "This is one line.\nBut this is another"
  11104. Depending on what platform you are using, they may not be fully
  11105. supported for console output. However they will appear in any
  11106. text file if you re-direct a stream to a file.
  11107.  
  11108. Note that most of these control characters only apply in text
  11109. message directives and #write directives which write strings They
  11110. are not implemented for other string usage in POV-Ray such as
  11111. text objects or file names.
  11112.  
  11113.  
  11114. 4.2.8     User Defined Macros
  11115. New in POV-Ray 3.1 are user defined macros with parameters. This
  11116. new feature, along with the ability to declare #local variables,
  11117. turns the POV-Ray Language into a fully functional programming
  11118. language. It should now be possible to write scene generation
  11119. utilities that previously required external utilities.
  11120.  
  11121.  
  11122. 4.2.8.1   The #macro Directive
  11123. The syntax for declaring a macro is:
  11124.  
  11125. MACRO_DEFINITION:
  11126.   #macro IDENTIFIER ( [PARAM_IDENT] [,  PARAM_IDENT]... )
  11127.   TOKENS... #end
  11128. Where IDENTIFIER is the name of the macro and PARAM_IDENTs are a
  11129. list of zero or more formal parameter identifiers separated by
  11130. commas and enclosed by parentheses. The parentheses are required
  11131. even if no parameters are specified.
  11132.  
  11133. The TOKENS are any number of POV-Ray keyword, identifiers, or
  11134. punctuation marks which are the body of the macro.  The body of
  11135. the macro may contain almost any POV-Ray syntax items you desire.
  11136. It is terminated my the #end directive. Note however that any
  11137. conditional directives such as #if...#end, #while...#end, etc.
  11138. must be fully nested inside or outside the macro so that the
  11139. corresponding #end directives pair-up properly. Also you may not
  11140. nest macro declarations.
  11141.  
  11142. A macro must be declared before it is invoked.  All macro names
  11143. are global in scope and permanent in duration.  You may redefine
  11144. a macro by another #macro directive with the same name.  The
  11145. previous definition is lost.  Macro names respond to #ifdef,
  11146. #ifndef, and #undef directives.  See "The #ifdef and #ifndef
  11147. Directives" and "Destroying Identifiers with #undef".
  11148.  
  11149.  
  11150. 4.2.8.2   Invoking Macros
  11151. You invoke the macro by specifying the macro name followed by a
  11152. list of zero or more actual parameters enclosed in parentheses
  11153. and separated by commas.  The number of actual parameters must
  11154. match the number of formal parameters in the definition.  The
  11155. parentheses are required even if no parameters are specified.
  11156. The syntax is:
  11157.  
  11158. MACRO_INVOCATION:
  11159.   MACRO_IDENTIFIER ( [ACTUAL_PARAM] [,  ACTUAL_PARAM]... )
  11160. ACTUAL_PARAM:
  11161.   IDENTIFIER          |
  11162.   RVALUE
  11163. An RVALUE is any value that can legally appear to the right of an
  11164. equals sign in a #declare or #local declaration. See "Declaring
  11165. identifiers" for information on RVALUEs.  When the macro is
  11166. invoked, a new local symbol table is created.  The actual
  11167. parameters are assigned to formal parameter identifiers as local,
  11168. temporary variables.  POV-Ray jumps to the body of the macro and
  11169. continues parsing until the matching #end directive is reached.
  11170. There, the local variables created by the parameters are
  11171. destroyed as well as any local identifiers expressly created in
  11172. the body of the macro.  It then resumes parsing at the point
  11173. where the macro was invoked.  It is as though the body of the
  11174. macro was cut and pasted into the scene at the point where the
  11175. macro was invoked.
  11176.  
  11177. Here is a simple macro that creates a window frame object when
  11178. you specify the inner and outer dimensions.
  11179.  
  11180.  #macro Make_Frame
  11181. (OuterWidth,OuterHeight,InnerWidth,InnerHeight,Depth)
  11182.   #local Horz = (OuterHeight-InnerHeight)/2;
  11183.   #local Vert = (OuterWidth-InnerWidth)/2;
  11184.   difference
  11185.   {
  11186.    box{<0,0,0>,<OuterWidth,OuterHeight,Depth>}
  11187.    box{<Vert,Horz,-0.1>,<OuterWidth-Vert,OuterHeight-
  11188. Horz,Depth+0.1>}
  11189.   }
  11190.  #end
  11191.  Make_Frame(8,10,7,9,1) //invoke the macro
  11192. In this example, the macro has five float parameters.  The actual
  11193. parameters (the values 8, 10, 7, 9, and 1) are assigned to the
  11194. five identifiers in the #macro formal parameter list.  It is as
  11195. though you had used the following five lines of code.
  11196.  
  11197.  #local OuterWidth = 8;
  11198.  #local OuterHeight = 10;
  11199.  #local InnerWidth, = 7;
  11200.  #local InnerHeight = 9;
  11201.  #local Depth = 1;
  11202. These five identifiers are stored in the same symbol table as any
  11203. other local identifier such as Horz or Vert in this example.  The
  11204. parameters and local variables are all destroyed when the #end
  11205. statement is reached.  See "Identifier Name Collisions" for a
  11206. detailed discussion of how local identifiers, parameters, and
  11207. global identifiers work when a local identifier has the same name
  11208. as a previously declared identifier.
  11209.  
  11210.  
  11211. 4.2.8.3   Are POV-Ray Macros a Function or a Macro?
  11212. POV-Ray macros are a strange mix of macros and functions.  In
  11213. traditional computer programming languages, a macro works
  11214. entirely by token substitution.  The body of the routine is
  11215. inserted into the invocation point by simply copying the tokens
  11216. and parsing them as if they had been cut and pasted in place.
  11217. Such cut-and-paste substitution is often called macro
  11218. substitution because it is what macros are all about.  In this
  11219. respect, POV-Ray macros are exactly like traditional macros in
  11220. that they use macro substitution for the body of the macro.
  11221. However traditional macros also use this cut-and-paste
  11222. substitution strategy for parameters but POV-Ray does not.
  11223.  
  11224. Suppose you have a macro in the C programming language
  11225. Typical_Cmac(Param) and you invoke it as Typical_Cmac(else A=B).
  11226. Anywhere that Param appears in the macro body, the four tokens
  11227. else, A, =, and B are substituted into the program code using a
  11228. cut-and-paste operation.  No type checking is performed because
  11229. anything is legal.  The ability to pass an arbitrary group of
  11230. tokens via a macro parameter is a powerful (and sadly often
  11231. abused) feature of traditional macros.
  11232.  
  11233. After careful deliberation, we have decided against this type of
  11234. parameters for our macros.  The reason is that POV-Ray uses
  11235. commas more frequently in its syntax than do most programming
  11236. languages.  Suppose you create a macro that is designed to
  11237. operate on one vector and two floats.  It might be defined
  11238. OurMac(V,F1,F2).  If you allow arbitrary strings of tokens and
  11239. invoke a macro such as OurMac(<1,2,3>,4,5) then it is impossible
  11240. to tell if this is a vector and two floats or if its 5 parameters
  11241. with the two tokens < and 1 as the first parameter.  If we design
  11242. the macro to accept 5 parameters then we cannot invoke it like
  11243. this... OurMac(MyVector,4,5).
  11244.  
  11245. Function parameters in traditional programming languages do not
  11246. use token substitution to pass values.  They create temporary,
  11247. local variables to store parameters that are either constant
  11248. values or identifier references which are in effect a pointer to
  11249. a variable.  POV-Ray macros use this function-like system for
  11250. passing parameters to its macros.  In our example
  11251. OurMac(<1,2,3>,4,5), POV-Ray sees the < and knows it must be the
  11252. start of a vector.  It parses the whole vector expression and
  11253. assigns it to the first parameter exactly as though you had used
  11254. the statement #local V=<1,2,3>;.
  11255.  
  11256. Although we say that POV-Ray parameters are more like traditional
  11257. function parameters than macro parameters, there still is one
  11258. difference.  Most languages require you to declare the type of
  11259. each parameter in the definition before you use it but POV-Ray
  11260. does not.  This should be no surprise because Most languages
  11261. require you to declare the type of any identifier before you use
  11262. it but POV-Ray does not.  This means that if you pass the wrong
  11263. type value in a POV-Ray macro parameter, it may not generate an
  11264. error until you reference the identifier in the macro body.  No
  11265. type checking is performed as the parameter is passed.  So in
  11266. this very limited respect, POV-Ray parameters are somewhat macro-
  11267. like but are mostly function-like.
  11268.  
  11269.  
  11270. 4.2.8.4   Returning a Value Like a Function
  11271. POV-Ray macros have a variety of uses.  Like most macros, they
  11272. provide a parameterized way to insert arbitrary code into a scene
  11273. file.  However most POV-Ray macros will be used like functions or
  11274. procedures in a traditional programming language.  This is
  11275. especially true because the POV-Ray language has no user-defined
  11276. functions or procedures.  Macros are designed to fill all of
  11277. these roles.
  11278.  
  11279. When the body of a macro consists of statements that create an
  11280. entire item such as an object, texture, etc. then the macro acts
  11281. like a function which returns a single value.  The Make_Frame
  11282. macro example in the section "Invoking Macros" above is such a
  11283. macro which returns a value that is an object.  Here are some
  11284. examples of how you might invoke it.
  11285.  
  11286.  union {  //make a union of two objects
  11287.    object{ Make_Frame(8,10,7,9,1) translate  20*x}
  11288.    object{ Make_Frame(8,10,7,9,1) translate -20*x}
  11289.  }
  11290.  #declare BigFrame = object{ Make_Frame(8,10,7,9,1)}
  11291.  #declare SmallFrame = object{ Make_Frame(5,4,4,3,0.5)}
  11292. Because no type checking is performed on parameters and because
  11293. the expression syntax for floats, vectors, and colors is
  11294. identical, you can create clever macros which work on all three.
  11295. See the sample scene MACRO3.POV which includes this macro to
  11296. interpolate values.
  11297.  
  11298. // Define the macro.  Parameters are:
  11299. //   T:  Middle value of time
  11300. //   T1: Initial time
  11301. //   T2: Final time
  11302. //   P1: Initial position (may be float, vector or color)
  11303. //   P2: Final position (may be float, vector or color)
  11304. //   Result is a value between P1 and P2 in the same proportion
  11305. //    as T is between T1 and T2.
  11306. #macro Interpolate(T,T1,T2,P1,P2)
  11307.    (P1+(T1+T/(T2-T1))*(P2-P1))
  11308. #end
  11309. You might invoke it with P1 and P2 as floats, vectors, or colors
  11310. as follows.
  11311.  
  11312.   sphere{
  11313.     Interpolate(I,0,15,<2,3,4>,<9,8,7>),  //center location is
  11314. vector
  11315.     Interpolate(I,0,15,3.0,5.5)           //radius is float
  11316.     pigment{
  11317.       color Interpolate(I,0,15,rgb<1,1,0>,rgb<0,1,1>)
  11318.     }
  11319.   }
  11320. As the float value I varies from 0 to 15, the location, radius,
  11321. and color of the sphere vary accordingly.
  11322.  
  11323. There is a danger in using macros as functions.  In a traditional
  11324. programming language function, the result to be returned is
  11325. actually assigned to a temporary variable and the invoking code
  11326. treats it as a variable of a given type.  However macro
  11327. substitution may result in invalid or undesired syntax.  Note the
  11328. definition of the macro Interpolate above has an outermost set of
  11329. parentheses.  If those parentheses are omitted, it will not
  11330. matter in the examples above, but what if you do this...
  11331.  
  11332.  #declare Value = Interpolate(I,0,15,3.0,5.5)*15;
  11333. The end result is as if you had done...
  11334.  
  11335.  #declare Value = P1+(T1+T/(T2-T1))*(P2-P1) * 15;
  11336. which is syntactically legal but not mathematically correct
  11337. because the P1 term is not multiplied.  The parentheses in the
  11338. original example solves this problem.  The end result is as if
  11339. you had done...
  11340.  
  11341.  #declare Value = (P1+(T1+T/(T2-T1))*(P2-P1)) * 15;
  11342. which is correct.
  11343.  
  11344.  
  11345. 4.2.8.5   Returning Values Via Parameters
  11346. Sometimes it is necessary to have a macro return more than one
  11347. value or you may simply prefer to return a value via a parameter
  11348. as is typical in traditional programming language procedures.
  11349. POV-Ray macros are capable of returning values this way.  The
  11350. syntax for POV-Ray macro parameters says that the actual
  11351. parameter may be an IDENTIFIER or an RVALUE.  Values may only be
  11352. returned via a parameter if the parameter is an IDENTIFIER.
  11353. Parameters that are RVALUES are constant values that cannot
  11354. return information.  An RVALUE is anything that legally may
  11355. appear to the right of an equals sign in a #declare or #local
  11356. directive.  For example consider the following trivial macro
  11357. which rotates an object about the x-axis.
  11358.  
  11359.  #macro Turn_Me(Stuff,Degrees)
  11360.    #declare Stuff = object{Stuff rotate x*Degrees}
  11361.  #end
  11362. This attempts to re-declare the identifier Stuff as the rotated
  11363. version of the object.  However the macro might be invoked with
  11364. Turn_Me(box{0,1},30) which uses a box object as an RVALUE
  11365. parameter.  This won't work because the box is not an identifier.
  11366. You can however do this
  11367.  
  11368.    #declare MyObject=box{0,1}
  11369.    Turn_Me(MyObject,30)
  11370. The identifier MyObject now contains the rotated box.
  11371.  
  11372. See "Identifier Name Collisions" for a detailed discussion of how
  11373. local identifiers, parameters, and global identifiers work when a
  11374. local identifier has the same name as a previously declared
  11375. identifier.
  11376.  
  11377. While it is obvious that MyObject is an identifier and box{0,1}
  11378. is not, it should be noted that Turn_Me(object{MyObject},30) will
  11379. not work because object{MyObject} is considered an object
  11380. statement and is not a pure identifier.  This mistake is more
  11381. likely to be made with float identifiers verses float
  11382. expressions.  Consider these examples.
  11383.  
  11384.   #declare Value=5.0;
  11385.   MyMacro(Value)     //MyMacro can change the value of Value
  11386. but...
  11387.   MyMacro(+Value)    //This version and the rest are not lone
  11388.   MyMacro(Value+0.0) // identifiers. They are float expressions
  11389.   MyMacro(Value*1.0) // which cannot be changed.
  11390. Although all four invocations of MyMacro are passed the value
  11391. 5.0, only the first may modify the value of the identifier.
  11392.  
  11393.  
  11394. 4.3  POV-Ray Coordinate System
  11395. Objects, lights and the camera are positioned using a typical 3D
  11396. coordinate system. The usual coordinate system for POV-Ray has
  11397. the positive y-axis pointing up, the positive x-axis pointing to
  11398. the right and the positive z-axis pointing into the screen. The
  11399. negative values of the axes point the other direction as shown in
  11400. the images in section "Understanding POV-Ray's Coordinate
  11401. System".
  11402.  
  11403. Locations within that coordinate system are usually specified by
  11404. a three component vector. The three values correspond to the x, y
  11405. and z directions respectively. For example, the vector <1,2,3>
  11406. means the point that's one unit to the right, two units up and
  11407. three units in front of the center of the universe at <0,0,0>.
  11408.  
  11409. Vectors are not always points though. They can also refer to an
  11410. amount to size, move or rotate a scene element or to modify the
  11411. texture pattern applied to an object.
  11412.  
  11413. The size, location, orientation, and deformation of items within
  11414. the coordinate system is controlled by modifiers called
  11415. transformations.  The follow sub-sections describe the
  11416. transformations and their usage.
  11417.  
  11418.  
  11419. 4.3.1     Transformations
  11420. The supported transformations are rotate, scale, and translate.
  11421. They are used to turn, size and move an object or texture. A
  11422. transformation matrix may also be used to specify complex
  11423. transformations directly. Groups of transformations may be merged
  11424. together and stored in a transformation identifier.  The syntax
  11425. for transformations is as follows.
  11426.  
  11427. TRANSFORMATION:
  11428.   rotate <Rotate_Amt>           |
  11429.   scale <Scale_Amt>                  |
  11430.   translate <Translate_Amt>          |
  11431.   transform TRANSFORM_IDENTIFIER     |
  11432.   matrix <Val00, Val01, Val02,
  11433.      Val10, Val11, Val12,
  11434.      Val20, Val21, Val22,
  11435.      Val30, Val31, Val32>
  11436. TRANSFORM_DECLARATION:
  11437.   #declare IDENTIFIER = transform{ TRANSFORMATION... }   |
  11438.   #local IDENTIFIER = transform{ TRANSFORMATION... }
  11439.  
  11440. 4.3.1.1   Translate
  11441. Items may be moved by adding a translate modifier. It consists of
  11442. the keyword translate followed by a vector expression. The three
  11443. terms of the vector specify the number of units to move in each
  11444. of the x, y and z directions. Translate moves the element
  11445. relative to it's current position. For example
  11446.  
  11447.  sphere { <10, 10, 10>, 1
  11448.   pigment { Green }
  11449.   translate <-5, 2, 1>
  11450.  }
  11451. will move the sphere from the location <10,10,10> to <5,12,11>.
  11452. It does not move it to the absolute location <-5,2,1>.
  11453. Translations are always relative to the item's location before
  11454. the move.  Translating by zero will leave the element unchanged
  11455. on that axis. For example:
  11456.  
  11457.  sphere { <10, 10, 10>, 1
  11458.   pigment { Green }
  11459.   translate 3*x // evaluates to <3,0,0> so move 3 units
  11460.          // in the x direction and none along y or z
  11461.  }
  11462.  
  11463. 4.3.1.2   Scale
  11464. You may change the size of an object or texture pattern by adding
  11465. a scale modifier. It consists of the keyword scale followed by a
  11466. vector expression. The three terms of the vector specify the
  11467. amount of scaling in each of the x, y and z directions.
  11468.  
  11469. Uneven scaling is used to stretch or squish an element. Values
  11470. larger than one stretch the element on that axis while values
  11471. smaller than one are used to squish it. Scale is relative to the
  11472. current element size. If the element has been previously re-sized
  11473. using scale then scale will size relative to the new size.
  11474. Multiple scale values may used.
  11475.  
  11476. For example
  11477.  
  11478.  sphere { <0,0,0>, 1
  11479.   scale <2,1,0.5>
  11480.  }
  11481. will stretch and smash the sphere into an ellipsoid shape that is
  11482. twice the original size along the x-direction, remains the same
  11483. size in the y-direction and is half the original size in the z-
  11484. direction.
  11485.  
  11486. If a lone float expression is specified it is promoted to a three
  11487. component vector whose terms are all the same. Thus the item is
  11488. uniformly scaled by the same amount in all directions. For
  11489. example:
  11490.  
  11491.  object {
  11492.   MyObject
  11493.   scale 5 // Evaluates as <5,5,5> so uniformly scale
  11494.       // by 5 in every direction.
  11495.  }
  11496.  
  11497. 4.3.1.3   Rotate
  11498. You may change the orientation of an object or texture pattern by
  11499. adding a rotate modifier. It consists of the keyword rotate
  11500. followed by a vector expression. The three terms of the vector
  11501. specify the number of degrees to rotate about each of the x-, y-
  11502. and z-axes.
  11503.  
  11504. Note that the order of the rotations does matter. Rotations occur
  11505. about the x-axis first, then the y-axis, then the z-axis. If you
  11506. are not sure if this is what you want then you should only rotate
  11507. on one axis at a time using multiple rotation statements to get a
  11508. correct rotation. As in
  11509.  
  11510.  rotate <0, 30, 0>  // 30 degrees around Y axis then,
  11511.  rotate <-20, 0, 0> // -20 degrees around X axis then,
  11512.  rotate <0, 0, 10>  // 10 degrees around Z axis.
  11513. Rotation is always performed relative to the axis. Thus if an
  11514. object is some distance from the axis of rotation it will not
  11515. only rotate but it will orbit about the axis as though it was
  11516. swinging around on an invisible string.
  11517.  
  11518. POV-Ray uses a left-handed rotation system. Using the famous
  11519. "Computer Graphics Aerobics" exercise, you hold up your left hand
  11520. and point your thumb in the positive direction of the axis of
  11521. rotation. Your fingers will curl in the positive direction of
  11522. rotation. Similarly if you point your thumb in the negative
  11523. direction of the axis your fingers will curl in the negative
  11524. direction of rotation.  See "Understanding POV-Ray's Coordinate
  11525. System" for a illustration.
  11526.  
  11527.  
  11528. 4.3.1.4   Matrix Keyword
  11529. The matrix keyword can be used to explicitly specify the
  11530. transformation matrix to be used for objects or textures. Its
  11531. syntax is:
  11532.  
  11533. MATRIX:
  11534.   matrix <Val00, Val01, Val02,
  11535.      Val10, Val11, Val12,
  11536.      Val20, Val21, Val22,
  11537.      Val30, Val31, Val32>
  11538. Where Val00 through Val32 are float expressions enclosed in angle
  11539. brackets and separated by commas.  Note this is not a vector.  It
  11540. is a set of 12 float expressions.  These floats specify the
  11541. elements of a 4 by 4 matrix with the fourth column implicitly set
  11542. to <0,0,0,1>. At any given point P, P=<px, py, pz>, is
  11543. transformed into the point Q, Q=<qx, qy, qz> by
  11544.  
  11545.  qx = Val00 * px + Val10 * py + Val20 * pz + Val30
  11546.  qy = Val01 * px + Val11 * py + Val21 * pz + Val31
  11547.  qz = Val02 * px + Val12 * py + Val22 * pz + Val32
  11548. Normally you won't use the matrix keyword because it's less
  11549. descriptive than the transformation commands and harder to
  11550. visualize. However the matrix command allows more general
  11551. transformation effects like shearing. The following matrix causes
  11552. an object to be sheared along the y-axis.
  11553.  
  11554.  object {
  11555.   MyObject
  11556.   matrix < 1, 1, 0,
  11557.        0, 1, 0,
  11558.        0, 0, 1,
  11559.        0, 0, 0 >
  11560.  }
  11561.  
  11562. 4.3.2     Transformation Order
  11563. Because rotations are always relative to the axis and scaling is
  11564. relative to the origin, you will generally want to create an
  11565. object at the origin and scale and rotate it first. Then you may
  11566. translate it into its proper position. It is a common mistake to
  11567. carefully position an object and then to decide to rotate it.
  11568. However because a rotation of an object causes it to orbit about
  11569. the axis, the position of the object may change so much that it
  11570. orbits out of the field of view of the camera!
  11571.  
  11572. Similarly scaling after translation also moves an object
  11573. unexpectedly. If you scale after you translate the scale will
  11574. multiply the translate amount. For example
  11575.  
  11576.  translate <5, 6, 7>
  11577.  scale 4
  11578. will translate to <20,24,28> instead of <5,6,7>. Be careful when
  11579. transforming to get the order correct for your purposes.
  11580.  
  11581.  
  11582. 4.3.3     Transform Identifiers
  11583. At times it is useful to combine together several transformations
  11584. and apply them in multiple places. A transform identifier may be
  11585. used for this purpose. Transform identifiers are declared as
  11586. follows:
  11587.  
  11588. TRANSFORM_DECLARATION:
  11589.   #declare IDENTIFIER = transform{ TRANSFORMATION... }   |
  11590.   #local IDENTIFIER = transform{ TRANSFORMATION... }
  11591. Where IDENTIFIER is the name of the identifier up to 40
  11592. characters long and TRANSFORMATION is any valid transformation
  11593. modifier.  See "#declare vs. #local" for information on
  11594. identifier scope.  Here is an example...
  11595.  
  11596.  #declare MyTrans = transform {
  11597.    rotate ThisWay
  11598.    scale SoMuch
  11599.    rotate -ThisWay
  11600.    scale Bigger
  11601.    translate OverThere
  11602.    rotate WayAround
  11603.   }
  11604. A transform identifier is invoked by the transform keyword
  11605. without any brackets as shown here:
  11606.  
  11607.  object {
  11608.   MyObject      // Get a copy of MyObject
  11609.   transform MyTrans // Apply the transformation
  11610.   translate -x*5   // Then move it 5 units left
  11611.  }
  11612.  object {
  11613.   MyObject      // Get another copy of MyObject
  11614.   transform MyTrans // Apply the same transformation
  11615.   translate x*5   // Then move this one 5 units right
  11616.  }
  11617. On extremely complex CSG objects with lots of components it may
  11618. speed up parsing if you apply a declared transformation rather
  11619. than the individual translate, rotate, scale, or matrix
  11620. modifiers. The transform is attached just once to each component.
  11621. Applying each individual translate, rotate, scale, or matrix
  11622. modifiers takes longer. This only affects parsing - rendering
  11623. works the same either way.
  11624.  
  11625.  
  11626. 4.3.4     Transforming Textures and Objects
  11627. When an object is transformed all textures attached to the object
  11628. at that time are transformed as well. This means that if you have
  11629. a translate, rotate, scale, or matrix modifier in an object
  11630. before a texture, then the texture will not be transformed. If
  11631. the transformation is after the texture then the texture will be
  11632. transformed with the object. If the transformation is inside the
  11633. texture statement then only the texture is affected. The shape
  11634. remains the same. For example:
  11635.  
  11636.  sphere { 0, 1
  11637.   texture { Jade } // texture identifier from TEXTURES.INC
  11638.   scale 3      // this scale affects both the
  11639.            // shape and texture
  11640.  }
  11641.  sphere { 0, 1
  11642.   scale 3      // this scale affects the shape only
  11643.   texture { Jade }
  11644.  }
  11645.  sphere { 0, 1
  11646.   texture {
  11647.    Jade
  11648.    scale 3     // this scale affects the texture only
  11649.   }
  11650.  }
  11651. Transformations may also be independently applied to pigment
  11652. patterns and surface normal patterns. Note that scaling a normal
  11653. pattern affects only the width and spacing. It does not affect
  11654. the apparent height or depth of the bumps. For example:
  11655.  
  11656.  box { <0, 0, 0>, <1, 1, 1>
  11657.   texture {
  11658.    pigment {
  11659.     checker Red, White
  11660.     scale 0.25 // This affects only the color pattern
  11661.    }
  11662.    normal {
  11663.     bumps 0.3 // This specifies apparent height of bumps
  11664.     scale 0.2 // Scales diameter and space between bumps
  11665.           // but not the height. Has no effect on
  11666.           // color pattern.
  11667.    }
  11668.    rotate y*45 // This affects the entire texture but
  11669.   }       // not the object.
  11670.  }
  11671.  
  11672.  
  11673. 4.4  Camera
  11674. The camera definition describes the position, projection type and
  11675. properties of the camera viewing the scene. Its syntax is:
  11676.  
  11677. CAMERA:
  11678.   camera{ [CAMERA_ITEMS...] }
  11679. CAMERA_ITEM:
  11680.   CAMERA_TYPE   |   CAMERA_VECTOR   |   CAMERA_MODIFIER   |
  11681.   CAMERA_IDENTIFIER
  11682. CAMERA_TYPE:
  11683.   perspective   |   orthographic   |   fisheye   |
  11684.   ultra_wide_angle   |
  11685.   omnimax   |   panoramic   |   cylinder CylinderType
  11686. CAMERA_VECTOR:
  11687.   location <Location>   |   right <Right>   |   up <Up>   |
  11688.   direction <Direction>   |
  11689.   sky <Sky>
  11690. CAMERA_MODIFIER:
  11691.   angle Degrees   |   look_at <Look_At>   |
  11692.   blur_samples Num_of_Samples   |   aperture Size   |
  11693.   focal_point <Point>   |
  11694.   confidence Blur_Confidence   |   varience Blur_Varience   |
  11695.   NORMAL   |
  11696.   TRANSFORMATION
  11697. Depending on the projection type some of the parameters are
  11698. required, some are optional and some aren't used. If no
  11699. projection type is given the perspective camera will be used
  11700. (pinhole camera). If no camera is specified a default camera is
  11701. used.  CAMERA_ITEMs may legally appear in any order but the order
  11702. of some items is critical to the proper functioning of the
  11703. camera.  Follow the guidelines in this document closely because
  11704. POV-Ray will not stop you from making mistakes.
  11705.  
  11706.  
  11707. 4.4.1     Placing the Camera
  11708. The POV-Ray camera has ten different models, each of which uses a
  11709. different projection method to project the scene onto your
  11710. screen.  Regardless of the projection type all cameras use the
  11711. location, right, up, direction, and keywords to determine the
  11712. location and orientation of the camera. The type keywords and
  11713. these four vectors fully define the camera.  All other camera
  11714. modifiers adjust how the camera does its job.  The meaning of
  11715. these vectors and other modifiers differ with the projection type
  11716. used. A more detailed explanation of the camera types follows
  11717. later.  In the sub-sections which follows, we explain how to
  11718. place and orient the camera by the use of these four vectors and
  11719. the sky and look_at modifiers.  You may wish to refer to the
  11720. illustration of the perspective camera below as you read about
  11721. these vectors.
  11722.  
  11723.  
  11724.  
  11725.                                 
  11726.                                 
  11727.                      The perspective camera.
  11728.                                 
  11729.  
  11730. 4.4.1.1   Location and Look_At
  11731. Under many circumstances just two vectors in the camera statement
  11732. are all you need to position the camera: location and look_at
  11733. vectors. For example:
  11734.  
  11735.  camera {
  11736.   location <3,5,-10>
  11737.   look_at <0,2,1>
  11738.  }
  11739. The location is simply the x, y, z coordinates of the camera. The
  11740. camera can be located anywhere in the ray-tracing universe. The
  11741. default location is <0,0,0>. The look_at vector tells POV-Ray to
  11742. pan and tilt the camera until it is looking at the specified x,
  11743. y, z coordinates. By default the camera looks at a point one unit
  11744. in the z-direction from the location.
  11745.  
  11746. The look_at modifier should almost always be the last item in the
  11747. camera statement. If other camera items are placed after the
  11748. look_at vector then the camera may not continue to look at the
  11749. specified point.
  11750.  
  11751.  
  11752. 4.4.1.2   The Sky Vector
  11753. Normally POV-Ray pans left or right by rotating about the y-axis
  11754. until it lines up with the look_at point and then tilts straight
  11755. up or down until the point is met exactly. However you may want
  11756. to slant the camera sideways like an airplane making a banked
  11757. turn. You may change the tilt of the camera using the sky vector.
  11758. For example:
  11759.  
  11760.  camera {
  11761.   location <3,5,-10>
  11762.   sky   <1,1,0>
  11763.   look_at <0,2,1>
  11764.  }
  11765. This tells POV-Ray to roll the camera until the top of the camera
  11766. is in line with the sky vector. Imagine that the sky vector is an
  11767. antenna pointing out of the top of the camera. Then it uses the
  11768. sky vector as the axis of rotation left or right and then to tilt
  11769. up or down in line with the sky until pointing at the look_at
  11770. point. In effect you're telling POV-Ray to assume that the sky
  11771. isn't straight up. Note that the sky vector must appear before
  11772. the look_at vector.
  11773.  
  11774. The sky vector does nothing on its own. It only modifies the way
  11775. the look_at vector turns the camera. The default value is
  11776. sky<0,1,0>.
  11777.  
  11778.  
  11779. 4.4.1.3   Angle
  11780. The angle keyword followed by a float expression specifies the
  11781. (horizontal) viewing angle in degrees of the camera used. Even
  11782. though it is possible to use the direction vector to determine
  11783. the viewing angle for the perspective camera it is much easier to
  11784. use the angle keyword.
  11785.  
  11786. When you specify the angle, POV-Ray adjusts the length of the
  11787. direction vector accordingly.  The formula used is
  11788. direction_length = 0.5 * right_length / tan(angle / 2) where
  11789. right_length is the length of the right vector.  You should
  11790. therefore specify the direction and right vectors before the
  11791. angle keyword.  The right vector is explained in the next
  11792. section.
  11793.  
  11794. There is no limitation to the viewing angle except for the
  11795. perspective projection. If you choose viewing angles larger than
  11796. 360 degrees you'll see repeated images of the scene (the way the
  11797. repetition takes place depends on the camera). This might be
  11798. useful for special effects.
  11799.  
  11800.  
  11801. 4.4.1.4   The Direction Vector
  11802. You will probably not need to explicitly specify or change the
  11803. camera direction vector but it is described here in case you do.
  11804. It tells POV-Ray the initial direction to point the camera before
  11805. moving it with the look_at or rotate vectors (the default value
  11806. is direction<0,0,1>). It may also be used to control the
  11807. (horizontal) field of view with some types of projection. The
  11808. length of the vector determines the distance of the viewing plane
  11809. from the camera's location.  A shorter direction vector gives a
  11810. wider view while a longer vector zooms in for close-ups.  In
  11811. early versions of POV-Ray, this was the only way to adjust field
  11812. of view.  However zooming should now be done using the easier to
  11813. use angle keyword.
  11814.  
  11815. If you are using the ultra_wide_angle, panoramic, or cylindrical
  11816. projection you should use a unit length direction vector to avoid
  11817. strange results.
  11818.  
  11819. The length of the direction vector doesn't matter when using the
  11820. orthographic, fisheye, or omnimax projection types.
  11821.  
  11822.  
  11823. 4.4.1.5   Up and Right Vectors
  11824. The primary purpose of the up and right vectors is to tell POV-
  11825. Ray the relative height and width of the view screen. The default
  11826. values are:
  11827.  
  11828.  right 4/3*x
  11829.  up y
  11830. In the default perspective camera, these two vectors also define
  11831. the initial plane of the view screen before moving it with the
  11832. look_at or rotate vectors.  The length of the right vector
  11833. (together with the direction vector) may also be used to control
  11834. the (horizontal) field of view with some types of projection.
  11835. The look_at modifier changes both up and right so you should
  11836. always specify them before look_at.  Also the angle calculation
  11837. depends on the right vector so right should precede it.
  11838.  
  11839. Most camera types treat the up and right vectors the same as the
  11840. perspective type.  However several make special use of them.  In
  11841. the orthographic projection: The lengths of the up and right
  11842. vectors set the size of the viewing window regardless of the
  11843. direction vector length, which is not used by the orthographic
  11844. camera.
  11845.  
  11846. When using cylindrical projection: types 1 and 3, the axis of the
  11847. cylinder lies along the up vector and the width is determined by
  11848. the length of right vector or it may be overridden with the angle
  11849. vector. In type 3 the up vector determines how many units high
  11850. the image is. For example if you have up 4*y on a camera at the
  11851. origin. Only points from y=2 to y=-2 are visible. All viewing
  11852. rays are perpendicular to the y-axis. For type 2 and 4, the
  11853. cylinder lies along the right vector. Viewing rays for type 4 are
  11854. perpendicular to the right vector.
  11855.  
  11856. Note that the up, right, and direction vectors should always
  11857. remain perpendicular to each other or the image will be
  11858. distorted. If this is not the case a warning message will be
  11859. printed. The vista buffer will not work for non-perpendicular
  11860. camera vectors.  If you specify the 3 vectors as initially
  11861. perpendicular and do not explicitly re-specify the after any
  11862. look_at or rotate vectors, the everything will work fine.
  11863.  
  11864.  
  11865. 4.4.1.5.1 Aspect Ratio
  11866. Together the up and right vectors define the aspect ratio (height
  11867. to width ratio) of the resulting image. The default values
  11868. up<0,1,0> and right<1.33,0,0> result in an aspect ratio of 4 to
  11869. 3. This is the aspect ratio of a typical computer monitor. If you
  11870. wanted a tall skinny image or a short wide panoramic image or a
  11871. perfectly square image you should adjust the up and right vectors
  11872. to the appropriate proportions.
  11873.  
  11874. Most computer video modes and graphics printers use perfectly
  11875. square pixels. For example Macintosh displays and IBM SVGA modes
  11876. 640x480, 800x600 and 1024x768 all use square pixels. When your
  11877. intended viewing method uses square pixels then the width and
  11878. height you set with the Width and Height options or +W or +H
  11879. switches should also have the same ratio as the up and right
  11880. vectors. Note that 640/480 = 4/3 so the ratio is proper for this
  11881. square pixel mode.
  11882.  
  11883. Not all display modes use square pixels however. For example IBM
  11884. VGA mode 320x200 and Amiga 320x400 modes do not use square
  11885. pixels. These two modes still produce a 4/3 aspect ratio image.
  11886. Therefore images intended to be viewed on such hardware should
  11887. still use 4/3 ratio on their up and right vectors but the pixel
  11888. settings will not be 4/3.
  11889.  
  11890. For example:
  11891.  
  11892.  camera {
  11893.   location <3,5,-10>
  11894.   up    <0,1,0>
  11895.   right  <1,0,0>
  11896.   look_at <0,2,1>
  11897.  }
  11898. This specifies a perfectly square image. On a square pixel
  11899. display like SVGA you would use pixel settings such as +W480
  11900. +H480 or +W600 +H600. However on the non-square pixel Amiga
  11901. 320x400 mode you would want to use values of +W240 +H400 to
  11902. render a square image.
  11903.  
  11904. The bottom line issue is this: the up and right vectors should
  11905. specify the artist's intended aspect ratio for the image and the
  11906. pixel settings should be adjusted to that same ratio for square
  11907. pixels and to an adjusted pixel resolution for non-square pixels.
  11908. The up and right vectors should not be adjusted based on non-
  11909. square pixels.
  11910.  
  11911.  
  11912. 4.4.1.5.2 Handedness
  11913. The right vector also describes the direction to the right of the
  11914. camera. It tells POV-Ray where the right side of your screen is.
  11915. The sign of the right vector can be used to determine the
  11916. handedness of the coordinate system in use. The default value is:
  11917. right<1.33,0,0>.  This means that the +x-direction is to the
  11918. right. It is called a left-handed system because you can use your
  11919. left hand to keep track of the axes. Hold out your left hand with
  11920. your palm facing to your right. Stick your thumb up. Point
  11921. straight ahead with your index finger. Point your other fingers
  11922. to the right. Your bent fingers are pointing to the +x-direction.
  11923. Your thumb now points into +y-direction. Your index finger points
  11924. into the +z-direction.
  11925.  
  11926. To use a right-handed coordinate system, as is popular in some
  11927. CAD programs and other ray-tracers, make the same shape using
  11928. your right hand. Your thumb still points up in the +y-direction
  11929. and your index finger still points forward in the +z-direction
  11930. but your other fingers now say the +x-direction is to the left.
  11931. That means that the right side of your screen is now in the -x-
  11932. direction. To tell POV-Ray to act like this you can use a
  11933. negative x value in the right vector such as: right<-1.33,0,0>.
  11934. Since having x values increasing to the left doesn't make much
  11935. sense on a 2D screen you now rotate the whole thing 180 degrees
  11936. around by using a positive z value in your camera's location. You
  11937. end up with something like this.
  11938.  
  11939.  camera {
  11940.   location <0,0,10>
  11941.   up    <0,1,0>
  11942.   right  <-1.33,0,0>
  11943.   look_at <0,0,0>
  11944.  }
  11945. Now when you do your ray-tracer's aerobics, as explained in the
  11946. section "Understanding POV-Ray's Coordinate System", you use your
  11947. right hand to determine the direction of rotations.
  11948.  
  11949. In a two dimensional grid, x is always to the right and y is up.
  11950. The two versions of handedness arise from the question of whether
  11951. z points into the screen or out of it and which axis in your
  11952. computer model relates to up in the real world.
  11953.  
  11954. Architectural CAD systems, like AutoCAD, tend to use the God's
  11955. Eye orientation that the z-axis is the elevation and is the
  11956. model's up direction. This approach makes sense if you're an
  11957. architect looking at a building blueprint on a computer screen. z
  11958. means up, and it increases towards you, with x and y still across
  11959. and up the screen. This is the basic right handed system.
  11960.  
  11961. Stand alone rendering systems, like POV-Ray, tend to consider you
  11962. as a participant. You're looking at the screen as if you were a
  11963. photographer standing in the scene. The up direction in the model
  11964. is now y, the same as up in the real world and x is still to the
  11965. right, so z must be depth, which increases away from you into the
  11966. screen. This is the basic left handed system.
  11967.  
  11968.  
  11969. 4.4.1.6   Transforming the Camera
  11970. The various transformations such as translate and rotate
  11971. modifiers can re-position the camera once you've defined it. For
  11972. example:
  11973.  
  11974.  camera {
  11975.   location < 0, 0, 0>
  11976.   direction < 0, 0, 1>
  11977.   up    < 0, 1, 0>
  11978.   right   < 1, 0, 0>
  11979.   rotate  <30, 60, 30>
  11980.   translate < 5, 3, 4>
  11981.  }
  11982. In this example, the camera is created, then rotated by 30
  11983. degrees about the x-axis, 60 degrees about the y-axis and 30
  11984. degrees about the z-axis, then translated to another point in
  11985. space.
  11986.  
  11987.  
  11988. 4.4.2     Types of Projection
  11989. The following list explains the different projection types that
  11990. can be used with the camera. The most common types are the
  11991. perspective and orthographic projections.  In general the
  11992. CAMERA_TYPE should be the first item in a camera statement.  If
  11993. none is specified, the perspective camera is the default.
  11994.  
  11995. Perspective projection: The perspective specifies the default
  11996. perspective camera which simulates the classic pinhole camera.
  11997. The (horizontal) viewing angle is either determined by the ratio
  11998. between the length of the direction vector and the length of the
  11999. right vector or by the optional keyword angle, which is the
  12000. preferred way. The viewing angle has to be larger than 0 degrees
  12001. and smaller than 180 degrees. See the figure in "Placing the
  12002. Camera" for the geometry of the perspective camera.
  12003.  
  12004. Orthographic projection: This projection uses parallel camera
  12005. rays to create an image of the scene. The size of the image is
  12006. determined by the lengths of the right and up vectors.
  12007.  
  12008. If you add the orthographic keyword after all other parameters of
  12009. a perspective camera you'll get an orthographic view with the
  12010. same image area, i.e. the size of the image is the same. In this
  12011. case you needn't specify the lengths of the right and up vector
  12012. because they'll be calculated automatically. You should be aware
  12013. though that the visible parts of the scene change when switching
  12014. from perspective to orthographic view. As long as all objects of
  12015. interest are near the look_at point they'll be still visible if
  12016. the orthographic camera is used. Objects farther away may get out
  12017. of view while nearer objects will stay in view.
  12018.  
  12019. Fisheye projection: This is a spherical projection. The viewing
  12020. angle is specified by the angle keyword. An angle of 180 degrees
  12021. creates the "standard" fisheye while an angle of 360 degrees
  12022. creates a super-fisheye ("I-see-everything-view"). If you use
  12023. this projection you should get a circular image. If this isn't
  12024. the case, i.e. you get an elliptical image, you should read
  12025. "Aspect Ratio".
  12026.  
  12027. Ultra wide angle projection: This projection is somewhat similar
  12028. to the fisheye but it projects the image onto a rectangle instead
  12029. of a circle. The viewing angle can be specified using the angle
  12030. keyword.
  12031.  
  12032. Omnimax projection: The omnimax projection is a 180 degrees
  12033. fisheye that has a reduced viewing angle in the vertical
  12034. direction. In reality this projection is used to make movies that
  12035. can be viewed in the dome-like Omnimax theaters. The image will
  12036. look somewhat elliptical. The angle keyword isn't used with this
  12037. projection.
  12038.  
  12039. Panoramic projection: This projection is called "cylindrical
  12040. equirectangular projection". It overcomes the degeneration
  12041. problem of the perspective projection if the viewing angle
  12042. approaches 180 degrees. It uses a type of cylindrical projection
  12043. to be able to use viewing angles larger than 180 degrees with a
  12044. tolerable lateral-stretching distortion. The angle keyword is
  12045. used to determine the viewing angle.
  12046.  
  12047. Cylindrical projection: Using this projection the scene is
  12048. projected onto a cylinder. There are four different types of
  12049. cylindrical projections depending on the orientation of the
  12050. cylinder and the position of the viewpoint. A float value in the
  12051. range 1 to 4 must follow the cylinder keyword.  The viewing angle
  12052. and the length of the up or right vector determine the dimensions
  12053. of the camera and the visible image. The camera to use is
  12054. specified by a number. The types are:
  12055. 1 vertical cylinder, fixed viewpoint
  12056. 2 horizontal cylinder, fixed
  12057.   viewpoint
  12058. 3 vertical cylinder, viewpoint moves
  12059.   along the cylinder's axis
  12060. 4 horizontal cylinder, viewpoint
  12061.   moves along the cylinder's axis
  12062. You should note that the vista buffer can only be used with the
  12063. perspective and orthographic camera.
  12064.  
  12065.  
  12066. 4.4.3     Focal Blur
  12067. POV-Ray can simulate focal depth-of-field by shooting a number of
  12068. sample rays from jittered points within each pixel and averaging
  12069. the results.
  12070.  
  12071. To turn on focal blur, you must specify the aperture keyword
  12072. followed by a float value which determines the depth of the
  12073. sharpness zone. Large apertures give a lot of blurring, while
  12074. narrow apertures will give a wide zone of sharpness. Note that,
  12075. while this behaves as a real camera does, the values for aperture
  12076. are purely arbitrary and are not related to f-stops.
  12077.  
  12078. You must also specify the blur_samples keyword followed by an
  12079. integer value specifying the maximum number of rays to use for
  12080. each pixel. More rays give a smoother appearance but is slower.
  12081. By default no focal blur is used, i. e. the default aperture is 0
  12082. and the default number of samples is 0.
  12083.  
  12084. The center of the zone of sharpness is specified by the
  12085. focal_point vector.  Objects close to this point are in focus and
  12086. those farther from that point are more blurred.  The default
  12087. value is focal_point<0,0,0>.
  12088.  
  12089. Although blur_samples specifies the maximum number of samples,
  12090. there is an adaptive mechanism that stops shooting rays when a
  12091. certain degree of confidence has been reached.  At that point,
  12092. shooting more rays would not result in a significant change.  The
  12093. confidence and variance keywords are followed by float values to
  12094. control the adaptive function. The confidence value is used to
  12095. determine when the samples seem to be close enough to the correct
  12096. color. The variance value specifies an acceptable tolerance on
  12097. the variance of the samples taken so far. In other words, the
  12098. process of shooting sample rays is terminated when the estimated
  12099. color value is very likely (as controlled by the confidence
  12100. probability) near the real color value.
  12101.  
  12102. Since the confidence is a probability its values can range from 0
  12103. to 1 (the default is 0.9, i. e. 90%). The value for the variance
  12104. should be in the range of the smallest displayable color
  12105. difference (the default is 1/128).
  12106.  
  12107. Larger confidence values will lead to more samples, slower traces
  12108. and better images. The same holds for smaller variance
  12109. thresholds.
  12110.  
  12111.  
  12112. 4.4.4     Camera Ray Perturbation
  12113. The optional normal may be used to assign a normal pattern to the
  12114. camera.  For example:
  12115.  
  12116.  camera{
  12117.    location Here
  12118.    look_at There
  12119.    normal{bumps 0.5}
  12120.  }
  12121. All camera rays will be perturbed using this pattern. The image
  12122. will be distorted as though you were looking through bumpy glass
  12123. or seeing a reflection off of a bumpy surface.  This lets you
  12124. create special effects. See the animated scene camera2.pov for an
  12125. example.  See "Normal" for information on normal patterns.
  12126.  
  12127.  
  12128. 4.4.5     Camera Identifiers
  12129. Camera identifiers may be declared to make scene files more
  12130. readable and to parameterize scenes so that changing a single
  12131. declaration changes many values. You may declare several camera
  12132. identifiers if you wish. This makes it easy to quickly change
  12133. cameras. An identifier is declared as follows.
  12134.  
  12135. CAMERA_DECLARATION:
  12136.   #declare IDENTIFIER = CAMERA  |
  12137.   #local IDENTIFIER = CAMERA
  12138. Where IDENTIFIER is the name of the identifier up to 40
  12139. characters long and CAMERA is any valid camera statement. See
  12140. "#declare vs. #local" for information on identifier scope.  Here
  12141. is an example...
  12142.  
  12143.  #declare Long_Lens =
  12144.   camera {
  12145.    location -z*100
  12146.    angle 3
  12147.   }
  12148.  #declare Short_Lens =
  12149.   camera {
  12150.    location -z*50
  12151.    angle 15
  12152.   }
  12153.  camera {
  12154.   Long_Lens  // edit this line to change lenses
  12155.   look_at Here
  12156.  }
  12157.  
  12158.  
  12159. 4.5  Objects
  12160. Objects are the building blocks of your scene. There are a lot of
  12161. different types of objects supported by POV-Ray.  In the sections
  12162. which follow, we describe "Finite Solid Primitives", "Finite
  12163. Patch Primitives", "Infinite Solid Primitives", and "Light
  12164. Sources". These primitive shapes may be combined into complex
  12165. shapes using "Constructive Solid Geometry" or CSG.
  12166.  
  12167. The basic syntax of an object is a keyword describing its type,
  12168. some floats, vectors or other parameters which further define its
  12169. location and/or shape and some optional object modifiers such as
  12170. texture, pigment, normal, finish, interior, bounding, clipping or
  12171. transformations.  Specifically the syntax is:
  12172.  
  12173. OBJECT:
  12174.   FINITE_SOLID_OBJECT   |   FINITE_PATCH_OBJECT   |
  12175.   INFINITE_SOLID_OBJECT   |   CSG_OBJECT   |   LIGHT_SOURCE   |
  12176.   object { OBJECT_IDENTIFIER  [OBJECT_MODIFIERS...] }
  12177. FINITE_SOLID_OBJECT:
  12178.   BLOB   |   BOX   |   CONE   |   CYLINDER   |   HEIGHT_FIELD
  12179.   |   JULIA_FRACTAL   |
  12180.   LATHE   |   PRISM   |   SPHERE   |   SUPERELLIPSOID   |   SOR
  12181.   |   TEXT   |   TORUS
  12182. FINITE_PATCH_OBJECT:
  12183.   BICUBIC_PATCH   |   DISC   |   MESH   |   POLYGON   |
  12184.   TRIANGLE   |   SMOOTH_TRIANGLE
  12185. INFINITE_SOLID_OBJECT:
  12186.   PLANE   |   POLY   |   CUBIC   |   QUARTIC   |   QUADRIC
  12187. CSG_OBJECT:
  12188.   UNION   |   INTERSECTION   |   DIFFERENCE   |   MERGE
  12189. Object identifiers may be declared to make scene files more
  12190. readable and to parameterize scenes so that changing a single
  12191. declaration changes many values. An identifier is declared as
  12192. follows.
  12193.  
  12194. OBJECT_DECLARATION:
  12195.   #declare IDENTIFIER = OBJECT   |
  12196.   #local IDENTIFIER = OBJECT
  12197. Where IDENTIFIER is the name of the identifier up to 40
  12198. characters long and OBJECT is any valid object.  Note that to
  12199. invoke an object identifier, you wrap it in an object{...}
  12200. statement.  You use the object statement regardless of what type
  12201. of object it originally was.  Although early versions of POV-Ray
  12202. required this object wrapper all of the time, now it is only used
  12203. with OBJECT_IDENTIFIERS.
  12204.  
  12205. Object modifiers are covered in detail later.  However here is a
  12206. brief overview.
  12207.  
  12208. The texture describes the surface properties of the object.
  12209. Complete details are in "Textures".  Textures are combinations of
  12210. pigments, normals, and finishes. In the section "Pigment" you'll
  12211. learn how to specify the color or pattern of colors inherent in
  12212. the. In "Normal" we describe a method of simulating various
  12213. patterns of bumps, dents, ripples or waves by modifying the
  12214. surface normal vector. The section on "Finish" describes the
  12215. reflective properties of the surface.  The "Interior" is a new
  12216. feature in POV-Ray 3.1.  It contains information about the
  12217. interior of the object which was formerly contained in the finish
  12218. and halo parts of a texture.  Interior items are no longer part
  12219. of the texture.  Instead, they attach directly to the objects.
  12220. The halo feature has been discontinued and replaced with a new
  12221. feature called "Media" which replaces both halo and atmosphere.
  12222.  
  12223. Bounding shapes are finite, invisible shapes which wrap around
  12224. complex, slow rendering shapes in order to speed up rendering
  12225. time. Clipping shapes are used to cut away parts of shapes to
  12226. expose a hollow interior. Transformations tell the ray-tracer how
  12227. to move, size or rotate the shape and/or the texture in the
  12228. scene.
  12229.  
  12230.  
  12231. 4.5.1     Finite Solid Primitives
  12232. There are thirteen different solid finite primitive shapes: blob,
  12233. box, cone, cylinder, height field, Julia fractal, lathe, prisms,
  12234. sphere, superellipsoid, surface of revolution, text object and
  12235. torus. These have a well-defined inside and can be used in CSG
  12236. (see section "Constructive Solid Geometry"). They are finite and
  12237. respond to automatic bounding.  You may specify an interior for
  12238. these objects.
  12239.  
  12240.  
  12241. 4.5.1.1   Blob
  12242. Blobs are an interesting and flexible object type. Mathematically
  12243. they are iso-surfaces of scalar fields, i.e. their surface is
  12244. defined by the strength of the field in each point. If this
  12245. strength is equal to a threshold value you're on the surface
  12246. otherwise you're not.
  12247.  
  12248. Picture each blob component as an object floating in space. This
  12249. object is filled with a field that has its maximum at the center
  12250. of the object and drops off to zero at the object's surface. The
  12251. field strength of all those components are added together to form
  12252. the field of the blob. Now POV-Ray looks for points where this
  12253. field has a given value, the threshold value. All these points
  12254. form the surface of the blob object. Points with a greater field
  12255. value than the threshold value are considered to be inside while
  12256. points with a smaller field value are outside.
  12257.  
  12258. There's another, simpler way of looking at blobs. They can be
  12259. seen as a union of flexible components that attract or repel each
  12260. other to form a blobby organic looking shape. The components'
  12261. surfaces actually stretch out smoothly and connect as if they
  12262. were made of honey or something like that.
  12263.  
  12264. The syntax for blob is defined as follows:
  12265.  
  12266. BLOB:
  12267.   blob { BLOB_ITEM... [BLOB_MODIFIERS...]}
  12268. BLOB_ITEM:
  12269.   sphere{<Center>, Radius, [ strength ] Strength
  12270.   [COMPONENT_MODIFIER...] }   |
  12271.   cylinder{<End1>, <End2>, Radius, [ strength ] Strength
  12272.   [COMPONENT_MODIFIER...] }   |
  12273.   component Strength, Radius, <Center>   |
  12274.   threshold Amount
  12275. COMPONENT_MODIFIER:
  12276.   TEXTURE   |   PIGMENT   |   NORMAL   |   FINISH   |
  12277.   TRANSFORMATION
  12278. BLOB_MODIFIER:
  12279.   hierarchy [Boolean]   |
  12280.   sturm [Boolean]   |
  12281.   OBJECT_MODIFIER
  12282. The threshold keyword is followed by a float value which
  12283. determines the total field strength value that POV-Ray is looking
  12284. for. The default value if none is specified is threshold 1.0.  By
  12285. following the ray out into space and looking at how each blob
  12286. component affects the ray, POV-Ray will find the points in space
  12287. where the field strength is equal to the threshold value. The
  12288. following list shows some things you should know about the
  12289. threshold value.
  12290.  
  12291. 1) The threshold value must be positive.
  12292. 2) A component disappears if the threshold value is greater than
  12293.   its strength.
  12294. 3) As the threshold value gets larger, the surface you see gets
  12295.   closer to the centers of the components.
  12296. 4) As the threshold value gets smaller, the surface you see gets
  12297.   closer to the surface of the components.
  12298. Cylindrical components are specified by a cylinder statement.
  12299. The center of the end-caps of the cylinder is defined by the
  12300. vectors <End1> and <End2>.  Next is the float value of the Radius
  12301. followed by the float Strength.  These vectors and floats are
  12302. required and should be separated by commas.  The keyword strength
  12303. may optionally precede the strength value. The cylinder has
  12304. hemispherical caps at each end.
  12305.  
  12306. Spherical components are specified by a sphere statement.  The
  12307. location is defined by the vector <Center>.  Next is the float
  12308. value of the Radius followed by the float Strength.  These vector
  12309. and float values are required and should be separated by commas.
  12310. The keyword strength may optionally precede the strength value.
  12311.  
  12312. You usually will apply a single texture to the entire blob
  12313. object, and you typically use transformations to change its size,
  12314. location, and orientation.  However both the cylinder and sphere
  12315. statements may have individual texture, pigment, normal, finish,
  12316. and transformations applied to them.  You may not apply separate
  12317. interior statements to the components but you may specify one for
  12318. the entire blob.  Note that by unevenly scaling a spherical
  12319. component you can create ellipsoidal components. The tutorial
  12320. section on "Blob Object" illustrates individually textured blob
  12321. components and many other blob examples.
  12322.  
  12323. The component keyword is an obsolete method for specifying a
  12324. spherical component and is only used for compatibility with
  12325. earlier POV-Ray versions.  It may not have textures or
  12326. transformations individually applied to it.
  12327.  
  12328. The strength parameter of either type of blob component is a
  12329. float value specifying the field strength at the center of the
  12330. object. The strength may be positive or negative. A positive
  12331. value will make that component attract other components while a
  12332. negative value will make it repel other components. Components in
  12333. different, separate blob shapes do not affect each other.
  12334.  
  12335. You should keep the following things in mind.
  12336.  
  12337. 1) The strength value may be positive or negative. Zero is a bad
  12338.   value, as the net result is that no field was added --- you
  12339.   might just as well have not used this component.
  12340. 2) If strength is positive, then POV-Ray will add the component's
  12341.   field to the space around the center of the component. If this
  12342.   adds enough field strength to be greater than the threshold
  12343.   value you will see a surface.
  12344. 3) If the strength value is negative, then POV-Ray will subtract
  12345.   the component's field from the space around the center of the
  12346.   component. This will only do something if there happen to be
  12347.   positive components nearby. What happens is that the surface
  12348.   around any nearby positive components will be dented away from
  12349.   the center of the negative component.
  12350. After all components and the optional threshold value have been
  12351. specified you may specify zero or more blob modifiers. A blob
  12352. modifier is any regular object modifier or the hierarchy or sturm
  12353. keywords.
  12354.  
  12355. The components of each blob object are internally bounded by a
  12356. spherical bounding hierarchy to speed up blob intersection tests
  12357. and other operations. By using the optional keyword hierarchy
  12358. followed by an optional boolean float value to turn it off or on.
  12359. By default it is on.
  12360.  
  12361. The calculations for blobs must be very accurate. If this shape
  12362. renders improperly you may add the keyword sturm followed by an
  12363. optional boolean float value to turn it off or on POV-Ray's
  12364. slower-yet-more-accurate Sturmian root solver. By default it is
  12365. off.
  12366.  
  12367. An example of a three component blob is:
  12368.  
  12369.  blob {
  12370.   threshold 0.6
  12371.   sphere { <.75, 0, 0>, 1, 1 }
  12372.   sphere { <-.375, .64952, 0>, 1, 1 }
  12373.   sphere { <-.375, -.64952, 0>, 1, 1 }
  12374.   scale 2
  12375.  }
  12376. If you have a single blob component then the surface you see will
  12377. just look like the object used, i.e. a sphere or a cylinder, with
  12378. the surface being somewhere inside the surface specified for the
  12379. component. The exact surface location can be determined from the
  12380. blob equation listed below (you will probably never need to know
  12381. this, blobs are more for visual appeal than for exact modeling).
  12382.  
  12383. For the more mathematically minded, here's the formula used
  12384. internally by POV-Ray to create blobs. You don't need to
  12385. understand this to use blobs. The density of the blob field of a
  12386. single component is:
  12387.  
  12388.                                 
  12389.                                 
  12390. where distance is the distance of a given point from the
  12391. spherical blob's center or cylinder blob's axis.  This formula
  12392. has the nice property that it is exactly equal to the strength
  12393. parameter at the center of the component and drops off to exactly
  12394. 0 at a distance from the center of the component that is equal to
  12395. the radius value. The density formula for more than one blob
  12396. component is just the sum of the individual component densities.
  12397.  
  12398.  
  12399. 4.5.1.2   Box
  12400. A simple box can be defined by listing two corners of the box
  12401. using the following syntax for a box statement:
  12402.  
  12403. BOX:
  12404.   box { <Corner_1>, <Corner_2> [OBJECT_MODIFIERS...]}
  12405.                                 
  12406.                                 
  12407.                      The geometry of a box.
  12408.                                 
  12409. Where <Corner_1> and <Corner_2> are vectors defining the x, y, z
  12410. coordinates of the opposite corners of the box.
  12411.  
  12412. Note that all boxes are defined with their faces parallel to the
  12413. coordinate axes. They may later be rotated to any orientation
  12414. using the rotate keyword.
  12415.  
  12416. Boxes are calculated efficiently and make good bounding shapes
  12417. (if manually bounding seems to be necessary).
  12418.  
  12419.  
  12420. 4.5.1.3   Cone
  12421. The cone statement creates a finite length cone or a frustum (a
  12422. cone with the point cut off).  The syntax is:
  12423.  
  12424. CONE:
  12425.   cone { <Base_Point>, Base_Radius, <Cap_Point>, Cap_Radius
  12426.      [ open ][OBJECT_MODIFIERS...]
  12427.   }
  12428.                                 
  12429.                                 
  12430.                      The geometry of a cone.
  12431.                                 
  12432. Where <Base_Point> and < Cap_Point> are vectors defining the x,
  12433. y, z coordinates of the center of the cone's base and cap and
  12434. Base_Radius and Cap_Radius are float values for the corresponding
  12435. radii.
  12436.  
  12437. Normally the ends of a cone are closed by flat planes which are
  12438. parallel to each other and perpendicular to the length of the
  12439. cone. Adding the optional keyword open after Cap_Radius will
  12440. remove the end caps and results in a tapered hollow tube like a
  12441. megaphone or funnel.
  12442.  
  12443.  
  12444. 4.5.1.4   Cylinder
  12445. The cylinder statement creates finite length cylinder with
  12446. parallel end caps The syntax is:
  12447.  
  12448. CYLINDER:
  12449.   cylinder{ <Base_Point>, <Cap_Point>, Radius
  12450.      [ open ][OBJECT_MODIFIERS...]
  12451.   }
  12452.                                 
  12453.                                 
  12454.                    The geometry of a cylinder.
  12455.                                 
  12456. Where <Base_Point> and <Cap_Point> are vectors defining the x, y,
  12457. z coordinates of the cylinder's base and cap and Radius is a
  12458. float value for the radius.
  12459.  
  12460. Normally the ends of a cylinder are closed by flat planes which
  12461. are parallel to each other and perpendicular to the length of the
  12462. cylinder. Adding the optional keyword open after the radius will
  12463. remove the end caps and results in a hollow tube.
  12464.  
  12465.  
  12466. 4.5.1.5   Height Field
  12467. Height fields are fast, efficient objects that are generally used
  12468. to create mountains or other raised surfaces out of hundreds of
  12469. triangles in a mesh. The height_field statement syntax is:
  12470.  
  12471. HEIGHT_FIELD:
  12472.   height_field{ HF_TYPE "filename" [HF_MODIFIER...] }
  12473. HF_TYPE:
  12474.   gif   |   tga   |   pot   |   png   |   pgm   |   ppm   |
  12475.   sys
  12476. HF_MODIFIER:
  12477.   hierarchy [Boolean]   |
  12478.   smooth [Boolean]   |
  12479.   water_level Level   |
  12480.   OBJECT_MODIFIER
  12481. A height field is essentially a one unit wide by one unit long
  12482. square with a mountainous surface on top. The height of the
  12483. mountain at each point is taken from the color number or palette
  12484. index of the pixels in a graphic image file. The maximum height
  12485. is one, which corresponds to the maximum possible color or
  12486. palette index value in the image file.
  12487.  
  12488.                                 
  12489.                                 
  12490.      The size and orientation of an un-scaled height field.
  12491.                                 
  12492. The mesh of triangles corresponds directly to the pixels in the
  12493. image file. Each square formed by four neighboring pixels is
  12494. divided into two triangles. An image with a resolution of N*M
  12495. pixels has (N-1)*(M-1) squares that are divided into 2*(N-1)*(M-
  12496. 1) triangles.
  12497.  
  12498.                                 
  12499.                                 
  12500.  Four pixels of an image and the resulting heights and triangles
  12501.                       in the height field.
  12502.                                 
  12503. The resolution of the height field is influenced by two factors:
  12504. the resolution of the image and the resolution of the color/index
  12505. values. The size of the image determines the resolution in the x-
  12506. and z-direction. A larger image uses more triangles and looks
  12507. smoother. The resolution of the color/index value determines the
  12508. resolution along the y-axis. A height field made from an 8 bit
  12509. image can have 256 different height levels while one made from a
  12510. 16 bit image can have up to 65536 different height levels. Thus
  12511. the second height field will look much smoother in the y-
  12512. direction if the height field is created appropriately.
  12513.  
  12514. The size/resolution of the image does not affect the size of the
  12515. height field. The un-scaled height field size will always be 1 by
  12516. 1 by 1. Higher resolution image files will create smaller
  12517. triangles, not larger height fields.
  12518.  
  12519. There are six or possibly seven types of files which can define a
  12520. height field. The image file type used to create a height field
  12521. is specified by one of the keywords gif, tga, pot, png, pgm, ppm,
  12522. and possibly sys which is a system specific (e. g. Windows BMP or
  12523. Macintosh Pict) format file. The GIF, PNG, PGM, and possibly SYS
  12524. format files are the only ones that can be created using a
  12525. standard paint program. Though there are paint programs for
  12526. creating TGA image files they won't be of much use for creating
  12527. the special 16 bit TGA files used by POV-Ray (see below and
  12528. "HF_Gray_16" for more details).
  12529.  
  12530. In an image file like GIF that uses a color palette the color
  12531. number is the palette index at a given pixel. Use a paint program
  12532. to look at the palette of a GIF image. The first color is palette
  12533. index zero, the second is index one, the third is index two and
  12534. so on. The last palette entry is index 255. Portions of the image
  12535. that use low palette entries will result in lower parts of the
  12536. height field. Portions of the image that use higher palette
  12537. entries will result in higher parts of the height field.
  12538.  
  12539. Height fields created from GIF files can only have 256 different
  12540. height levels because the maximum number of colors in a GIF file
  12541. is 256.
  12542.  
  12543. The color of the palette entry does not affect the height of the
  12544. pixel. Color entry 0 could be red, blue, black or orange but the
  12545. height of any pixel that uses color entry 0 will always be 0.
  12546. Color entry 255 could be indigo, hot pink, white or sky blue but
  12547. the height of any pixel that uses color entry 255 will always be
  12548. 1.
  12549.  
  12550. You can create height field GIF images with a paint program or a
  12551. fractal program like Fractint. You can usually get Fractint from
  12552. most of the same sources as POV-Ray.
  12553.  
  12554. A POT file is essentially a GIF file with a 16 bit palette. The
  12555. maximum number of colors in a POT file is 65536. This means a POT
  12556. height field can have up to 65536 possible height values. This
  12557. makes it possible to have much smoother height fields. Note that
  12558. the maximum height of the field is still 1 even though more
  12559. intermediate values are possible. At the time of this writing the
  12560. only program that created POT files was a freeware MS-Dos/Windows
  12561. program called Fractint. POT files generated with this fractal
  12562. program create fantastic landscapes.
  12563.  
  12564. The TGA and PPM file formats may be used as a storage device for
  12565. 16 bit numbers rather than an image file. These formats use the
  12566. red and green bytes of each pixel to store the high and low bytes
  12567. of a height value. These files are as smooth as POT files but
  12568. they must be generated with special custom-made programs. Several
  12569. programs can create TGA heightfields in the format POV uses, such
  12570. as Gforge and Terrain Maker.
  12571.  
  12572. PNG format heightfields are usually stored in the form of a
  12573. grayscale image with black corresponding to lower and white to
  12574. higher parts of the height field. Because PNG files can store up
  12575. to 16 bits in grayscale images they will be as smooth as TGA and
  12576. PPM images. Since they are grayscale images you will be able to
  12577. view them with a regular image viewer. gforge can create 16-bit
  12578. heightfields in PNG format. Color PNG images will be used in the
  12579. same way as TGA and PPM images.
  12580.  
  12581. SYS format is a platform specific file format. See your platform
  12582. specific documentation for details.
  12583.  
  12584. In addition to all the usual object modifiers, there are three
  12585. additional height field modifiers available.
  12586.  
  12587. The optional water_level parameter may be added after the file
  12588. name. It consists of the keyword water_level followed by a float
  12589. value telling the program to ignore parts of the height field
  12590. below that value. The default value is zero and legal values are
  12591. between zero and one. For example water_level 0.5 tells POV-Ray
  12592. to only render the top half of the height field. The other half
  12593. is below the water and couldn't be seen anyway. Using water_level
  12594. renders faster than cutting off the lower part using CSG or
  12595. clipping. This term comes from the popular use of height fields
  12596. to render landscapes. A height field would be used to create
  12597. islands and another shape would be used to simulate water around
  12598. the islands. A large portion of the height field would be
  12599. obscured by the water so the water_level parameter was introduced
  12600. to allow the ray-tracer to ignore the unseen parts of the height
  12601. field. water_level is also used to cut away unwanted lower values
  12602. in a height field. For example if you have an image of a fractal
  12603. on a solid colored background, where the background color is
  12604. palette entry 0, you can remove the background in the height
  12605. field by specifying, water_level 0.001.
  12606.  
  12607. Normally height fields have a rough, jagged look because they are
  12608. made of lots of flat triangles. Adding the keyword smooth causes
  12609. POV-Ray to modify the surface normal vectors of the triangles in
  12610. such a way that the lighting and shading of the triangles will
  12611. give a smooth look. This may allow you to use a lower resolution
  12612. file for your height field than would otherwise be needed.
  12613. However, smooth triangles will take longer to render.  The
  12614. default value is off.  You may optionally use a boolean value
  12615. such as smooth on or smooth off.
  12616.  
  12617. In order to speed up the intersection tests an one-level bounding
  12618. hierarchy is available. By default it is always used but it can
  12619. be switched off using hierarchy off to improve the rendering
  12620. speed for small height fields (i.e. low resolution images).  You
  12621. may optionally use a boolean value such as hierarchy on or
  12622. hierarchy off.
  12623.  
  12624.  
  12625. 4.5.1.6   Julia Fractal
  12626. A julia fractal object is a 3-D slice of a 4-D object created by
  12627. generalizing the process used to create the classic Julia sets.
  12628. You can make a wide variety of strange objects using the
  12629. julia_fractal statement including some that look like bizarre
  12630. blobs of twisted taffy. The julia_fractal syntax is:
  12631.  
  12632. JULIA_FRACTAL:
  12633.   julia_fractal{ <4D_Julia_Parameter> [JF_ITEM...]
  12634.   [OBJECT_MODIFIER...] }
  12635. JF_ITEM:
  12636.   ALGEBRA_TYPE   |   FUNCTION_TYPE   |
  12637.   max_iteration Count   |   precision Amt   |
  12638.   slice <4D_Normal>, Distance
  12639. ALGEBRA_TYPE:
  12640.   quaternion   |   hypercomplex
  12641. FUNCTION_TYPE:
  12642.   sqr   |   cube   |   exp   |   reciprocal   |   sin   |   asin
  12643.   |
  12644.   sinh   |   asinh   |   cos   |   acos   |   cosh   |   acosh
  12645.   |
  12646.   tan   |   atan   |   tanh   |   atanh   |   log   |   pwr(
  12647.   X_Val, Y_Val )
  12648. The required 4-D vector <4D_Julia_Parameter> is the classic Julia
  12649. parameter p in the iterated formula f(h) + p.
  12650.  
  12651. The julia fractal object is calculated by using an algorithm that
  12652. determines whether an arbitrary point h(0) in 4-D space is inside
  12653. or outside the object. The algorithm requires generating the
  12654. sequence of vectors h(0), h(1), ... by iterating the formula
  12655. h(n+1) = f(h(n)) + p (n = 0, 1, ..., max_iteration-1) where p is
  12656. the fixed 4-D vector parameter of the julia fractal and f() is
  12657. one of the functions sqr, cube, ... specified by the presence of
  12658. the corresponding keyword. The point h(0) that begins the
  12659. sequence is considered inside the julia fractal object if none of
  12660. the vectors in the sequence escapes a hypersphere of radius 4
  12661. about the origin before the iteration number reaches the integer
  12662. max_iteration value. As you increase max_iteration, some points
  12663. escape that did not previously escape, forming the julia fractal.
  12664. Depending on the <4D_Julia_Parameter>, the julia fractal object
  12665. is not necessarily connected; it may be scattered fractal dust.
  12666. Using a low max_iteration can fuse together the dust to make a
  12667. solid object. A high max_iteration is more accurate but slows
  12668. rendering. Even though it is not accurate, the solid shapes you
  12669. get with a low, max_iteration value can be quite interesting.  If
  12670. none is specified, the default is max_iteration 20.
  12671.  
  12672. Since the mathematical object described by this algorithm is four-
  12673. dimensional and POV-Ray renders three dimensional objects, there
  12674. must be a way to reduce the number of dimensions of the object
  12675. from four dimensions to three. This is accomplished by
  12676. intersecting the 4-D fractal with a 3-D "plane" defined by the
  12677. slice modifier and then projecting the intersection to 3-D space.
  12678. The keyword is followed by 4D vector and a float separated by a
  12679. comma.  The slice plane is the 3-D space that is perpendicular to
  12680. <4D_Normal> and is Distance units from the origin. Zero length
  12681. <4D_Normal> vectors or a  <4D_Normal> vector with a zero fourth
  12682. component are illegal.  If none is specified, the default is
  12683. slice <0,0,0,1>,0.
  12684.  
  12685. You can get a good feel for the four dimensional nature of a
  12686. julia fractal by using POV-Ray's animation feature to vary a
  12687. slice's Distance parameter. You can make the julia fractal appear
  12688. from nothing, grow, then shrink to nothing as Distancechanges,
  12689. much as the cross section of a 3-D object changes as it passes
  12690. through a plane.
  12691.  
  12692. The precision parameter is a tolerance used in the determination
  12693. of whether points are inside or outside the fractal object.
  12694. Larger values give more accurate results but slower rendering.
  12695. Use as low a value as you can without visibly degrading the
  12696. fractal object's appearance but note values less than 1.0 are
  12697. clipped at 1.0.  The default if none is specified is precision
  12698. 20.
  12699.  
  12700. The presence of the keywords quaternion or hypercomplex determine
  12701. which 4-D algebra is used to calculate the fractal. The default
  12702. is quaternion. Both are 4-D generalizations of the complex
  12703. numbers but neither satisfies all the field properties (all the
  12704. properties of real and complex numbers that many of us slept
  12705. through in high school). Quaternions have non-commutative
  12706. multiplication and hypercomplex numbers can fail to have a
  12707. multiplicative inverse for some non-zero elements (it has been
  12708. proved that you cannot successfully generalize complex numbers to
  12709. four dimensions with all the field properties intact, so
  12710. something has to break). Both of these algebras were discovered
  12711. in the 19th century. Of the two, the quaternions are much better
  12712. known, but one can argue that hypercomplex numbers are more
  12713. useful for our purposes, since complex valued functions such as
  12714. sin, cos, etc. can be generalized to work for hypercomplex
  12715. numbers in a uniform way.
  12716.  
  12717. For the mathematically curious, the algebraic properties of these
  12718. two algebras can be derived from the multiplication properties of
  12719. the unit basis vectors 1 = <1,0,0,0>, i=< 0,1,0,0>, j=<0,0,1,0>
  12720. and k=< 0,0,0,1>. In both algebras 1 x = x 1 = x for any x (1 is
  12721. the multiplicative identity). The basis vectors 1 and i behave
  12722. exactly like the familiar complex numbers 1 and i in both
  12723. algebras.
  12724. Quaternion basis vector
  12725. multiplication rules:
  12726. ij = k           jk = i    ki = j
  12727. ji = -k          kj = -i   ik = -j
  12728. ii = jj = kk = - ijk = -1  
  12729. 1
  12730.  
  12731. Hypercomplex basis vector
  12732. multiplication rules:
  12733. ij = k           jk = -i   ki = -j
  12734. ji = k           kj = -i   ik = -j
  12735. ii = jj = kk = - ijk = 1   
  12736. 1
  12737. A distance estimation calculation is used with the quaternion
  12738. calculations to speed them up. The proof that this distance
  12739. estimation formula works does not generalize from two to four
  12740. dimensions but the formula seems to work well anyway, the absence
  12741. of proof notwithstanding!
  12742.  
  12743. The presence of one of the function keywords sqr, cube, etc.
  12744. determines which function is used for f(h) in the iteration
  12745. formula h(n+1) = f(h(n)) + p. The default is sqr. Most of the
  12746. function keywords work only if the hypercomplex keyword is
  12747. present. Only sqr and cube work with quaternion. The functions
  12748. are all familiar complex functions generalized to four
  12749. dimensions.
  12750.  
  12751.  
  12752. Function Keyword  Maps 4-D
  12753. value h to:
  12754. sqr       h*h
  12755. cube      h*h*h
  12756. exp       e raised to the
  12757.           power h
  12758. reciproca 1/h
  12759. l
  12760. sin       sine of h
  12761. asin      arcsine of h
  12762. sinh      hyperbolic sine of h
  12763. asinh     inverse hyperbolic
  12764.           sine of h
  12765. cos       cosine of h
  12766. acos      arccosine of h
  12767. cosh      hyperbolic cos of h
  12768. acosh     inverse hyperbolic
  12769.           cosine of h
  12770. tan       tangent of h
  12771. atan      arctangent of h
  12772. tanh      hyperbolic tangent
  12773.           of h
  12774. atanh     inverse hyperbolic
  12775.           tangent of h
  12776. log       natural logarithm of
  12777.           h
  12778. pwr(x,y)  h raised to the
  12779.           complex power x+iy
  12780. A simple example of a julia fractal object is:
  12781.  
  12782.  julia_fractal {
  12783.   <-0.083,0.0,-0.83,-0.025>
  12784.   quaternion
  12785.   sqr
  12786.   max_iteration 8
  12787.   precision 15
  12788.  }
  12789. The first renderings of julia fractals using quaternions were
  12790. done by Alan Norton and later by John Hart in the '80's. This new
  12791. POV-Ray implementation follows Fractint in pushing beyond what is
  12792. known in the literature by using hypercomplex numbers and by
  12793. generalizing the iterating formula to use a variety of
  12794. transcendental functions instead of just the classic Mandelbrot
  12795. z2 + c formula. With an extra two dimensions and eighteen
  12796. functions to work with, intrepid explorers should be able to
  12797. locate some new fractal beasts in hyperspace, so have at it!
  12798.  
  12799.  
  12800. 4.5.1.7   Lathe
  12801. The lathe is an object generated from rotating a two-dimensional
  12802. curve about an axis. This curve is defined by a set of points
  12803. which are connected by linear, quadratic, cubic or bezier spline
  12804. curves. The syntax is:
  12805.  
  12806. LATHE:
  12807.   lathe {
  12808.        [SPLINE_TYPE]  Number_Of_Points, <Point_1> <Point_2>...
  12809.   <Point_n>
  12810.        [LATHE_MODIFIER...]
  12811.   }
  12812. SPLINE_TYPE:
  12813.   linear_spline   |   quadratic_spline   |   cubic_spline   |
  12814.   bezier_spline
  12815. LATHE_MODIFIER:
  12816.   sturm   |   OBJECT_MODIFIER
  12817. The first item is a keyword specifying the type of spline.  The
  12818. default if none is specified is linear_spline.  The required
  12819. integer value Number_Of_Points specifies how many two-dimensional
  12820. points are used to define the curve. The points follow and are
  12821. specified by 2-D vectors.  The curve is not automatically closed,
  12822. i.e. the first and last points are not automatically connected.
  12823. You will have to do this by your own if you want a closed curve.
  12824. The curve thus defined is rotated about the y-axis to form the
  12825. lathe object which is centered at the origin.
  12826.  
  12827. The following examples creates a simple lathe object that looks
  12828. like a thick cylinder, i.e. a cylinder with a thick wall:
  12829.  
  12830.  lathe {
  12831.   linear_spline
  12832.   5,
  12833.   <2, 0>, <3, 0>, <3, 5>, <2, 5>, <2, 0>
  12834.   pigment {Red}
  12835.  }
  12836. The cylinder has an inner radius of 2 and an outer radius of 3,
  12837. giving a wall width of 1. It's height is 5 and it's located at
  12838. the origin pointing up, i.e. the rotation axis is the y-axis.
  12839. Note that the first and last point are equal to get a closed
  12840. curve.
  12841.  
  12842. The splines that are used by the lathe and prism objects are a
  12843. little bit difficult to understand. The basic concept of splines
  12844. is to draw a curve through a given set of points in a determined
  12845. way. The default linear_spline is the simplest spline because
  12846. it's nothing more than connecting consecutive points with a line.
  12847. This means that the curve that is drawn between two points only
  12848. depends on those two points. No additional information is taken
  12849. into account. The other splines are different in that they do
  12850. take other points into account when connecting two points.  This
  12851. creates a smooth curve and, in the case of the cubic spline,
  12852. produces smoother transitions at each point.
  12853.  
  12854. The quadratic_spline keyword creates splines that are made of
  12855. quadratic curves. Each of them connects two consecutive points.
  12856. Since those two points (call them second and third point) are not
  12857. sufficient to describe a quadratic curve the predecessor of the
  12858. second point is taken into account when the curve is drawn.
  12859. Mathematically the relationship (their location on the 2-D plane)
  12860. between the first and second point determines the slope of the
  12861. curve at the second point. The slope of the curve at the third
  12862. point is out of control. Thus quadratic splines look much
  12863. smoother than linear splines but the transitions at each point
  12864. are generally not smooth because the slopes on both sides of the
  12865. point are different.
  12866.  
  12867. The cubic_spline keyword creates splines overcome the transition
  12868. problem of quadratic splines because they also take the fourth
  12869. point into account when drawing the curve between the second and
  12870. third point. The slope at the fourth point is under control now
  12871. and allows a smooth transition at each point. Thus cubic splines
  12872. produce the most flexible and smooth curves.
  12873.  
  12874. The bezier_spline is an alternate kind of cubic spline.  Points 1
  12875. and 4 specify the end points of a segment and points 2 and 3 are
  12876. control points which specify the slope at the endpoints. Points 2
  12877. and 3 do not actually lie on the spline.  They adjust the slope
  12878. of the spline.  If you draw an imaginary line between point 1 and
  12879. 2, it represents the slope at point 1.  It is a line tangent to
  12880. the curve at point 1.  The greater the distance between 1 and 2,
  12881. the flatter the curve.  With a short tangent the spline can bend
  12882. more.  The same holds true for control point 3 and endpoint 4.
  12883. If you want the spline to be smooth between segments, point 3 and
  12884. 4 on one segment and point 1 and 2 on the next segment must form
  12885. a straight line and point 4 of one segment must be the same as
  12886. point one on the next segment.
  12887.  
  12888. You should note that the number of spline segments, i. e. curves
  12889. between two points, depends on the spline type used. For linear
  12890. splines you get n-1 segments connecting the points P[i],
  12891. i=1,...,n. A quadratic spline gives you n-2 segments because the
  12892. last point is only used for determining the slope as explained
  12893. above (thus you'll need at least three points to define a
  12894. quadratic spline). The same holds for cubic splines where you get
  12895. n-3 segments with the first and last point used only for slope
  12896. calculations (thus needing at least four points).  The bezier
  12897. spline requires 4 points per segment.
  12898.  
  12899. If you want to get a closed quadratic and cubic spline with
  12900. smooth transitions at the end points you have to make sure that
  12901. in the cubic case P[n-1] = P[2] (to get a closed curve), P[n] =
  12902. P[3] and P[n-2] = P[1] (to smooth the transition). In the
  12903. quadratic case P[n-1] = P[1] (to close the curve) and P[n] =
  12904. P[2].
  12905.  
  12906. The sturm keyword can be used to specify that the slower but more
  12907. accurate Sturmian root solver should be used.  Use it with the
  12908. quadratic spline lathe if the shape does not render properly.
  12909. Since a quadratic polynomial has to be solved for the linear
  12910. spline lathe the Sturmian root solver is not needed. In case of
  12911. cubic or bezier splines, the Sturmian root solver is always used
  12912. because a 6th order polynomial has to be solved.
  12913.  
  12914.  
  12915. 4.5.1.8   Prism
  12916. The prism is an object generated specifying one or more two-
  12917. dimensional, closed curves in the x-z plane and sweeping them
  12918. along y axis. These curves are defined by a set of points which
  12919. are connected by linear, quadratic, cubic or bezier splines.
  12920.  
  12921. The syntax for the prism is:
  12922.  
  12923. PRISM:
  12924.   prism { [PRISM_ITEMS...] Height_1, Height_2, Number_Of_Points,
  12925.        <Point_1>, <Point_2>, ... <Point_n>
  12926.        [ open ]
  12927.        [PRISM_MODIFIERS...]
  12928.   }
  12929. PRISM_ITEM:
  12930.   linear_spline   |   quadratic_spline   |   cubic_spline   |
  12931.   bezier_spline   |
  12932.   linear_sweep   |   conic_sweep
  12933. PRISM_MODIFIER:
  12934.   sturm   |   OBJECT_MODIFIER
  12935. The first items specify the spline type and sweep type.  The
  12936. defaults if none is specified is linear_spline and conic_sweep.
  12937. This is followed by two float values Height_1 and Height_2 which
  12938. are the y coordinates of the top and bottom of the prism. This is
  12939. followed by a float value specifying the number of 2-D points you
  12940. will use to define the prism. (This includes all control points
  12941. needed for quadratic, cubic and bezier splines). This is followed
  12942. by the specified number of 2-D vectors which define the shape in
  12943. the x-z plane.
  12944.  
  12945. The interpretation of the points depends on the spline type.  The
  12946. prism object allows you to use any number of sub-prisms inside
  12947. one prism statement (they are of the same spline and sweep type).
  12948. Wherever an even number of sub-prisms overlaps a hole appears.
  12949. Note you need not have multiple sub-prisms and they need not
  12950. overlap as these examples do.
  12951.  
  12952. In the linear_spline the first point specified is the start of
  12953. the first sub-prism.  The following points are connected by
  12954. straight lines.  If you specify a value identical to the first
  12955. point, this closes the sub-prism and next point starts a new one.
  12956. When you specify the value of that sub-prism's start, then it is
  12957. closed.  Each of the sub-prisms has to be closed by repeating the
  12958. first point of a sub-prism at the end of the sub-prism's point
  12959. sequence. In this example, there are two rectangular sub-prisms
  12960. nested inside each other to create a frame.
  12961.  
  12962.  prism {
  12963.   linear_spline
  12964.   0, 1, 10,
  12965.   <0,0>, <6,0>, <6,8>, <0,8>, <0,0>,  //outer rim
  12966.   <1,1>, <5,1>, <5,7>, <1,7>, <1,1>   //inner rim
  12967.  }
  12968. The last sub-prism of a linear spline prism is automatically
  12969. closed - just like the last sub-polygon in the polygon statement
  12970. - if the first and last point of the sub-polygon's point sequence
  12971. are not the same. This make it very easy to convert between
  12972. polygons and prisms. Quadratic, cubic and bezier splines are
  12973. never automatically closed.
  12974.  
  12975. In the quadratic_spline, each sub-prism needs an additional
  12976. control point at the beginning of each sub-prisms' point sequence
  12977. to determine the slope at the start of the curve. The first point
  12978. specified is the control point which is not actually part of the
  12979. spline.  The second point is the start of the spline.  The sub-
  12980. prism ends when this second point is duplicated.  The next point
  12981. is the control point of the next sub-prism.  The point after that
  12982. is the first point of the second sub-prism.  Here is an example:
  12983.  
  12984.  prism {
  12985.   quadratic_spline
  12986.   0, 1, 12,
  12987.   <1,-1>, <0,0>, <6,0>, <6,8>, <0,8>, <0,0>,  //outer rim
  12988.       //Control is <1,-1> and <0,0> is first & last point
  12989.   <2,0>, <1,1>, <5,1>, <5,7>, <1,7>, <1,1>   //inner rim
  12990.       //Control is <2,0> and <1,1> is first & last point
  12991.  }
  12992. In the cubic_spline, each sub-prism needs two additional control
  12993. points -- one at the beginning of each sub-prisms' point sequence
  12994. to determine the slope at the start of the curve and one at the
  12995. end. The first point specified is the control point which is not
  12996. actually part of the spline.  The second point is the start of
  12997. the spline.  The sub-prism ends when this second point is
  12998. duplicated.  The next point is the control point of the end of
  12999. the first sub-prism.  Next is the beginning control point of the
  13000. next sub-prism.  The point after that is the first point of the
  13001. second sub-prism.  Here is an example:
  13002.  
  13003.  prism {
  13004.   cubic_spline
  13005.   0, 1, 14,
  13006.   <1,-1>, <0,0>, <6,0>, <6,8>, <0,8>, <0,0>, <-1,1>, //outer rim
  13007.   //First control is <1,-1> and <0,0> is first & last point
  13008.   // Last control of first spline is <-1,1>
  13009.   <2,0>, <1,1>, <5,1>, <5,7>, <1,7>, <1,1>, <0,2> //inner rim
  13010.   //First control is <2,0> and <1,1> is first & last point
  13011.   // Last control of first spline is <0,2>
  13012.  }
  13013. The bezier_spline is an alternate kind of cubic spline.  Points 1
  13014. and 4 specify the end points of a segment and points 2 and 3 are
  13015. control points which specify the slope at the endpoints. Points 2
  13016. and 3 do not actually lie on the spline.  They adjust the slope
  13017. of the spline.  If you draw an imaginary line between point 1 and
  13018. 2, it represents the slope at point 1.  It is a line tangent to
  13019. the curve at point 1.  The greater the distance between 1 and 2,
  13020. the flatter the curve.  With a short tangent the spline can bend
  13021. more.  The same holds true for control point 3 and endpoint 4.
  13022. If you want the spline to be smooth between segments, point 3 and
  13023. 4 on one segment and point 1 and 2 on the next segment must form
  13024. a straight line and point 4 of one segment must be the same as
  13025. point one on the next segment.
  13026.  
  13027. By default linear sweeping is used to create the prism, i.e. the
  13028. prism's walls are perpendicular to the x-z-plane (the size of the
  13029. curve does not change during the sweep). You can also use
  13030. conic_sweep that leads to a prism with cone-like walls by scaling
  13031. the curve down during the sweep.
  13032.  
  13033. Like cylinders the prism is normally closed. You can remove the
  13034. caps on the prism by using the open keyword. If you do so you
  13035. shouldn't use it with CSG because the results may get wrong.
  13036.  
  13037. For an explanation of the spline concept read the description of
  13038. the "Lathe" object.  Also see the tutorials on "Lathe Object" and
  13039. "Prism Object".
  13040.  
  13041. The sturm keyword specifies the slower but more accurate Sturmian
  13042. root solver which may be used with the cubic or bezier spline
  13043. prisms if the shape does not render properly. The linear and
  13044. quadratic spline prisms do not need the Sturmian root solver.
  13045.  
  13046.  
  13047. 4.5.1.9   Sphere
  13048. The syntax of the sphere object is:
  13049.  
  13050. SPHERE:
  13051.   sphere { <Center>, Radius [OBJECT_MODIFIERS...] }
  13052.                                 
  13053.                                 
  13054.                     The geometry of a sphere.
  13055.                                 
  13056. Where <Center> is a vector specifying the x, y, z coordinates of
  13057. the center of the sphere and Radius is a float value specifying
  13058. the radius. Spheres may be scaled unevenly giving an ellipsoid
  13059. shape.
  13060.  
  13061. Because spheres are highly optimized they make good bounding
  13062. shapes (if manual bounding seems to be necessary).
  13063.  
  13064.  
  13065. 4.5.1.10  Superquadric Ellipsoid
  13066. The superellipsoid object creates a shape known as a superquadric
  13067. ellipsoid object.  It is an extension of the quadric ellipsoid.
  13068. It can be used to create boxes and cylinders with round edges and
  13069. other interesting shapes. Mathematically it is given by the
  13070. equation:
  13071.  
  13072.                                 
  13073.                                 
  13074. The values of e and n, called the east-west and north-south
  13075. exponent, determine the shape of the superquadric ellipsoid. Both
  13076. have to be greater than zero. The sphere is given by e = 1 and n
  13077. = 1.
  13078.  
  13079. The syntax of the superquadric ellipsoid is:
  13080.  
  13081. SUPERELLIPSOID:
  13082.   superellipsoid{ <Value_E, Value_N>  [OBJECT_MODIFIERS...] }
  13083. The 2-D vector specifies the e and n values in the equation
  13084. above.  The object sits at the origin and occupies a space about
  13085. the size of a box{<-1,-1,-1>,<1,1,1>}.
  13086.  
  13087. Two useful objects are the rounded box and the rounded cylinder.
  13088. These are declared in the following way.
  13089.  
  13090.  #declare Rounded_Box = superellipsoid { <Round, Round> }
  13091.  #declare Rounded_Cylinder = superellipsoid { <1, Round> }
  13092. The roundedness value Round determines the roundedness of the
  13093. edges and has to be greater than zero and smaller than one. The
  13094. smaller you choose the values, the smaller and sharper the edges
  13095. will get.
  13096.  
  13097. Very small values of e and n might cause problems with the root
  13098. solver (the Sturmian root solver cannot be used).
  13099.  
  13100.  
  13101. 4.5.1.11  Surface of Revolution
  13102. The sor object is a surface of revolution generated by rotating
  13103. the graph of a function about the y-axis. This function describes
  13104. the dependence of the radius from the position on the rotation
  13105. axis. The syntax is:
  13106.  
  13107. SOR:
  13108.   sor { Number_Of_Points,
  13109.        <Point_1>, <Point_2>, ... <Point_n>
  13110.        [ open ]
  13111.        [SOR_MODIFIERS...]
  13112.    }
  13113. SOR_MODIFIER:
  13114.   sturm   |   OBJECT_MODIFIER
  13115. The float value Number_Of_Points specifies the number of 2-D
  13116. vectors which follow. The points <Point_1> through <Point_n> are
  13117. two-dimensional vectors consisting of the radius and the
  13118. corresponding height, i.e. the position on the rotation axis.
  13119. These points are smoothly connected (the curve is passing through
  13120. the specified points) and rotated about the y-axis to form the
  13121. SOR object. The first and last points are only used to determine
  13122. the slopes of the function at the start and end point. They do
  13123. not actually lie on the curve.  The function used for the SOR
  13124. object is similar to the splines used for the lathe object. The
  13125. difference is that the SOR object is less flexible because it
  13126. underlies the restrictions of any mathematical function, i.e. to
  13127. any given point y on the rotation axis belongs at most one
  13128. function value, i.e. one radius value. You can't rotate closed
  13129. curves with the SOR object.
  13130.  
  13131. The optional keyword open allows you to remove the caps on the
  13132. SOR object. If you do this you shouldn't use it with CSG anymore
  13133. because the results may be wrong.
  13134.  
  13135. The SOR object is useful for creating bottles, vases, and things
  13136. like that. A simple vase could look like this:
  13137.  
  13138.  #declare Vase = sor {
  13139.   7,
  13140.   <0.000000, 0.000000>
  13141.   <0.118143, 0.000000>
  13142.   <0.620253, 0.540084>
  13143.   <0.210970, 0.827004>
  13144.   <0.194093, 0.962025>
  13145.   <0.286920, 1.000000>
  13146.   <0.468354, 1.033755>
  13147.   open
  13148.  }
  13149. One might ask why there is any need for a SOR object if there is
  13150. already a lathe object which is much more flexible. The reason is
  13151. quite simple. The intersection test with a SOR object involves
  13152. solving a cubic polynomial while the test with a lathe object
  13153. requires to solve of a 6th order polynomial (you need a cubic
  13154. spline for the same smoothness). Since most SOR and lathe objects
  13155. will have several segments this will make a great difference in
  13156. speed. The roots of the 3rd order polynomial will also be more
  13157. accurate and easier to find.
  13158.  
  13159. The sturm keyword may be added to specify the slower but more
  13160. accurate Sturmian root solver.  It may be used with the surface
  13161. of revolution object if the shape does not render properly.
  13162.  
  13163. The following explanations are for the mathematically interested
  13164. reader who wants to know how the surface of revolution is
  13165. calculated. Though it is not necessary to read on it might help
  13166. in understanding the SOR object.
  13167.  
  13168. The function that is rotated about the y-axis to get the final
  13169. SOR object is given by
  13170.  
  13171.                                 
  13172.                                 
  13173. with radius r and height h. Since this is a cubic function in h
  13174. it has enough flexibility to allow smooth curves.
  13175.  
  13176. The curve itself is defined by a set of n points P(i), i=0...n-1,
  13177. which are interpolated using one function for every segment of
  13178. the curve. A segment j, j=1...n-3, goes from point P(j) to point
  13179. P(j+1) and uses points P(j-1) and P(j+2) to determine the slopes
  13180. at the endpoints. If there are n points we will have n-3
  13181. segments. This means that we need at least four points to get a
  13182. proper curve.
  13183.  
  13184. The coefficients A(j), B(j), C(j) and D(j) are calculated for
  13185. every segment using the equation
  13186.  
  13187.                                 
  13188.                                 
  13189. where r(j) is the radius and h(j) is the height of point P(j).
  13190.  
  13191. The figure below shows the configuration of the points P(i), the
  13192. location of segment j, and the curve that is defined by this
  13193. segment.
  13194.  
  13195.                                 
  13196.                                 
  13197.  Segment j of n-3 segments in a point configuration of n points.
  13198.                                 
  13199.    The points describe the curve of a surface of revolution.'
  13200.                                 
  13201.  
  13202. 4.5.1.12  Text
  13203. A text object creates 3-D text as an extruded block letter.
  13204. Currently only TrueType fonts are supported but the syntax allows
  13205. for other font types to be added in the future. The syntax is:
  13206.  
  13207. TEXT_OBECT:
  13208.   text { ttf "fontname.ttf" "String_of_Text" Thickness, <Offset>
  13209.   [OBJECT_MODIFIERS...] }
  13210. Where fontname.ttf is the name of the TrueType font file.  It is
  13211. a quoted string literal or string expression. The string
  13212. expression which follows is the actual text of the string object.
  13213. It too may be a quoted string literal or string expression. See
  13214. section "Strings" for more on string expressions.
  13215.  
  13216. The text will start with the origin at the lower left, front of
  13217. the first character and will extend in the +x-direction. The
  13218. baseline of the text follows the x-axis and decenders drop into
  13219. the -y-direction.  The front of the character sits in the x-y-
  13220. plane and the text is extruded in the +z-direction. The front-to-
  13221. back thickness is specified by the required value Thickness.
  13222.  
  13223. Characters are generally sized so that 1 unit of vertical spacing
  13224. is correct. The characters are about 0.5 to 0.75 units tall.
  13225.  
  13226. The horizontal spacing is handled by POV-Ray internally including
  13227. any kerning information stored in the font. The required vector
  13228. <Offset> defines any extra translation between each character.
  13229. Normally you should specify a zero for this value. Specifying
  13230. 0.1*x would put additional 0.1 units of space between each
  13231. character.  Here is an example:
  13232.  
  13233.   text { ttf "timrom.ttf" "POV-Ray 3.1" 1, 0
  13234.     pigment { Red }
  13235.   }
  13236. Only printable characters are allowed in text objects. Characters
  13237. such as return, line feed, tabs, backspace etc. are not
  13238. supported.
  13239.  
  13240.  
  13241. 4.5.1.13  Torus
  13242. A torus is a 4th order quartic polynomial shape that looks like a
  13243. donut or inner tube. Because this shape is so useful and quartics
  13244. are difficult to define, POV-Ray lets you take a short-cut and
  13245. define a torus by:
  13246.  
  13247. TORUS:
  13248.   torus { Major, Minor [TORUS_MODIFIER...] }
  13249. TORUS_MODIFIER:
  13250.   sturm   |   OBJECT_MODIFIER
  13251. where Major is a float value giving the major radius and Minor is
  13252. a float specifying the minor radius. The major radius extends
  13253. from the center of the hole to the mid-line of the rim while the
  13254. minor radius is the radius of the cross-section of the rim. The
  13255. torus is centered at the origin and lies in the x-z-plane with
  13256. the y-axis sticking through the hole.
  13257.  
  13258.                                 
  13259.                                 
  13260.                Major and minor radius of a torus.
  13261.                                 
  13262. The torus is internally bounded by two cylinders and two rings
  13263. forming a thick cylinder. With this bounding cylinder the
  13264. performance of the torus intersection test is vastly increased.
  13265. The test for a valid torus intersection, i.e. solving a 4th order
  13266. polynomial, is only performed if the bounding cylinder is hit.
  13267. Thus a lot of slow root solving calculations are avoided.
  13268.  
  13269. Calculations for all higher order polynomials must be very
  13270. accurate. If the torus renders improperly you may add the keyword
  13271. sturm to use POV-Ray's slower-yet-more-accurate Sturmian root
  13272. solver.
  13273.  
  13274.  
  13275. 4.5.2     Finite Patch Primitives
  13276. There are six totally thin, finite objects which have no well-
  13277. defined inside. They are bicubic patch, disc, smooth triangle,
  13278. triangle, polygon and mesh. They may be combined in CSG union but
  13279. cannot be use in other types of CSG (or inside a clipped_by
  13280. statement). Because these types are finite POV-Ray can use
  13281. automatic bounding on them to speed up rendering time. As with
  13282. all shapes they can be translated, rotated and scaled.
  13283.  
  13284.  
  13285. 4.5.2.1   Bicubic Patch
  13286. A bicubic_patch is a 3D curved surface created from a mesh of
  13287. triangles. POV-Ray supports a type of bicubic patch called a
  13288. Bezier patch. A bicubic patch is defined as follows:
  13289.  
  13290. BICUBIC_PATCH:
  13291.   bicubic_patch {
  13292.        PATCH_ITEMS...
  13293.        <Point_1>,<Point_2>,<Point_3>,<Point_4>,
  13294.        <Point_5>,<Point_6>,<Point_7>,<Point_8>,
  13295.        <Point_9>,<Point_10>,<Point_11>,<Point_12>,
  13296.        <Point_13>,<Point_14>,<Point_15>,<Point_16>
  13297.        [OBJECT_MODIFIERS...]
  13298.   }
  13299. PATCH_ITEMS:
  13300.   type Patch_Type   |   u_steps Num_U_Steps   |   v_steps
  13301.   Num_V_Steps   |   flatness Flatness
  13302. The keyword type is followed by a float Patch_Type which
  13303. currently must be either 0 or 1. For type 0 only the control
  13304. points are retained within POV-Ray. This means that a minimal
  13305. amount of memory is needed but POV-Ray will need to perform many
  13306. extra calculations when trying to render the patch. Type 1
  13307. preprocesses the patch into many subpatches. This results in a
  13308. significant speedup in rendering at the cost of memory.
  13309.  
  13310. The four parameters type, flatness, u_steps and v_steps may
  13311. appear in any order. All but flatness are required.  They are
  13312. followed by 16 vectors (4 rows of 4) that define the x, y, z
  13313. coordinates of the 16 control points which define the patch. The
  13314. patch touches the four corner points <Point_1>, <Point_4>,
  13315. <Point_13> and <Point_16> while the other 12 points pull and
  13316. stretch the patch into shape. The Bezier surface is enclosed by
  13317. the convex hull formed by the 16 control points, this is known as
  13318. the convex hull property.
  13319.  
  13320. The keywords u_steps and v_steps are each followed by integer
  13321. values which tell how many rows and columns of triangles are the
  13322. minimum to use to create the surface. The maximum number of
  13323. individual pieces of the patch that are tested by POV-Ray can be
  13324. calculated from the following: pieces = 2^u_steps * 2^v_steps.
  13325.  
  13326. This means that you really should keep u_steps and v_steps under
  13327. 4. Most patches look just fine with u_steps 3 and v_steps 3,
  13328. which translates to 64 subpatches (128 smooth triangles).
  13329.  
  13330. As POV-Ray processes the Bezier patch it makes a test of the
  13331. current piece of the patch to see if it is flat enough to just
  13332. pretend it is a rectangle. The statement that controls this test
  13333. is specified with the flatness keyword followed by a float.
  13334. Typical flatness values range from 0 to 1 (the lower the slower).
  13335. The default if none is specified is 0.0.
  13336.  
  13337. If the value for flatness is 0 POV-Ray will always subdivide the
  13338. patch to the extend specified by u_steps and v_steps. If flatness
  13339. is greater than 0 then every time the patch is split, POV-Ray
  13340. will check to see if there is any need to split further.
  13341.  
  13342. There are both advantages and disadvantages to using a non-zero
  13343. flatness. The advantages include:
  13344.  
  13345.   -  If the patch isn't very curved, then this will be detected
  13346.   and POV-Ray won't waste a lot of time looking at the wrong
  13347.   pieces.
  13348.   -  If the patch is only highly curved in a couple of places,
  13349.   POV-Ray will keep subdividing there and concentrate it's
  13350.   efforts on the hard part.
  13351. The biggest disadvantage is that if POV-Ray stops subdividing at
  13352. a particular level on one part of the patch and at a different
  13353. level on an adjacent part of the patch there is the potential for
  13354. cracking. This is typically visible as spots within the patch
  13355. where you can see through. How bad this appears depends very
  13356. highly on the angle at which you are viewing the patch.
  13357.  
  13358. Like triangles, the bicubic patch is not meant to be generated by
  13359. hand. These shapes should be created by a special utility. You
  13360. may be able to acquire utilities to generate these shapes from
  13361. the same source from which you obtained POV-Ray.  Here is an
  13362. example:
  13363.  
  13364.   bicubic_patch {
  13365.     type 0
  13366.     flatness 0.01
  13367.     u_steps 4
  13368.     v_steps 4
  13369.     <0, 0, 2>, <1, 0, 0>, <2, 0, 0>, <3, 0,-2>,
  13370.     <0, 1  0>, <1, 1, 0>, <2, 1, 0>, <3, 1, 0>,
  13371.     <0, 2, 0>, <1, 2, 0>, <2, 2, 0>, <3, 2, 0>,
  13372.     <0, 3, 2>, <1, 3, 0>, <2, 3, 0>, <3, 3, -2>
  13373.   }
  13374. The triangles in a POV-Ray bicubic_patch are automatically
  13375. smoothed using normal interpolation but it is up to the user (or
  13376. the user's utility program) to create control points which
  13377. smoothly stitch together groups of patches.
  13378.  
  13379.  
  13380. 4.5.2.2   Disc
  13381. Another flat, finite object available with POV-Ray is the disc.
  13382. The disc is infinitely thin, it has no thickness. If you want a
  13383. disc with true thickness you should use a very short cylinder. A
  13384. disc shape may be defined by:
  13385.  
  13386. DISC:
  13387.   disc { <Center>, <Normal>, Radius [, Hole_Radius]
  13388.   [OBJECT_MODIFIERS...] }
  13389. The vector <Center> defines the x, y, z coordinates of the center
  13390. of the disc. The <Normal> vector describes its orientation by
  13391. describing its surface normal vector. This is followed by a float
  13392. specifying the Radius. This may be optionally followed by another
  13393. float specifying the radius of a hole to be cut from the center
  13394. of the disc.
  13395.  
  13396.  
  13397. 4.5.2.3   Mesh
  13398. The mesh object can be used to efficiently store large numbers of
  13399. triangles. Its syntax is:
  13400.  
  13401. MESH:
  13402.   mesh { MESH_TRIANGLE... [MESH_MODIFIER...] }
  13403. MESH_TRIANGLE:
  13404.   triangle { <Corner_1>, <Corner_2>, <Corner_3> [MESH_TEXTURE] }
  13405.   |
  13406.   smooth_triangle {
  13407.        <Corner_1>, <Normal_1>,
  13408.        <Corner_2>, <Normal_2>,
  13409.        <Corner_3>, <Normal_3>
  13410.        [MESH_TEXTURE]
  13411.   }
  13412. MESH_TEXTURE:
  13413.   texture { TEXTURE_IDENTIFIER }
  13414. MESH_MODIFIER:
  13415.   hierarchy [ Boolean ]   |   OBJECT_MODIFIER
  13416. Any number of triangle and/or smooth_triangle statements can be
  13417. used and each of those triangles can be individually textured by
  13418. assigning a texture identifier to it. The texture has to be
  13419. declared before the mesh is parsed. It is not possible to use
  13420. texture definitions inside the triangle or smooth triangle
  13421. statements. This is a restriction that is necessary for an
  13422. efficient storage of the assigned textures.  See "Triangle and
  13423. Smooth Triangle" for more information on triangles.
  13424.  
  13425. The mesh's components are internally bounded by a bounding box
  13426. hierarchy to speed up intersection testing. The bounding
  13427. hierarchy can be turned off with the hierarchy off keyword. This
  13428. should only be done if memory is short or the mesh consists of
  13429. only a few triangles.  The default is hierarchy on.
  13430.  
  13431. Copies of a mesh object refer to the same triangle data and thus
  13432. consume very little memory. You can easily trace hundred copies
  13433. of an 10000 triangle mesh without running out of memory (assuming
  13434. the first mesh fits into memory).
  13435.  
  13436. The mesh object has two advantages over a union of triangles: it
  13437. needs less memory and it is transformed faster. The memory
  13438. requirements are reduced by efficiently storing the triangles
  13439. vertices and normals. The parsing time for transformed meshes is
  13440. reduced because only the mesh object has to be transformed and
  13441. not every single triangle as it is necessary for unions.
  13442.  
  13443. The mesh object can currently only include triangle and smooth
  13444. triangle components. That restriction may change, allowing
  13445. polygonal components, at some point in the future.
  13446.  
  13447.  
  13448. 4.5.2.4   Polygon
  13449. The polygon object is useful for creating rectangles, squares and
  13450. other planar shapes with more than three edges. Their syntax is:
  13451.  
  13452. POLYGON:
  13453.   polygon { Number_Of_Points, <Point_1> <Point_2>... <Point_n>
  13454.   [OBJECT_MODIFIER...]}
  13455. The float Number_Of_Points tells how many points are used to
  13456. define the polygon.  The points <Point_1> through <Point_n>
  13457. describe the polygon or polygons.  A polygon can contain any
  13458. number of sub-polygons, either overlapping or not. In places
  13459. where an even number of polygons overlaps a hole appears. When
  13460. you repeat the first point of a sub-polygon, it closes it and
  13461. starts a new sub-polygon's point sequence. This means that all
  13462. points of a sub-polygon are different.
  13463.  
  13464. If the last sub-polygon is not closed a warning is issued and the
  13465. program automatically closes the polygon. This is useful because
  13466. polygons imported from other programs may not be closed, i.e.
  13467. their first and last point are not the same.
  13468.  
  13469. All points of a polygon are three-dimensional vectors that have
  13470. to lay on the same plane. If this is not the case an error
  13471. occurs. It is common to use two-dimensional vectors to describe
  13472. the polygon. POV-Ray assumes that the z value is zero in this
  13473. case.
  13474.  
  13475. A square polygon that matches the default planar image map is
  13476. simply:
  13477.  
  13478.   polygon {
  13479.     4,
  13480.     <0, 0>, <0, 1>, <1, 1>, <1, 0>
  13481.     texture {
  13482.       finish { ambient 1 diffuse 0 }
  13483.       pigment { image_map { gif "test.gif"  } }
  13484.     }
  13485.     //scale and rotate as needed here
  13486.   }
  13487. The sub-polygon feature can be used to generate complex shapes
  13488. like the letter "P", where a hole is cut into another polygon:
  13489.  
  13490.   #declare P = polygon {
  13491.     12,
  13492.     <0, 0>, <0, 6>, <4, 6>, <4, 3>, <1, 3>, <1, 0>, <0, 0>,
  13493.     <1, 4>, <1, 5>, <3, 5>, <3, 4>, <1, 4>
  13494.   }
  13495. The first sub-polygon (on the first line) describes the outer
  13496. shape of the letter "P". The second sub-polygon (on the second
  13497. line) describes the rectangular hole that is cut in the top of
  13498. the letter "P". Both rectangles are closed, i.e. their first and
  13499. last points are the same.
  13500.  
  13501. The feature of cutting holes into a polygon is based on the
  13502. polygon inside/outside test used. A point is considered to be
  13503. inside a polygon if a straight line drawn from this point in an
  13504. arbitrary direction crosses an odd number of edges (this is known
  13505. as Jordan's curve theorem).
  13506.  
  13507. Another very complex example showing one large triangle with
  13508. three small holes and three separate, small triangles is given
  13509. below:
  13510.  
  13511.   polygon {
  13512.     28,
  13513.     <0, 0> <1, 0> <0, 1> <0, 0>          // large outer triangle
  13514.     <.3, .7> <.4, .7> <.3, .8> <.3, .7>  // small outer triangle
  13515. #1
  13516.     <.5, .5> <.6, .5> <.5, .6> <.5, .5>  // small outer triangle
  13517. #2
  13518.     <.7, .3> <.8, .3> <.7, .4> <.7, .3>  // small outer triangle
  13519. #3
  13520.     <.5, .2> <.6, .2> <.5, .3> <.5, .2>  // inner triangle #1
  13521.     <.2, .5> <.3, .5> <.2, .6> <.2, .5>  // inner triangle #2
  13522.     <.1, .1> <.2, .1> <.1, .2> <.1, .1>  // inner triangle #3
  13523.   }
  13524.  
  13525. 4.5.2.5   Triangle and Smooth Triangle
  13526. The triangle primitive is available in order to make more complex
  13527. objects than the built-in shapes will permit. Triangles are
  13528. usually not created by hand but are converted from other files or
  13529. generated by utilities. A triangle is defined by
  13530.  
  13531. TRIANGLE:
  13532.   triangle { <Corner_1>, <Corner_2>, <Corner_3>
  13533.   [OBJECT_MODIFIER...] }
  13534. where <Corner_n> is a vector defining the x, y, z coordinates of
  13535. each corner of the triangle.
  13536.  
  13537. Because triangles are perfectly flat surfaces it would require
  13538. extremely large numbers of very small triangles to approximate a
  13539. smooth, curved surface. However much of our perception of smooth
  13540. surfaces is dependent upon the way light and shading is done. By
  13541. artificially modifying the surface normals we can simulate a
  13542. smooth surface and hide the sharp-edged seams between individual
  13543. triangles.
  13544.  
  13545. The smooth_triangle primitive is used for just such purposes. The
  13546. smooth triangles use a formula called Phong normal interpolation
  13547. to calculate the surface normal for any point on the triangle
  13548. based on normal vectors which you define for the three corners.
  13549. This makes the triangle appear to be a smooth curved surface. A
  13550. smooth triangle is defined by
  13551.  
  13552. SMOOTH_TRIANGLE:
  13553.   smooth_triangle {
  13554.        <Corner_1>, <Normal_1>,
  13555.        <Corner_2>, <Normal_2>,
  13556.        <Corner_3>, <Normal_3>
  13557.        [OBJECT_MODIFIER...]
  13558.   }
  13559. where the corners are defined as in regular triangles and
  13560. <Normal_n> is a vector describing the direction of the surface
  13561. normal at each corner.
  13562.  
  13563. These normal vectors are prohibitively difficult to compute by
  13564. hand. Therefore smooth triangles are almost always generated by
  13565. utility programs. To achieve smooth results, any triangles which
  13566. share a common vertex should have the same normal vector at that
  13567. vertex. Generally the smoothed normal should be the average of
  13568. all the actual normals of the triangles which share that point.
  13569.  
  13570. The mesh object is a way to combine many triangle and
  13571. smooth_triangle objects together in a very efficient way.  See
  13572. "Mesh" for details.
  13573.  
  13574.  
  13575. 4.5.3     Infinite Solid Primitives
  13576. There are five polynomial primitive shapes that are possibly
  13577. infinite and do not respond to automatic bounding. They are
  13578. plane, cubic, poly, quadric and quartic. They do have a well
  13579. defined inside and may be used in CSG and inside a clipped_by
  13580. statement. As with all shapes they can be translated, rotated and
  13581. scaled.
  13582.  
  13583.  
  13584. 4.5.3.1   Plane
  13585. The plane primitive is a simple way to define an infinite flat
  13586. surface. The plane is specified as follows:
  13587.  
  13588. PLANE:
  13589.   plane { <Normal>, Distance [OBJECT_MODIFIERS...] }
  13590. The <Normal> vector defines the surface normal of the plane. A
  13591. surface normal is a vector which points up from the surface at a
  13592. 90 degree angle. This is followed by a float value that gives the
  13593. distance along the normal that the plane is from the origin (that
  13594. is only true if the normal vector has unit length; see below).
  13595. For example:
  13596.  
  13597.   plane { <0, 1, 0>, 4 }
  13598. This is a plane where straight up is defined in the positive y-
  13599. direction. The plane is 4 units in that direction away from the
  13600. origin. Because most planes are defined with surface normals in
  13601. the direction of an axis you will often see planes defined using
  13602. the x, y or z built-in vector identifiers. The example above
  13603. could be specified as:
  13604.  
  13605.   plane { y, 4 }
  13606. The plane extends infinitely in the x- and z-directions. It
  13607. effectively divides the world into two pieces. By definition the
  13608. normal vector points to the outside of the plane while any points
  13609. away from the vector are defined as inside. This inside/outside
  13610. distinction is important when using planes in CSG and clipped_by.
  13611. It is also important when using fog or atmospheric media.  If you
  13612. place a camera on the "inside" half of the world, then the fog or
  13613. media will not appear.  Such issues arise in any solid object but
  13614. it is more common with planes.  Users typically know when they've
  13615. accidentally placed a camera inside a sphere or box but "inside a
  13616. plane" is an unusual concept.  You can reverse the inside/outside
  13617. properties of an object by adding the object modifier inverse.
  13618. See "Inverse" and "Empty and Solid Objects" for details.
  13619.  
  13620. A plane is called a polynomial shape because it is defined by a
  13621. first order polynomial equation. Given a plane:
  13622.  
  13623.   plane { <A, B, C>, D }
  13624. it can be represented by the equation  A*x + B*y + C*z -
  13625. D*sqrt(A2 + B2 + C2) = 0.
  13626.  
  13627. Therefore our example plane{y,4} is actually the polynomial
  13628. equation y=4. You can think of this as a set of all x, y, z
  13629. points where all have y values equal to 4, regardless of the x or
  13630. z values.
  13631.  
  13632. This equation is a first order polynomial because each term
  13633. contains only single powers of x, y or z. A second order equation
  13634. has terms like x2, y2, z2, xy, xz and yz. Another name for a 2nd
  13635. order equation is a quadric equation. Third order polys are
  13636. called cubics. A 4th order equation is a quartic. Such shapes are
  13637. described in the sections below.
  13638.  
  13639.  
  13640. 4.5.3.2   Poly, Cubic and Quartic
  13641. Higher order polynomial surfaces may be defined by the use of a
  13642. poly shape. The syntax is
  13643.  
  13644. POLY:
  13645.   poly { Order, <A1, A2, A3,... An> [POLY_MODIFIERS...] }
  13646. POLY_MODIFIERS:
  13647.   sturm   |   OBJECT_MODIFIER
  13648. where Order is an integer number from 2 to 7 inclusively that
  13649. specifies the order of the equation. A1, A2, ... An are float
  13650. values for the coefficients of the equation. There are m such
  13651. terms where
  13652.  
  13653.   n = ((Order+1)*(Order+2)*(Order+3))/6.
  13654.  
  13655. The cubic object is an alternate way to specify 3rd order polys.
  13656. Its syntax is:
  13657.  
  13658. CUBIC:
  13659.   cubic { <A1, A2, A3,... A20> [POLY_MODIFIERS...] }
  13660. Also 4th order equations may be specified with the quartic
  13661. object.  Its syntax is:
  13662.  
  13663. QUARTIC:
  13664.   quartic { <A1, A2, A3,... A35> [POLY_MODIFIERS...] }
  13665. The following table shows which polynomial terms correspond to
  13666. which x,y,z factors.  Remember cubic is actually a 3rd order
  13667. polynomial and quartic is 4th order.
  13668.    2n  3r 4th 5th 6th  7th         5t  6th  7th         6t 7t
  13669.   d   d                         h                 h  h
  13670. A1 x2  x3 x4  x5  x6   x7       A4 y3  xy3  x2y3    A8  z3 xz
  13671.                              1                 1      3
  13672. A2 xy  x2 x3y x4y x5y  x6y      A4 y2  xy2  x2y2    A8  z2 xz
  13673.       y                      2  z3  z3   z3      2      2
  13674. A3 xz  x2 x3z x4z x5z  x5z      A4 y2  xy2  x2y2    A8  z  xz
  13675.       z                      3  z2  z2   z2      3
  13676. A4 x   x2 x3  x4  x5   x5       A4 y2  xy2  x2y2    A8  1  x
  13677.                              4  z   z    z       4
  13678. A5 y2  xy x2y x3y x4y2 x5y2     A4 y2  xy2  x2y2    A8     y7
  13679.       2  2   2               5                 5
  13680. A6 yz  xy x2y x3y x4yz x5yz     A4 yz  xyz  x2yz    A8     y6
  13681.       z  z   z               6  4   4    4       6      z
  13682. A7 y   xy x2y x3y x4y  x5y      A4 yz  xyz  x2yz    A8     y6
  13683.                              7  3   3    3       7
  13684. A8 z2  xz x2z x3z x4z2 x5z2     A4 yz  xyz  x2yz    A8     y5
  13685.       2  2   2               8  2   2    2       8      z2
  13686. A9 z   xz x2z x3z x4z  x5z      A4 yz  xyz  x2yz    A8     y5
  13687.                              9                 9      z
  13688. A1 1   x  x2  x3  x4   x5       A5 y   xy   x2y     A9     y5
  13689. 0                            0                 0
  13690. A1     y3 xy3 x2y x3y3 x4y3     A5 z5  xz5  x2z5    A9     y4
  13691. 1            3               1                 1      z3
  13692. A1     y2 xy2 x2y x3y2 x4y2     A5 z4  xz4  x2z4    A9     y4
  13693. 2     z  z   2z  z    z       2                 2      z2
  13694. A1     y2 xy2 x2y x3y2 x4y2     A5 z3  xz3  x2z3    A9     y4
  13695. 3            2               3                 3      z
  13696. A1     yz xyz x2y x3yz x4yz     A5 z2  xz2  x2z2    A9     y4
  13697. 4     2  2   z2  2    2       4                 4
  13698. A1     yz xyz x2y x3yz x4yz     A5 z   xz   x2z     A9     y3
  13699. 5            z               5                 5      z4
  13700. A1     y  xy  x2y x3y  x4y      A5 1   x    x2      A9     y3
  13701. 6                            6                 6      z3
  13702. A1     z3 xz3 x2z x3z3 x4z3     A5     y6   xy6     A9     y3
  13703. 7            3               7                 7      z2
  13704. A1     z2 xz2 x2z x3z2 x4z2     A5     y5z  xy5z    A9     y3
  13705. 8            2               8                 8      z
  13706. A1     z  xz  x2z x3z  x4z      A5     y5   xy5     A9     y3
  13707. 9                            9                 9
  13708. A2     1  x   x2  x3   x4       A6     y4z  xy4z    A1     y2
  13709. 0                            0      2    2       00     z5
  13710. A2        y4  xy4 x2y4 x3y4     A6     y4z  xy4z    A1     y2
  13711. 1                            1                 01     z4
  13712. A2        y3z xy3 x2y3 x3y3     A6     y4   xy4     A1     y2
  13713. 2            z   z    z       2                 02     z3
  13714. A2        y3  xy3 x2y3 x3y3     A6     y3z  xy3z    A1     y2
  13715. 3                            3      3    3       03     z2
  13716. A2        y2z xy2 x2y2 x3y2     A6     y3z  xy3z    A1     y2
  13717. 4        2   z2  z2   z2      4      2    2       04     z
  13718. A2        y2z xy2 x2y2 x3y2     A6     y3z  xy3z    A1     y2
  13719. 5            z   z    z       5                 05
  13720. A2        y2  xy2 x2y2 x3y2     A6     y3   xy3     A1     yz
  13721. 6                            6                 06     6
  13722. A2        yz3 xyz x2yz x3yz     A6     y2z  xy2z    A1     yz
  13723. 7            3   3    3       7      4    4       07     5
  13724. A2        yz2 xyz x2yz x3yz     A6     y2z  xy2z    A1     yz
  13725. 8            2   2    2       8      3    3       08     4
  13726. A2        yz  xyz x2yz x3yz     A6     y2z  xy2z    A1     yz
  13727. 9                            9      2    2       09     3
  13728. A3        y   xy  x2y  x3y      A7     y2z  xy2z    A1     yz
  13729. 0                            0                 10     2
  13730. A3        z4  xz4 x2z4 x3z4     A7     y2   xy2     A1     yz
  13731. 1                            1                 11
  13732. A3        z3  xz3 x2z3 x3z3     A7     yz5  xyz5    A1     y
  13733. 2                            2                 12
  13734. A3        z2  xz2 x2z2 x3z2     A7     yz4  xyz4    A1     z7
  13735. 3                            3                 13
  13736. A3        z   xz  x2z  x3z      A7     yz3  xyz3    A1     z6
  13737. 4                            4                 14
  13738. A3        1   x   x2   x3       A7     yz2  xyz2    A1     z5
  13739. 5                            5                 15
  13740. A3            y5  xy5  x2y5     A7     yz   xyz     A1     z4
  13741. 6                            6                 16
  13742. A3            y4z xy4z x2y4     A7     y    xy      A1     z3
  13743. 7                     z       7                 17
  13744. A3            y4  xy4  x2y4     A7     z6   xz6     A1     z2
  13745. 8                            8                 18
  13746. A3            y3z xy3z x2y3     A7     z5   xz5     A1     z
  13747. 9            2   2    z2      9                 19
  13748. A4            y3z xy3z x2y3     A8     z4   xz4     A1     1
  13749. 0                     z       0                 20
  13750. Polynomial shapes can be used to describe a large class of shapes
  13751. including the torus, the lemniscate, etc. For example, to declare
  13752. a quartic surface requires that each of the coefficients (A1 ...
  13753. A35) be placed in order into a single long vector of 35 terms.
  13754.  
  13755. As an example let's define a torus the hard way. A Torus can be
  13756. represented by the equation:
  13757.  
  13758.  x4 + y4 + z4 + 2 x2 y2 + 2 x2 z2 + 2 y2 z2 -
  13759.  2 (r_02 + r_12) x2 + 2 (r_02 - r_12) y2 -
  13760.  2 (r_02 + r_12) z2 + (r_02 - r_12)2 = 0
  13761. Where r_0 is the major radius of the torus, the distance from the
  13762. hole of the donut to the middle of the ring of the donut, and r_1
  13763. is the minor radius of the torus, the distance from the middle of
  13764. the ring of the donut to the outer surface. The following object
  13765. declaration is for a torus having major radius 6.3 minor radius
  13766. 3.5 (Making the maximum width just under 20).
  13767.  
  13768.   // Torus having major radius sqrt(40), minor radius sqrt(12)
  13769.   quartic {
  13770.     < 1,   0,   0,   0,   2,   0,   0,   2,   0,
  13771.    -104,   0,   0,   0,   0,   0,   0,   0,   0,
  13772.       0,   0,   1,   0,   0,   2,   0,  56,   0,
  13773.       0,   0,   0,   1,   0, -104,  0, 784 >
  13774.     sturm
  13775.   }
  13776. Poly, cubic and quartics are just like quadrics in that you don't
  13777. have to understand what one is to use one. The file shapesq.inc
  13778. has plenty of pre-defined quartics for you to play with.
  13779.  
  13780. Polys use highly complex computations and will not always render
  13781. perfectly. If the surface is not smooth, has dropouts, or extra
  13782. random pixels, try using the optional keyword sturm in the
  13783. definition. This will cause a slower but more accurate
  13784. calculation method to be used. Usually, but not always, this will
  13785. solve the problem. If sturm doesn't work, try rotating or
  13786. translating the shape by some small amount.
  13787.  
  13788. There are really so many different polynomial shapes, we can't
  13789. even begin to list or describe them all. If you are interested
  13790. and mathematically inclined, an excellent reference book for
  13791. curves and surfaces where you'll find more polynomial shape
  13792. formulas is:
  13793.  
  13794.   "The CRC Handbook of Mathematical Curves and Surfaces"
  13795.   David von Seggern
  13796.   CRC Press, 1990
  13797.  
  13798. 4.5.3.3   Quadric
  13799. The quadric object can produce shapes like paraboloids (dish
  13800. shapes) and hyperboloids (saddle or hourglass shapes). It can
  13801. also produce ellipsoids, spheres, cones, and cylinders but you
  13802. should use the sphere, cone, and cylinder objects built into POV-
  13803. Ray because they are faster than the quadric version.  Note that
  13804. you do not confuse "quaDRic" with "quaRTic". A quadric is a 2nd
  13805. order polynomial while a quartic is 4th order. Quadrics render
  13806. much faster and are less error-prone but produce less complex
  13807. objects.  The syntax is:
  13808.  
  13809. QUADRIC:
  13810.   quadric { <A,B,C>,<D,E,F>,<G,H,I>,J  [OBJECT_MODIFIERS...] }
  13811. Although the syntax actually will parse 3 vector expressions
  13812. followed by a float, we traditionally have written the syntax as
  13813. above where A through J are float expressions.  These 10 float
  13814. that define a surface of x, y, z points which satisfy the
  13815. equation
  13816.  
  13817.  A x2 + B y2 + C z2 + D xy + E xz + F yz + G x + H y + I z + J =
  13818. 0
  13819. Different values of A, B, C, ... J will give different shapes. If
  13820. you take any three dimensional point and use its x, y and z
  13821. coordinates in the above equation the answer will be 0 if the
  13822. point is on the surface of the object. The answer will be
  13823. negative if the point is inside the object and positive if the
  13824. point is outside the object.  Here are some examples:
  13825. X2 + Y2 + Z2 -  Sphere
  13826. 1 = 0
  13827. X2 + Y2 - 1 = 0 Infinite cylinder
  13828.                 along the Z axis
  13829. X2 + Y2 - Z2 =  Infinite cone
  13830. 0               along the Z axis
  13831. The easiest way to use these shapes is to include the standard
  13832. file shapes.inc into your program. It contains several pre-
  13833. defined quadrics and you can transform these pre-defined shapes
  13834. (using translate, rotate and scale) into the ones you want. For a
  13835. complete list, see the file shapes.inc.
  13836.  
  13837.  
  13838. 4.5.4     Constructive Solid Geometry
  13839. In addition to all of the primitive shapes POV-Ray supports, you
  13840. can also combine multiple simple shapes into complex shapes using
  13841. Constructive Solid Geometry (CSG).  There are four basic types of
  13842. CSG operations: union, intersection, difference, and merge.  CSG
  13843. objects can be composed of primitives or other CSG objects to
  13844. create more, and more complex shapes.
  13845.  
  13846.  
  13847. 4.5.4.1   Inside and Outside
  13848. Most shape primitives, like spheres, boxes and blobs divide the
  13849. world into two regions. One region is inside the object and one
  13850. is outside. Given any point in space you can say it's either
  13851. inside or outside any particular primitive object. Well, it could
  13852. be exactly on the surface but this case is rather hard to
  13853. determine due to numerical problems.
  13854.  
  13855. Even planes have an inside and an outside. By definition, the
  13856. surface normal of the plane points towards the outside of the
  13857. plane. You should note that triangles and triangle-based shapes
  13858. cannot be used as solid objects in CSG since they have no well
  13859. defined inside and outside.
  13860.  
  13861. CSG uses the concepts of inside and outside to combine shapes
  13862. together as explained in the following sections.
  13863.  
  13864. Imagine you have two objects that partially overlap like shown in
  13865. the figure below. Four different areas of points can be
  13866. distinguished: points that are neither in object A nor in object
  13867. B, points that are in object A but not in object B, points that
  13868. are not in object A but in object B and last not least points
  13869. that are in object A and object B.
  13870.  
  13871.                                 
  13872.                                 
  13873.                     Two overlapping objects.
  13874.                                 
  13875. Keeping this in mind it will be quite easy to understand how the
  13876. CSG operations work.
  13877.  
  13878. When using CSG it is often useful to invert an object so that
  13879. it'll be inside-out. The appearance of the object is not changed,
  13880. just the way that POV-Ray perceives it. When the inverse keyword
  13881. is used the inside of the shape is flipped to become the outside
  13882. and vice versa.
  13883.  
  13884. The inside/outside distinction is not important for a union, but
  13885. is important for intersection, difference, and merge.Therefore
  13886. any objects may be combined using union but only solid objects,
  13887. i.e. objects that have a well-defined interior can be used in the
  13888. other kinds of CSG. The objects described in "Finite Patch
  13889. Primitives" have no well defined inside/outside.  All objects
  13890. described in the sections "Finite Solid Primitives" and "Infinite
  13891. Solid Primitives".
  13892.  
  13893.  
  13894. 4.5.4.2   Union
  13895.                                 
  13896.                                 
  13897.                     The union of two objects.
  13898.                                 
  13899. The simplest kind of CSG is the union. The syntax is:
  13900.  
  13901. UNION:
  13902.   union { OBJECTS...  [OBJECT_MODIFIERS...] }
  13903. Unions are simply glue used to bind two or more shapes into a
  13904. single entity that can be manipulated as a single object. The
  13905. image above shows the union of A and B. The new object created by
  13906. the union operation can be scaled, translated and rotated as a
  13907. single shape. The entire union can share a single texture but
  13908. each object contained in the union may also have its own texture,
  13909. which will override any texture statements in the parent object.
  13910.  
  13911. You should be aware that the surfaces inside the union will not
  13912. be removed. As you can see from the figure this may be a problem
  13913. for transparent unions. If you want those surfaces to be removed
  13914. you'll have to use the merge operations explained in a later
  13915. section.
  13916.  
  13917. The following union will contain a box and a sphere.
  13918.  
  13919.   union {
  13920.     box { <-1.5, -1, -1>, <0.5, 1, 1> }
  13921.     cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 }
  13922.   }
  13923. Earlier versions of POV-Ray placed restrictions on unions so you
  13924. often had to combine objects with composite statements.  Those
  13925. earlier restrictions have been lifted so composite is no longer
  13926. needed. It is still supported for backwards compatibility.
  13927.  
  13928.  
  13929. 4.5.4.3   Intersection
  13930. The intersection object creates a shape containing only those
  13931. areas where all components overlap.  A point is part an
  13932. intersection if it is inside both objects, A and B, as show in
  13933. the figure below.
  13934.  
  13935.                                 
  13936.                                 
  13937.                 The intersection of two objects.
  13938.                                 
  13939. The syntax is:
  13940.  
  13941. INTERSECTION:
  13942.   intersection { SOLID_OBJECTS...  [OBJECT_MODIFIERS...] }
  13943. The component objects must have well defined inside/outside
  13944. properties.  Patch objects are not allowed.  Note that if all
  13945. components do not overlap, the intersection object disappears.
  13946.  
  13947. Here is an example that overlaps:
  13948.  
  13949.   intersection {
  13950.     box { <-1.5, -1, -1>, <0.5, 1, 1> }
  13951.     cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 }
  13952.   }
  13953.  
  13954. 4.5.4.4   Difference
  13955. The CSG difference operation takes the intersection between the
  13956. first object and the inverse of all subsequent objects. Thus only
  13957. points inside object A and outside object B belong to the
  13958. difference of both objects.
  13959.  
  13960. The results is a subtraction of the 2nd shape from the first
  13961. shape as shown in the figure below.
  13962.  
  13963.                                 
  13964.                                 
  13965.                The difference between two objects.
  13966.                                 
  13967. The syntax is:
  13968.  
  13969. DIFFERENCE:
  13970.   difference { SOLID_OBJECTS...  [OBJECT_MODIFIERS...] }
  13971. The component objects must have well defined inside/outside
  13972. properties.  Patch objects are not allowed.  Note that if the
  13973. first object is entirely inside the subtracted objects, the
  13974. difference object disappears.
  13975.  
  13976. Here is an example of a properly formed difference:
  13977.  
  13978.   difference {
  13979.     box { <-1.5, -1, -1>, <0.5, 1, 1> }
  13980.     cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 }
  13981.   }
  13982. Note that internally, POV-Ray simply adds the inverse keyword to
  13983. the second (and subsequent) objects and then performs an
  13984. intersection.  The example above is equivalent to:
  13985.  
  13986.   intersection {
  13987.     box { <-1.5, -1, -1>, <0.5, 1, 1> }
  13988.     cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 inverse }
  13989.   }
  13990.  
  13991. 4.5.4.5   Merge
  13992. The union operation just glues objects together, it does not
  13993. remove the objects' surfaces inside the union.  Under most
  13994. circumstances this doesn't matter.  However if a transparent
  13995. union is used, those interior surfaces will be visible.  The
  13996. merge operations can be used to avoid this problem. It works just
  13997. like union but it eliminates the inner surfaces like shown in the
  13998. figure below.
  13999.  
  14000.                                 
  14001.                                 
  14002.                   Merge removes inner surfaces.
  14003.                                 
  14004. The syntax is:
  14005.  
  14006. MERGE:
  14007.   merge { SOLID_OBJECTS...  [OBJECT_MODIFIERS...] }
  14008. The component objects must have well defined inside/outside
  14009. properties.  Patch objects are not allowed.  Note that merge is
  14010. slower rendering than union so it should only be used when it is
  14011. really necessary.
  14012.  
  14013.  
  14014. 4.5.5     Light Sources
  14015. The light_source is not really an object. Light sources have no
  14016. visible shape of their own.  They are just points or areas which
  14017. emit light. They are categorized as objects so that they can be
  14018. combined with regular objects using union.  Their full syntax is:
  14019.  
  14020. LIGHT_SOURCE:
  14021.   light_source { <Location>, COLOR [LIGHT_MODIFIERS...] }
  14022. LIGHT_MODIFIER:
  14023.   LIGHT_TYPE   |   SPOTLIGHT_ITEM   |
  14024.   AREA_LIGHT_ITEMS   |   GENERAL_LIGHT_MODIFIERS
  14025. LIGHT_TYPE:
  14026.   spotlight   |   shadowless   |   cylinder
  14027. SPOTLIGHT_ITEM:
  14028.   radius Radius   |   falloff Falloff   |   tightness Tightness
  14029.   |   point_at <Spot>
  14030. AREA_LIGHT_ITEM:
  14031.   area_light <Axis_1>, <Axis_2>, Size_1, Size_2   |
  14032.   adaptive Adaptive   |   jitter Jitter
  14033. GENERAL_LIGHT_MODIFIERS:
  14034.   looks_like { OBJECT }   |   TRANSFORMATION
  14035.   fade_distance Fade_Distance   |   fade_power Fade_Power   |
  14036.   media_attenuation [Bool]   |   media_interaction [Bool]
  14037. The different types of light sources and the optional modifiers
  14038. are described in the following sections.
  14039.  
  14040. The first two items are common to all light sources.  The
  14041. <Location> vector gives the location of the light.  The COLOR
  14042. gives the color of the light.  Only the red, green, and blue
  14043. components are significant.  Any transmit or filter values are
  14044. ignored.  Note that you vary the intensity of the light as well
  14045. as the color using this parameter.  A color such as rgb
  14046. <0.5,0.5,0.5> gives a white light that is half the normal
  14047. intensity.
  14048.  
  14049. All of the keywords or items in the syntax specification above
  14050. may appear in any order.  Some keywords only have effect if
  14051. specified with other keywords.  The keywords are grouped into
  14052. functional categories to make it clear which keywords work
  14053. together.  The GENERAL_LIGHT_MODIFIERS work with all types of
  14054. lights and all options.  Note that TRANSFORMATIONS such as
  14055. translate, rotate etc. may be applied but no other
  14056. OBJECT_MODIFIERS may be used.
  14057.  
  14058. There are four mutually exclusive light types.  If no LIGHT_TYPE
  14059. is specified it is a point light.  The other choices are
  14060. spotlight, shadowless, and cylinder.
  14061.  
  14062.  
  14063. 4.5.5.1   Point Lights
  14064. The simplest kid of light is a point light. A point light source
  14065. sends light of the specified color uniformly in all directions.
  14066. The default light type is a point source.  The <Location> and
  14067. COLOR is all that is required.  For example:
  14068.  
  14069.   light_source {
  14070.     <1000,1000,-1000>, rgb <1,0.75,0> //an orange light
  14071.   }
  14072.  
  14073. 4.5.5.2   Spotlights
  14074. Normally light radiates outward equally in all directions from
  14075. the source.  However the spotlight keyword can be used to create
  14076. a cone of light that is bright in the center and falls of to
  14077. darkness in a soft fringe effect at the edge.  Although the cone
  14078. of light fades to soft edges, objects illuminated by spotlights
  14079. still cast hard shadows.  The syntax is:
  14080.  
  14081. SPOTLIGHT_SOURCE:
  14082.   light_source { <Location>, COLOR spotlight
  14083.   [LIGHT_MODIFIERS...] }
  14084. LIGHT_MODIFIER:
  14085.   SPOTLIGHT_ITEM   |   AREA_LIGHT_ITEMS   |
  14086.   GENERAL_LIGHT_MODIFIERS
  14087. SPOTLIGHT_ITEM:
  14088.   radius Radius   |   falloff Falloff   |   tightness Tightness
  14089.   |   point_at <Spot>
  14090. The point_at keyword tells the spotlight to point at a particular
  14091. 3D coordinate.  A line from the location of the spotlight to the
  14092. point_at coordinate forms the center line of the cone of light.
  14093. The following illustration will be helpful in understanding how
  14094. these values relate to each other.
  14095.  
  14096.                                 
  14097.                                 
  14098.                   The geometry of a spotlight.
  14099.                                 
  14100. The falloff, radius, and tightness keywords control the way that
  14101. light tapers off at the edges of the cone.  These four keywords
  14102. apply only when the spotlight or cylinder keywords are used.
  14103.  
  14104. The falloff keyword specifies the overall size of the cone of
  14105. light.  This is the point where the light falls off to zero
  14106. intensity.  The float value you specify is the angle, in degrees,
  14107. between the edge of the cone and center line.  The radius keyword
  14108. specifies the size of the "hot-spot" at the center of the cone of
  14109. light.  The "hot-spot" is a brighter cone of light inside the
  14110. spotlight cone and has the same center line.  The radius value
  14111. specifies the angle, in degrees, between the edge of this bright,
  14112. inner cone and the center line.  The light inside the inner cone
  14113. is of uniform intensity.  The light between the inner and outer
  14114. cones tapers off to zero.
  14115.  
  14116. For example with radius 10 and falloff 20 the light from the
  14117. center line out to 10 degrees is full intensity.  From 10 to 20
  14118. degrees from the center line the light falls off to zero
  14119. intensity.  At 20 degrees or greater there is no light.  Note
  14120. that if the radius and falloff values are close or equal the
  14121. light intensity drops rapidly and the spotlight has a sharp edge.
  14122. The default values for both radius and falloff is 70.
  14123.  
  14124. The values for these two parameters are half the opening angles
  14125. of the corresponding cones, both angles have to be smaller than
  14126. 90 degrees. The light smoothly falls off between the radius and
  14127. the falloff angle like shown in the figures below (as long as the
  14128. radius angle is not negative).
  14129.  
  14130.                                 
  14131.                                 
  14132.    Intensity multiplier curve with a fixed falloff angle of 45
  14133.                             degrees.
  14134.                                 
  14135.                                 
  14136.                                 
  14137.    Intensity multiplier curve with a fixed radius angle of 45
  14138.                             degrees.
  14139.                                 
  14140. The tightness keyword is used to specify an additional
  14141. exponential softening of the edges.  The intensity of light at an
  14142. angle from the center line is given by: intensity *
  14143. cos(angle)tightness.  The default value for tightness is 10.
  14144. Lower tightness values will make the spotlight brighter, making
  14145. the spot wider and the edges sharper. Higher values will dim the
  14146. spotlight, making the spot tighter and the edges softer. Values
  14147. from 1 to 100 are acceptable.
  14148.  
  14149.                                 
  14150.                                 
  14151.  Intensity multiplier curve with fixed angle and falloff angles
  14152.                                 
  14153. of 30 and 60 degrees respectively and different tightness values.
  14154.                                 
  14155. You should note from the figures that the radius and falloff
  14156. angles interact with the tightness parameter. Only negative
  14157. radius angles will give the tightness value full control over the
  14158. spotlight's appearance as you can see from the figure below. In
  14159. that case the falloff angle has no effect and the lit area is
  14160. only determined by the tightness parameter.
  14161.  
  14162.                                 
  14163.                                 
  14164.    Intensity multiplier curve with a negative radius angle and
  14165.                    different tightness values.
  14166.                                 
  14167. Spotlights may be used anyplace that a normal light source is
  14168. used. Like any light sources, they are invisible. They may also
  14169. be used in conjunction with area lights.
  14170.  
  14171.  
  14172. 4.5.5.3   Cylindrical Lights
  14173. The cylinder keyword specifies a cylindrical light source that is
  14174. great for simulating laser beams.  Cylindrical light sources work
  14175. pretty much like spotlights except that the light rays are
  14176. constrained by a cylinder and not a cone. The syntax is:
  14177.  
  14178. CYLINDER_LIGHT_SOURCE:
  14179.   light_source { <Location>, COLOR cylinder [LIGHT_MODIFIERS...]
  14180.   }
  14181. LIGHT_MODIFIER:
  14182.   SPOTLIGHT_ITEM   |   AREA_LIGHT_ITEMS   |
  14183.   GENERAL_LIGHT_MODIFIERS
  14184. SPOTLIGHT_ITEM:
  14185.   radius Radius   |   falloff Falloff   |   tightness Tightness
  14186.   |   point_at <Spot>
  14187. The point_at, radius, falloff and tightness keywords control the
  14188. same features as with the spotlight.  See "Spotlights" for
  14189. details.
  14190.  
  14191. You should keep in mind that the cylindrical light source is
  14192. still a point light source. The rays are emitted from one point
  14193. and are only constraint by a cylinder. The light rays are not
  14194. parallel.
  14195.  
  14196.  
  14197. 4.5.5.4   Area Lights
  14198. Area light sources occupy a finite, one- or two-dimensional area
  14199. of space. They can cast soft shadows because an object can
  14200. partially block their light.  Point sources are either totally
  14201. blocked or not blocked.
  14202.  
  14203. The area_light keyword in POV-Ray creates sources that are
  14204. rectangular in shape, sort of like a flat panel light. Rather
  14205. than performing the complex calculations that would be required
  14206. to model a true area light, it is approximated as an array of
  14207. point light sources spread out over the area occupied by the
  14208. light. The array-effect applies to shadows only.  The object's
  14209. illumination is still that of a point source.  The intensity of
  14210. each individual point light in the array is dimmed so that the
  14211. total amount of light emitted by the light is equal to the light
  14212. color specified in the declaration. The syntax is:
  14213. AREA_LIGHT_SOURCE:
  14214.   light_source { <Location>, COLOR area_light <Axis_1>,
  14215.   <Axis_2>, Size_1, Size_2
  14216.      [adaptive Adaptive] [ jitter Jitter ]
  14217.      [LIGHT_MODIFIERS...]
  14218.   }
  14219. The light's location and color are specified in the same way as a
  14220. for a regular light source.  Any type of light source may be an
  14221. area light.
  14222.  
  14223. The area_light command defines the size and orientation of the
  14224. area light as well as the number of lights in the light source
  14225. array. The vectors <Axis_1> and <Axis_2> specify the lengths and
  14226. directions of the edges of the light. Since the area lights are
  14227. rectangular in shape these vectors should be perpendicular to
  14228. each other. The larger the size of the light the thicker the soft
  14229. part of shadows will be. The integers Size_1 and Size_2 specify
  14230. the number of rows and columns of point sources of the. The more
  14231. lights you use the smoother your shadows will be but the longer
  14232. they will take to render.
  14233.  
  14234. Note that it is possible to specify spotlight parameters along
  14235. with the area light parameters to create area spotlights. Using
  14236. area spotlights is a good way to speed up scenes that use area
  14237. lights since you can confine the lengthy soft shadow calculations
  14238. to only the parts of your scene that need them.
  14239.  
  14240. An interesting effect can be created using a linear light source.
  14241. Rather than having a rectangular shape, a linear light stretches
  14242. along a line sort of like a thin fluorescent tube. To create a
  14243. linear light just create an area light with one of the array
  14244. dimensions set to 1.
  14245.  
  14246. The jitter command is optional. When used it causes the positions
  14247. of the point lights in the array to be randomly jittered to
  14248. eliminate any shadow banding that may occur. The jittering is
  14249. completely random from render to render and should not be used
  14250. when generating animations.
  14251.  
  14252. The adaptive command is used to enable adaptive sampling of the
  14253. light source. By default POV-Ray calculates the amount of light
  14254. that reaches a surface from an area light by shooting a test ray
  14255. at every point light within the array. As you can imagine this is
  14256. very slow. Adaptive sampling on the other hand attempts to
  14257. approximate the same calculation by using a minimum number of
  14258. test rays. The number specified after the keyword controls how
  14259. much adaptive sampling is used. The higher the number the more
  14260. accurate your shadows will be but the longer they will take to
  14261. render. If you're not sure what value to use a good starting
  14262. point is adaptive 1. The adaptive keyword only accepts integer
  14263. values and cannot be set lower than 0.
  14264.  
  14265. When performing adaptive sampling POV-Ray starts by shooting a
  14266. test ray at each of the four corners of the area light. If the
  14267. amount of light received from all four corners is approximately
  14268. the same then the area light is assumed to be either fully in
  14269. view or fully blocked. The light intensity is then calculated as
  14270. the average intensity of the light received from the four
  14271. corners. However, if the light intensity from the four corners
  14272. differs significantly then the area light is partially blocked.
  14273. The area light is split into four quarters and each section is
  14274. sampled as described above. This allows POV-Ray to rapidly
  14275. approximate how much of the area light is in view without having
  14276. to shoot a test ray at every light in the array. Visually the
  14277. sampling goes like shown below.
  14278.  
  14279.                                 
  14280.                                 
  14281.                   Area light adaptive samples.
  14282.                                 
  14283. While the adaptive sampling method is fast (relatively speaking)
  14284. it can sometimes produces inaccurate shadows. The solution is to
  14285. reduce the amount of adaptive sampling without completely turning
  14286. it off. The number after the adaptive keyword adjusts the number
  14287. of times that the area light will be split before the adaptive
  14288. phase begins.  For example if you use adaptive 0 a minimum of 4
  14289. rays will be shot at the light. If you use adaptive 1 a minimum
  14290. of 9 rays will be shot (adaptive 2 gives 25 rays, adaptive 3
  14291. gives 81 rays, etc). Obviously the more shadow rays you shoot the
  14292. slower the rendering will be so you should use the lowest value
  14293. that gives acceptable results.
  14294.  
  14295. The number of rays never exceeds the values you specify for rows
  14296. and columns of points. For example area_light x,y,4,4 specifies a
  14297. 4 by 4 array of lights. If you specify adaptive 3 it would mean
  14298. that you should start with a 9 by 9 array. In this case no
  14299. adaptive sampling is done. The 4 by 4 array is used.
  14300.  
  14301.  
  14302. 4.5.5.5   Shadowless Lights
  14303. Using the shadowless keyword you can stop a light source from
  14304. casting shadows.  These lights are sometimes called "fill
  14305. lights".  They are another way to simulate ambient light however
  14306. shadowless lights have a definite source.  The syntax is:
  14307.  
  14308. SHADOWLESS_LIGHT_SOURCE:
  14309.   light_source { <Location>, COLOR  shadowless
  14310.   [LIGHT_MODIFIERS...] }
  14311. LIGHT_MODIFIER:
  14312.   AREA_LIGHT_ITEMS   |   GENERAL_LIGHT_MODIFIERS
  14313. Shadowless may be used with area_light but not spotlight or
  14314. cylinder.
  14315.  
  14316.  
  14317. 4.5.5.6   Looks_like
  14318. Normally the light source itself has no visible shape. The light
  14319. simply radiates from an invisible point or area. You may give a
  14320. light source any shape by adding a looks_like { OBJECT }
  14321. statement.
  14322.  
  14323. There is an implied no_shadow attached to the looks_like object
  14324. so that light is not blocked by the object. Without the automatic
  14325. no_shadow the light inside the object would not escape. The
  14326. object would, in effect, cast a shadow over everything.
  14327.  
  14328. If you want the attached object to block light then you should
  14329. attach it with a union and not a looks_like as follows:
  14330.  
  14331.   union {
  14332.     light_source { <100, 200, -300> color White }
  14333.     object { My_Lamp_Shape }
  14334.   }
  14335. Presumably parts of the lamp shade are transparent to let some
  14336. light out.
  14337.  
  14338.  
  14339. 4.5.5.7   Light Fading
  14340. By default POV-Ray does not diminish light from any light source
  14341. as it travels through space. In order to get a more realistic
  14342. effect fade_distance and fade_power keywords followed by float
  14343. values can be used to model the distance based falloff in light
  14344. intensity.
  14345.  
  14346. The fade_distance Fade_Distance is used to specify the distance
  14347. at which the full light intensity arrives, i. e. the intensity
  14348. which was given by the COLOR specification. The actual
  14349. attenuation is described by the fade_power Fade_Power, which
  14350. determines the falloff rate. For example linear or quadratic
  14351. falloff can be used by setting fade_power to 1 or 2 respectively.
  14352. The complete formula to calculate the factor by which the light
  14353. is attenuated is
  14354.  
  14355.                                 
  14356.                                 
  14357. with d being the distance the light has traveled.
  14358.  
  14359.                                 
  14360.                                 
  14361.        Light fading functions for different fading powers.
  14362.                                 
  14363. You should note two important facts: First, for Fade_Distance
  14364. larger than one the light intensity at distances smaller than
  14365. Fade_Distance actually increases. This is necessary to get the
  14366. light source color if the distance traveled equals the
  14367. Fade_Distance. Second, only light coming directly from light
  14368. sources is attenuated. Reflected or refracted light is not
  14369. attenuated by distance.
  14370.  
  14371.  
  14372. 4.5.5.8   Atmospheric Media Interaction
  14373. By default light sources will interact with an atmosphere added
  14374. to the scene. This behaviour can be switched off by using
  14375. media_interaction off keyword inside the light source statement.
  14376. Note in POV-Ray 3.0 this feature was turned off and on with the
  14377. atmosphere keyword.
  14378.  
  14379. 4.5.5.9   Atmospheric Attenuation
  14380. Normally light coming from light sources is not influenced by fog
  14381. or atmospheric media. This can be changed by turning the
  14382. media_attenuation on for a given light source on. All light
  14383. coming from this light source will now be diminished as it
  14384. travels through the fog or media.  This results in an distance-
  14385. based, exponential intensity falloff ruled by the used fog or
  14386. media. If there is no fog or media no change will be seen. Note
  14387. in POV-Ray 3.0 this feature was turned off and on with the
  14388. atmospheric_attenuation keyword.
  14389.  
  14390. 4.5.6     Object Modifiers
  14391. A variety of modifiers may be attached to objects. The following
  14392. items may be applied to any object:
  14393.  
  14394. OBJECT_MODIFIER:
  14395.   clipped_by { UNTEXTURED_SOLID_OBJECT... }   |   clipped_by {
  14396.   bounded_by }   |
  14397.   bounded_by { UNTEXTURED_SOLID_OBJECT... }   |   bounded_by {
  14398.   clipped_by }   |
  14399.   no_shadow   |   inverse   |   sturm [ Bool ]   |   hierarchy [
  14400.   Bool ]   |
  14401.   interior { INTERIOR_ITEMS... }   |
  14402.   material { [MATERIAL_IDENTIFIER][MATERIAL_ITEMS...] }   |
  14403.   texture { TEXTURE_BODY }   |   pigment { PIGMENT_BODY }   |
  14404.   normal { NORMAL_BODY }   |   finish { FINISH_ITEMS... }   |
  14405.   TRANSFORMATION
  14406. Transformations such as translate, rotate and scale have already
  14407. been discussed. The modifiers "Textures" and its parts "Pigment",
  14408. "Normal", and "Finish" as well as "Interior", and "Media" (which
  14409. is part of interior) are each in major chapters of their own
  14410. below. In the sub-sections below we cover several other important
  14411. modifiers: clipped_by, bounded_by, material, no_shadow, hollow,
  14412. inverse, sturm, and hierarchy. Although the examples below use
  14413. object statements and object identifiers, these modifiers may be
  14414. used on any type of object such as sphere, box etc.
  14415.  
  14416.  
  14417. 4.5.6.1   Clipped_By
  14418. The clipped_by statement is technically an object modifier but it
  14419. provides a type of CSG similar to CSG intersection. The syntax
  14420. is:
  14421.  
  14422. CLIPPED_BY:
  14423.   clipped_by { UNTEXTURED_SOLID_OBJECT... }   |   clipped_by {
  14424.   bounded_by }
  14425. Where UNTEXTURED_SOLID_OBJECT is one or more solid objects which
  14426. have had no texture applied.  For example:
  14427.  
  14428.   object {
  14429.     My_Thing
  14430.     clipped_by{plane{y,0}}
  14431.   }
  14432. Every part of the object My_Thing that is inside the plane is
  14433. retained while the remaining part is clipped off and discarded.
  14434. In an intersection object the hole is closed off. With clipped_by
  14435. it leaves an opening. For example the following figure shows
  14436. object A being clipped by object B.
  14437.  
  14438.                                 
  14439.                                 
  14440.               An object clipped by another object.
  14441.                                 
  14442. You may use clipped_by to slice off portions of any shape. In
  14443. many cases it will also result in faster rendering times than
  14444. other methods of altering a shape.  Occasionally you will want to
  14445. use the clipped_by and bounded_by options with the same object.
  14446. The following shortcut saves typing and uses less memory.
  14447.  
  14448.   object {
  14449.     My_Thing
  14450.     bounded_by { box { <0,0,0>, <1,1,1> } }
  14451.     clipped_by { bounded_by }
  14452.   }
  14453. This tells POV-Ray to use the same box as a clip that was used as
  14454. a bounds.
  14455.  
  14456.  
  14457. 4.5.6.2   Bounded_By
  14458. The calculations necessary to test if a ray hits an object can be
  14459. quite time consuming. Each ray has to be tested against every
  14460. object in the scene. POV-Ray attempts to speed up the process by
  14461. building a set of invisible boxes, called bounding boxes, which
  14462. cluster the objects together. This way a ray that travels in one
  14463. part of the scene doesn't have to be tested against objects in
  14464. another, far away part of the scene. When large a number of
  14465. objects are present the boxes are nested inside each other. POV-
  14466. Ray can use bounding boxes on any finite object and even some
  14467. clipped or bounded quadrics. However infinite objects (such as a
  14468. planes, quartic, cubic and poly) cannot be automatically bound.
  14469. CSG objects are automatically bound if they contain finite (and
  14470. in some cases even infinite) objects. This works by applying the
  14471. CSG set operations to the bounding boxes of all objects used
  14472. inside the CSG object. For difference and intersection operations
  14473. this will hardly ever lead to an optimal bounding box. It's
  14474. sometimes better (depending on the complexity of the CSG object)
  14475. to have you place a bounding shape yourself using a bounded_by
  14476. statement.
  14477.  
  14478. Normally bounding shapes are not necessary but there are cases
  14479. where they can be used to speed up the rendering of complex
  14480. objects. Bounding shapes tell the ray-tracer that the object is
  14481. totally enclosed by a simple shape. When tracing rays, the ray is
  14482. first tested against the simple bounding shape. If it strikes the
  14483. bounding shape the ray is further tested against the more
  14484. complicated object inside. Otherwise the entire complex shape is
  14485. skipped, which greatly speeds rendering.  The syntax is:
  14486.  
  14487. BOUNDED_BY:
  14488.   bounded_by { UNTEXTURED_SOLID_OBJECT... }   |   bounded_by {
  14489.   clipped_by }
  14490. Where UNTEXTURED_SOLID_OBJECT is one or more solid objects which
  14491. have had no texture applied.  For example:
  14492.  
  14493.   intersection {
  14494.     sphere { <0,0,0>, 2 }
  14495.     plane  { <0,1,0>, 0 }
  14496.     plane  { <1,0,0>, 0 }
  14497.     bounded_by { sphere { <0,0,0>, 2 } }
  14498.   }
  14499. The best bounding shape is a sphere or a box since these shapes
  14500. are highly optimized, although, any shape may be used. If the
  14501. bounding shape is itself a finite shape which responds to
  14502. bounding slabs then the object which it encloses will also be
  14503. used in the slab system.
  14504.  
  14505. While it may a good idea to manually add a bounded_by to
  14506. intersection, difference and merge, it is best to never bound a
  14507. union. If a union has no bounded_by POV-Ray can internally split
  14508. apart the components of a union and apply automatic bounding
  14509. slabs to any of its finite parts. Note that some utilities such
  14510. as raw2pov may be able to generate bounds more efficiently than
  14511. POV-Ray's current system. However most unions you create yourself
  14512. can be easily bounded by the automatic system. For technical
  14513. reasons POV-Ray cannot split a merge object. It is may be best to
  14514. hand bound a merge, especially if it is very complex.
  14515.  
  14516. Note that if bounding shape is too small or positioned
  14517. incorrectly it may clip the object in undefined ways or the
  14518. object may not appear at all. To do true clipping, use clipped_by
  14519. as explained in the previous section. Occasionally you will want
  14520. to use the clipped_by and bounded_by options with the same
  14521. object. The following shortcut saves typing and uses less memory.
  14522.  
  14523.   object {
  14524.     My_Thing
  14525.     clipped_by{ box { <0,0,0>,<1,1,1 > }}
  14526.     bounded_by{ clipped_by }
  14527.   }
  14528. This tells POV-Ray to use the same box as a bounds that was used
  14529. as a clip.
  14530.  
  14531.  
  14532. 4.5.6.3   Material
  14533. One of the changes in POV-Ray 3.1 was remove several items from
  14534. texture{finish{...}} and to move them to the new interior
  14535. statement.  The halo statement, formerly part of texture, are now
  14536. renamed media and made a part of the interior.  This split was
  14537. deliberate and purposeful (see "Why are Interior and Media
  14538. Necessary?") however beta testers have pointed out that it makes
  14539. it difficult to entirely describe the surface properties and
  14540. interior of an object in one statement that can be referenced by
  14541. a single identifier in a texture library.
  14542.  
  14543. The result is that we created a "wrapper" around texture and
  14544. interior which we call material.  The syntax is:
  14545.  
  14546. MATERIAL:
  14547.   material { [MATERIAL_IDENTIFIER][MATERIAL_ITEMS...] }
  14548. MATERIAL_ITEMS:
  14549.   TEXTURE   |   INTERIOR   |   TRANSFORMATIONS
  14550. For example:
  14551.  
  14552.   #declare MyGlass=material{texture{Glass_T} interior{Glass_I}}
  14553.   object{MyObject material{MyGlass}}
  14554. Internally, the "material" isn't attached to the object.  The
  14555. material is just a container that brings the texture and interior
  14556. to the object.  It is the texture and interior itself that is
  14557. attached to the object.  Users should still consider texture and
  14558. interior as separate items attached to the object.  The material
  14559. is just a "bucket" to carry them.
  14560.  
  14561. If the object already has a texture, the material texture is
  14562. layered over it.  If the object already has an interior, the
  14563. material interior fully replaces it and the old interior is
  14564. destroyed.
  14565.  
  14566. Transformations inside the material affect only the textures and
  14567. interiors which are inside the material{} wrapper and only those
  14568. textures or interiors specifed are affected.  For example:
  14569.  
  14570.   object{MyObject
  14571.     material{
  14572.       texture{MyTexture}
  14573.       scale 4         //affects texture but not object or
  14574. interior
  14575.       interior{MyInterior}
  14576.       translate 5*x   //affects texture and interior, not object
  14577.     }
  14578.   }
  14579. Note: The material statement has nothing to do with the
  14580. material_map statement.  A material_map is not a way to create
  14581. patterned material.  See "Material Maps" for explanation of this
  14582. unrelated, yet similarly named, older feature.
  14583.  
  14584.  
  14585. 4.5.6.4   Inverse
  14586. When using CSG it is often useful to invert an object so that
  14587. it'll be inside-out. The appearance of the object is not changed,
  14588. just the way that POV-Ray perceives it. When the inverse keyword
  14589. is used the inside of the shape is flipped to become the outside
  14590. and vice versa.  For example:
  14591.  
  14592.   object { MyObject inverse }
  14593. The inside/outside distinction is also important when attaching
  14594. interior to an object especially if media is also used.
  14595. Atmospheric media and fog also do not work as expected if your
  14596. camera is inside an object.  Using inverse is useful to correct
  14597. that problem.
  14598.  
  14599. Finally the internal_reflections and internal_highlights keywords
  14600. depend upon the inside/outside status of an object.
  14601.  
  14602.  
  14603. 4.5.6.5   Hollow
  14604. POV-Ray by default assumes that objects are made of a solid
  14605. material that completely fills the interior of an object. By
  14606. adding the hollow keyword to the object you can make it hollow.
  14607. That is very useful if you want atmospheric effects to exist
  14608. inside an object. It is even required for objects containing an
  14609. interior media.  The keyword may optionally be followed by a
  14610. float expression which is interpreted as a boolean value.  For
  14611. example hollow off may be used to force it off.  When the keyword
  14612. is specified alone, it is the same as hollow on.  The default no
  14613. hollow is specified is off.
  14614.  
  14615. In order to get a hollow CSG object you just have to make the top
  14616. level object hollow. All children will assume the same hollow
  14617. state except their state is explicitly set. The following example
  14618. will set both spheres inside the union hollow
  14619.  
  14620.   union {
  14621.     sphere { -0.5*x, 1 }
  14622.     sphere {  0.5*x, 1 }
  14623.     hollow
  14624.   }
  14625. while the next example will only set the second sphere hollow
  14626. because the first sphere was explicitly set to be not hollow.
  14627.  
  14628.   union {
  14629.     sphere { -0.5*x, 1 hollow off }
  14630.     sphere {  0.5*x, 1 }
  14631.     hollow on
  14632.   }
  14633.  
  14634. 4.5.6.6   No_Shadow
  14635. You may specify the no_shadow keyword in an object to make that
  14636. object cast no shadow. This is useful for special effects and for
  14637. creating the illusion that a light source actually is visible.
  14638. This keyword was necessary in earlier versions of POV-Ray which
  14639. did not have the looks_like statement. Now it is useful for
  14640. creating things like laser beams or other unreal effects.  During
  14641. test rendering it speeds things up if no_shadow is applied.
  14642.  
  14643. Simply attach the keyword as follows:
  14644.  
  14645.   object {
  14646.     My_Thing
  14647.     no_shadow
  14648.   }
  14649.  
  14650. 4.5.6.7   Sturm
  14651. Some of POV-Ray's objects allow you to choose between a fast but
  14652. sometimes inaccurate root solver and a slower but more accurate
  14653. one. This is the case for all objects that involve the solution
  14654. of a cubic or quartic polynomial. There are analytic mathematical
  14655. solutions for those polynomials that can be used.
  14656.  
  14657. Lower order polynomials are trivial to solve while higher order
  14658. polynomials require iterative algorithms to solve them. One of
  14659. those algorithms is the Sturmian root solver.  For example:
  14660.  
  14661.   blob {
  14662.     threshold .65
  14663.     sphere { <.5,0,0>, .8, 1 }
  14664.     sphere { <-.5,0,0>,.8, 1 }
  14665.     sturm
  14666.   }
  14667.  
  14668. The keyword may optionally be followed by a float expression
  14669. which is interpreted as a boolean value.  For example sturm off
  14670. may be used to force it off.  When the keyword is specified
  14671. alone, it is the same as sturm on.  The default no sturm is
  14672. specified is off.
  14673.  
  14674. The following list shows all objects for which the Sturmian root
  14675. solver can be used.
  14676.  
  14677.     blob
  14678.     cubic
  14679.     lathe    (only with quadratic splines)
  14680.     poly
  14681.     prism    (only with cubic splines)
  14682.     quartic
  14683.     sor
  14684.  
  14685.  
  14686. 4.6  Interior
  14687. New with POV-Ray 3.1 is an object modifier statement called
  14688. interior.  The syntax is:
  14689.  
  14690. INTERIOR:
  14691.   interior { [INTERIOR_IDENTIFIER] [INTERIOR_ITEMS...] }
  14692. INTERIOR_ITEM:
  14693.   ior Value   |   caustics Value   |
  14694.   fade_distance Distance   |   fade_power Power
  14695.   MEDIA...
  14696. The interior contains items which describe the properties of the
  14697. interior of the object.  This is in contrast to the texture which
  14698. describes the surface properties only.  The interior of an object
  14699. is only of interest if it has a transparent texture which allows
  14700. you to see inside the object.  It also applies only to solid
  14701. objects which have a well-defined inside/outside distinction.
  14702. Note that the open keyword, or clipped_by modifier also allows
  14703. you to see inside but interior features may not render properly.
  14704. They should be avoided if accurate interiors are required.
  14705.  
  14706. Interior identifiers may be declared to make scene files more
  14707. readable and to parameterize scenes so that changing a single
  14708. declaration changes many values. An identifier is declared as
  14709. follows.
  14710.  
  14711. INTERIOR_DECLARATION:
  14712.   #declare IDENTIFIER = INTERIOR     |
  14713.   #local IDENTIFIER = INTERIOR
  14714. Where IDENTIFIER is the name of the identifier up to 40
  14715. characters long and INTERIOR is any valid interior statement.
  14716. See "#declare vs. #local" for information on identifier scope.
  14717.  
  14718.  
  14719. 4.6.1     Why are Interior and Media Necessary?
  14720. In previous versions of POV-Ray, most of the items in the
  14721. interior statement were previously part of the finish statement.
  14722. Also the halo statement which was once part of the texture
  14723. statement has been discontinued and has been replaced by the
  14724. media statement which is part of interior.
  14725.  
  14726. You are probably asking WHY?  As explained earlier, the interior
  14727. contains items which describe the properties of the interior of
  14728. the object.  This is in contrast to the texture which describes
  14729. the surface properties only.  However this is not just a
  14730. philosophical change.  There were serious inconsistencies in the
  14731. old model.
  14732.  
  14733. The main problem arises when a texture_map or other patterned
  14734. texture is used.  These features allow you to create textures
  14735. that are a blend of two textures and which vary the entire
  14736. texture from one point to another.  It does its blending by fully
  14737. evaluating the apparent color as though only one texture was
  14738. applied and then fully reevaluating it with the other texture.
  14739. The two final results are blended.
  14740.  
  14741. It is totally illogical to have a ray enter an object with one
  14742. index or refraction and then recalculate with another index.  The
  14743. result is not an average of the two ior values.  Similarly it
  14744. makes no sense to have a ray enter at one ior and exit at a
  14745. different ior without transitioning between them along the way.
  14746. POV-Ray only calculates refraction as the ray enters or leaves.
  14747. It cannot incrementally compute a changing ior through the
  14748. interior of an object.  Real world objects such as optical fibers
  14749. or no-line bifocal eyeglasses can have variable iors but POV-Ray
  14750. cannot simulate them.
  14751.  
  14752. Similarly the halo calculations were not performed as the syntax
  14753. implied.  Using a halo in such multi-textured objects did not
  14754. vary the halo through the interior of the object.  Rather, it
  14755. computed two separate halos through the whole object and averaged
  14756. the results.  The new design for media which replaces halo makes
  14757. it possible to have media that varies throughout the interior of
  14758. the object according to a pattern but it does so independently of
  14759. the surface texture.  Because there are other changes in the
  14760. design of this feature which make it significantly different, it
  14761. was not only moved to the interior but the name was changed.
  14762.  
  14763. During our development, someone asked if we will create patterned
  14764. interiors or a hypothetical interior_map feature.  We will not.
  14765. That would defeat the whole purpose of moving these features in
  14766. the first place.  They cannot be patterned and have logical or
  14767. self-consistent results.
  14768.  
  14769.  
  14770. 4.6.2     Empty and Solid Objects
  14771. It is very important that you know the basic concept behind empty
  14772. and solid objects in POV-Ray to fully understand how features
  14773. like interior and translucency are used.  Objects in POV-Ray can
  14774. either be solid, empty or filled with (small) particles.
  14775.  
  14776. A solid object is made from the material specified by its pigment
  14777. and finish statements (and to some degree its normal statement).
  14778. By default all objects are assumed to be solid. If you assign a
  14779. stone texture to a sphere you'll get a ball made completely of
  14780. stone. It's like you had cut this ball from a block of stone. A
  14781. glass ball is a massive sphere made of glass.  You should be
  14782. aware that solid objects are conceptual things. If you clip away
  14783. parts of the sphere you'll clearly see that the interior is empty
  14784. and it just has a very thin surface.
  14785.  
  14786. This is not contrary to the concept of a solid object used in POV-
  14787. Ray. It is assumed that all space inside the sphere is covered by
  14788. the sphere's interior. Light passing through the object is
  14789. affected by attenuation and refraction properties.  However there
  14790. is no room for any other particles like those used by fog or
  14791. interior media.
  14792.  
  14793. Empty objects are created by adding the hollow keyword (see
  14794. "Hollow") to the object statement. An empty (or hollow) object is
  14795. assumed to be made of a very thin surface which is of the
  14796. material specified by the pigment, finish and normal statements.
  14797. The object's interior is empty, it normally contains air
  14798. molecules.
  14799.  
  14800. An empty object can be filled with particles by adding fog or
  14801. atmospheric media to the scene or by adding an interior media to
  14802. the object.  It is very important to understand that in order to
  14803. fill an object with  any kind of particles it first has to be
  14804. made hollow.
  14805.  
  14806. There is a pitfall in the empty/solid object implementation that
  14807. you have to be aware of.
  14808.  
  14809. In order to be able to put solid objects inside a media or fog, a
  14810. test has to be made for every ray that passes through the media.
  14811. If this ray travels through a solid object the media will not be
  14812. calculated. This is what anyone will expect. A solid glass sphere
  14813. in a fog bank does not contain fog.
  14814.  
  14815. The problem arises when the camera ray is inside any non-hollow
  14816. object. In this case the ray is already traveling through a solid
  14817. object and even if the media's container object is hit and it is
  14818. hollow, the media will not be calculated. There is no way of
  14819. telling between these two cases.
  14820.  
  14821. POV-Ray has to determine whether the camera is inside any object
  14822. prior to tracing a camera ray in order to be able to correctly
  14823. render medias when the camera is inside the container object.
  14824. There's no way around doing this.
  14825.  
  14826. The solution to this problem (that will often happen with
  14827. infinite objects like planes) is to make those objects hollow
  14828. too. Thus the ray will travel through a hollow object, will hit
  14829. the container object and the media will be calculated.
  14830.  
  14831.  
  14832. 4.6.3     Refraction
  14833. When light passes through a surface either into or out of a dense
  14834. medium the path of the ray of light is bent. Such bending is
  14835. called refraction.  The amount of bending or refracting of light
  14836. depends upon the density of the material. Air, water, crystal and
  14837. diamonds all have different densities and thus refract
  14838. differently. The index of refraction or ior value is used by
  14839. scientists to describe the relative density of substances. The
  14840. ior keyword is used in POV-Ray in the interior to turn on
  14841. refraction and to specify the ior value. For example:
  14842.  
  14843.   object{ MyObject pigment{Clear} interior{ior 1.5}}
  14844. The default ior value of 1.0 will give no refraction. The index
  14845. of refraction for air is 1.0, water is 1.33, glass is 1.5 and
  14846. diamond is 2.4.
  14847.  
  14848. Normally transparent or semi-transparent surfaces in POV-Ray do
  14849. not refract light. Earlier versions of POV-Ray required you to
  14850. use the refraction keyword in the finish statement to turn on
  14851. refraction.  This is no longer necessary.  Any non-zero ior value
  14852. now turns refraction on.
  14853.  
  14854. In addition to turning refraction on or off, the old refraction
  14855. keyword was followed by a float value from 0.0 to 1.0.  Values in
  14856. between 0.0 and 1.0 would darken the refracted light in ways that
  14857. do not correspond to any physical property. Many POV-Ray scenes
  14858. were created with intermediate refraction values before this bug
  14859. was discovered so the feature has been maintained. A more
  14860. appropriate way to reduce the brightness of refracted light is to
  14861. change the filter or transmit value in the colors specified in
  14862. the pigment statement or to use the fade_power and fade_distance
  14863. keywords.  See "Attenuation". Note also that neither the ior nor
  14864. refraction keywords cause the object to be transparent.
  14865. Transparency only occurs if there is a non-zero filter or
  14866. transmit value in the color.
  14867.  
  14868. The refraction and ior keywords were original specified in finish
  14869. but are now properly specified in interior.  They are accepted in
  14870. finish for backward compatibility and generate a warning message.
  14871.  
  14872.  
  14873. 4.6.4     Attenuation
  14874. Light attenuation is used to model the decrease in light
  14875. intensity as the light travels through a transparent object.  The
  14876. keywords fade_power Fade_Power and fade_distance Fade_Distance
  14877. keywords are specified in the interior statement.
  14878.  
  14879. The fade_distance value determines the distance the light has to
  14880. travel to reach half intensity while the fade_power value
  14881. determines how fast the light will fall off. For realistic
  14882. effects a fade power of 1 to 2 should be used.  Default values
  14883. for both keywords is 0.0 which turns this feature off.
  14884.  
  14885. The attenuation is calculated by a formula similar to that used
  14886. for light source attenuation.
  14887.  
  14888.  
  14889.  
  14890. The fade_power and fade_distance keywords were original specified
  14891. in finish but are now properly specified in interior.  They are
  14892. accepted in finish for backward compatibility and generate a
  14893. warning message.
  14894.  
  14895.  
  14896. 4.6.5     Faked Caustics
  14897. Caustics are light effects that occur if light is reflected or
  14898. refracted by specular reflective or refractive surfaces. Imagine
  14899. a glass of water standing on a table. If sunlight falls onto the
  14900. glass you will see spots of light on the table. Some of the spots
  14901. are caused by light being reflected by the glass while some of
  14902. them are caused by light being refracted by the water in the
  14903. glass.
  14904.  
  14905. Since it is a very difficult and time-consuming process to
  14906. actually calculate those effects (though it is not impossible)
  14907. POV-Ray uses a quite simple method to simulate caustics caused by
  14908. refraction. The method calculates the angle between the incoming
  14909. light ray and the surface normal.  Where they are nearly parallel
  14910. it makes the shadow brighter.  Where the angle is greater, the
  14911. effect is diminished.  Unlike real-world caustics, the effect
  14912. does not vary based on distance.  This caustic effect is limited
  14913. to areas that are shaded by the transparent object. You'll get no
  14914. caustic effects from reflective surfaces nor in parts that are
  14915. not shaded by the object.
  14916.  
  14917. The caustics Power keyword controls the effect.  Values typically
  14918. range from 0.0 to 1.0 or higher.  Zero is the default which is no
  14919. caustics.  Low, non-zero values give broad hot-spots while higher
  14920. values give tighter, smaller simulated focal points.
  14921.  
  14922. The caustics keyword was originally specified in finish but is
  14923. now properly specified in interior.  It is accepted in finish for
  14924. backward compatibility and generates a warning message.
  14925.  
  14926.  
  14927. 4.6.6     Object Media
  14928. The interiorstatement may contain one or more media statements.
  14929. Media is used to simulate suspended particles such as smoke,
  14930. haze, or dust.  Or visible gasses such as steam or fire and
  14931. explosions.  When used with an object interior, the effect is
  14932. constrained by the object's shape.  The calculations begin when
  14933. the ray enters an object and ends when it leaves the object.
  14934. This section only discusses media when used with object interior.
  14935. The complete syntax and an explanation of all of the parameters
  14936. and options for media is given in the section "Media".
  14937.  
  14938. Typically the object itself is given a fully transparent texture
  14939. however media also works in partially transparent objects.  The
  14940. texture pattern itself does not effect the interior media except
  14941. perhaps to create shadows on it.  The texture pattern of an
  14942. object applies only to the surface shell.  Any interior media
  14943. patterns are totally independent of the texture.
  14944.  
  14945. In previous versions of POV-Ray, this feature was called halo and
  14946. was part of the texture specification along with pigment, normal,
  14947. and finish.  See "Why are Interior and Media Necessary?" for an
  14948. explanation of the reasons for the change.
  14949.  
  14950. Note a strange design side-effect was discovered during testing
  14951. and it was too difficult to fix.  If the enclosing object uses
  14952. transmit rather than filter for transparency, then the media
  14953. casts no shadows.  For example:
  14954.  
  14955.  object{MyObject pigment{rgbt 1.0} interior{media{MyMedia}}} //no
  14956. shadows
  14957.  object{MyObject pigment{rgbf 1.0} interior{media{MyMedia}}}
  14958. //shadows
  14959. Media may also be specified outside an object to simulate
  14960. atmospheric media.  There is no constraining object in this case.
  14961. If you only want media effects in a particular area, you should
  14962. use object media rather than only relying upon the media pattern.
  14963. In general it will be faster and more accurate because it only
  14964. calculates inside the constraining object.  See "Atmospheric
  14965. Media" for details on unconstrained uses of media.
  14966.  
  14967. You may specify more than one media statement per interior
  14968. statement.  In that case, all of the media participate and where
  14969. they overlap, they add together.
  14970.  
  14971. Any object which is supposed to have media effects inside it,
  14972. whether those effects are object media or atmospheric media, must
  14973. have the hollow on keyword applied.  Otherwise the media is
  14974. blocked.  See "Empty and Solid Objects" for details.
  14975.  
  14976.  
  14977. 4.7  Textures
  14978. The texture statement is an object modifier which describes what
  14979. the surface of an object looks like, i.e. its material. Textures
  14980. are combinations of pigments, normals, and finishes. Pigment is
  14981. the color or pattern of colors inherent in the material. Normal
  14982. is a method of simulating various patterns of bumps, dents,
  14983. ripples or waves by modifying the surface normal vector. Finish
  14984. describes the reflective properties of a material.
  14985.  
  14986. Note that in previous versions of POV-Ray, the texture also
  14987. contained information about the interior of an object.  This
  14988. information has been moved to a separate object modifier called
  14989. interior.  See "Interior" for details.
  14990.  
  14991. There are three basic kinds of textures: plain, patterned, and
  14992. layered. A plain texture consists of a single pigment, an
  14993. optional normal, and a single finish. A patterned texture
  14994. combines two or more textures using a block pattern or blending
  14995. function pattern.  Patterned textures may be made quite complex
  14996. by nesting patterns within patterns. At the innermost levels
  14997. however, they are made up from plain textures. A layered texture
  14998. consists of two or more semi-transparent textures layered on top
  14999. of one another. Note that although we call a plain texture plain
  15000. it may be a very complex texture with patterned pigments and
  15001. normals. The term plain only means that it has a single pigment,
  15002. normal, and finish.
  15003.  
  15004. The syntax for texture is as follows:
  15005.  
  15006. TEXTURE:
  15007.   PLAIN_TEXTURE   |   PATTERNED_TEXTURE   |   LAYERED_TEXTURE
  15008. PLAIN_TEXTURE:
  15009.   texture { [TEXTURE_IDENTIFIER] [PNF_IDENTIFIER...]
  15010.   [PNF_ITEMS...] }
  15011. PNF_IDENTIFIER:
  15012.   PIGMENT_IDENTIFIER   |   NORMAL_IDENTIFIER   |
  15013.   FINISH_IDENTIFIER
  15014. PNF_ITEMS:
  15015.   PIGMENT   |   NORMAL   |   FINISH   |   TRANSFORMATION
  15016. LAYERED_TEXTURE:
  15017.   NON_PATTERNED_TEXTURE...
  15018. PATTERNED_TEXTURE:
  15019.   texture { [PATTERNED_TEXTURE_ID] [TRANSFORMATIONS...] }   |
  15020.   texture { PATTERN_TYPE [TEXTURE_PATTERN_MODIFIERS...] }   |
  15021.   texture { tiles TEXTURE  tile2 TEXTURE [TRANSFORMATIONS...] }
  15022.   |
  15023.   texture {
  15024.      material_map{
  15025.        BITMAP_TYPE "bitmap.ext" [MATERIAL_MODS...] TEXTURE...
  15026.      [TRANSFORMATIONS...]
  15027.      }
  15028.   }
  15029. TEXTURE_PATTERN_MODIFIER:
  15030.   PATTERN_MODIFIER   |   TEXTURE_LIST   |
  15031.   texture_map{ TEXTURE_MAP_BODY }
  15032. In the PLAIN_TEXTURE, each of the items are optional but if they
  15033. are present the TEXTURE_IDENTIFIER must be first. If no texture
  15034. identifier is given, then POV-Ray creates a copy of the default
  15035. texture.  See "The #default Directive" for details.
  15036.  
  15037. Next are optional pigment, normal, and/or finish identifiers
  15038. which fully override the any pigment, normal and finish already
  15039. specified in the previous texture identifier or default texture.
  15040. Typically this is used for backward compatibility to allow things
  15041. like: texture{MyPigment} where MyPigment is a pigment identifier.
  15042.  
  15043. Finally we have optional pigment, normal or finish statements
  15044. which modify any pigment, normal and finish already specified in
  15045. the identifier. If no texture identifier is specified the
  15046. pigment, normal and finish statements modify the current default
  15047. values. This is the typical plain texture:
  15048.  
  15049.   texture{
  15050.     pigment{MyPigment}
  15051.     normal{MyNormal}
  15052.     finish{MyFinish}
  15053.     scale SoBig
  15054.     rotate SoMuch
  15055.     translate SoFar
  15056. }
  15057. The TRANSFORMATIONS may be interspersed between the pigment,
  15058. normal and finish statements but are generally specified last.
  15059. If they are interspersed, then they modify only those parts of
  15060. the texture already specified.  For example:
  15061.  
  15062.   texture{
  15063.     pigment{MyPigment}
  15064.     scale SoBig        //affects pigment only
  15065.     normal{MyNormal}
  15066.     rotate SoMuch      //affects pigment and normal
  15067.     finish{MyFinish}
  15068.     translate SoFar    //finish is never transformable no matter
  15069. what.
  15070.                        //Therefore affects pigment and normal
  15071. only
  15072. }
  15073. Texture identifiers may be declared to make scene files more
  15074. readable and to parameterize scenes so that changing a single
  15075. declaration changes many values. An identifier is declared as
  15076. follows.
  15077.  
  15078. TEXTURE_DECLARATION:
  15079.   #declare IDENTIFIER = TEXTURE    |
  15080.   #local IDENTIFIER = TEXTURE
  15081. Where IDENTIFIER is the name of the identifier up to 40
  15082. characters long and TEXTURE is any valid texture statement.  See
  15083. "#declare vs. #local" for information on identifier scope.
  15084.  
  15085. The sections below describe all of the options available in
  15086. "Pigment", "Normal", and "Finish" which are the main part of
  15087. plain textures.. There are also separate sections for "Patterned
  15088. Textures" and "Layered Textures" which are made up of plain
  15089. textures.  Note that the tiles and material_map versions of
  15090. patterned textures are obsolete and are only supported for
  15091. backwards compatibility.
  15092.  
  15093.  
  15094. 4.7.1     Pigment
  15095. The color or pattern of colors for an object is defined by a
  15096. pigment statement. All plain textures must have a pigment. If you
  15097. do not specify one the default pigment is used.  The color you
  15098. define is the way you want the object to look if fully
  15099. illuminated. You pick the basic color inherent in the object and
  15100. POV-Ray brightens or darkens it depending on the lighting in the
  15101. scene. The parameter is called pigment because we are defining
  15102. the basic color the object actually is rather than how it looks.
  15103.  
  15104. The syntax for pigment is:
  15105.  
  15106. PIGMENT:
  15107.   pigment{ [PIGMENT_IDENTIFIER] [PIGMENT_TYPE]
  15108.   [PIGMENT_MODIFIER...] }
  15109. PIGMENT_TYPE:
  15110.   PATTERN_TYPE   |
  15111.   COLOR   |
  15112.   image_map{ BITMAP_TYPE "bitmap.ext" [IMAGE_MAP_MODS...] }
  15113. PIGMENT_MODIFIER:
  15114.   PATTERN_MODIFIER   |   COLOR_LIST   |   PIGMENT_LIST   |
  15115.   color_map{ COLOR_MAP_BODY }   |   colour_map{ COLOR_MAP_BODY }
  15116.   |
  15117.   pigment_map{ PIGMENT_MAP_BODY }   |
  15118.   quick_color COLOR   |   quick_colour COLOR
  15119. Each of the items in a pigment are optional but if they are
  15120. present, they must be in the order shown. Any items after the
  15121. PIGMENT_IDENTIFIER modify or override settings given in the
  15122. identifier. If no identifier is specified then the items modify
  15123. the pigment values in the current default texture. The
  15124. PIGMENT_TYPE  fall into roughly four categories. Each category is
  15125. discussed the sub-sections which follow. The four categories are
  15126. solid color and image map patterns which are specific to pigment
  15127. statements or color list patterns, color mapped patterns which
  15128. use POV-Ray's wide selection of general patterns.  See "Patterns"
  15129. for details about specific patterns.
  15130.  
  15131. The pattern type is optionally followed by one or more pigment
  15132. modifiers.  In addition to general pattern modifiers such as
  15133. transformations, turbulence, and warp modifiers, pigments may
  15134. also have a COLOR_LIST, PIGMENT_LIST, color_map, pigment_map, and
  15135. quick_color which are specific to pigments.  See "Pattern
  15136. Modifiers" for information on general modifiers.  The pigment-
  15137. specific modifiers are described in sub-sections which follow.
  15138. Pigment modifiers of any kind apply only to the pigment and not
  15139. to other parts of the texture. Modifiers must be specified last.
  15140.  
  15141. A pigment statement is part of a texture specification.  However
  15142. it can be tedious to use a texture statement just to add a color
  15143. to an object. Therefore you may attach a pigment directly to an
  15144. object without explicitly specifying that it as part of a
  15145. texture. For example instead of this:
  15146.  
  15147.   object {My_Object texture{pigment{color Red}}}
  15148. you may shorten it to:
  15149.  
  15150.   object {My_Object pigment{color Red}}
  15151. Note however that doing so creates an entire texture structure
  15152. with default normal and finish statements just as if you had
  15153. explicitly typed the full texture{...} around it.
  15154.  
  15155. Pigment identifiers may be declared to make scene files more
  15156. readable and to parameterize scenes so that changing a single
  15157. declaration changes many values. An identifier is declared as
  15158. follows.
  15159.  
  15160. PIGMENT_DECLARATION:
  15161.   #declare IDENTIFIER = PIGMENT   |
  15162.   #local IDENTIFIER = PIGMENT
  15163. Where IDENTIFIER is the name of the identifier up to 40
  15164. characters long and PIGMENT is any valid pigment statement.  See
  15165. "#declare vs. #local" for information on identifier scope.
  15166.  
  15167.  
  15168. 4.7.1.1   Solid Color Pigments
  15169. The simplest type of pigment is a solid color. To specify a solid
  15170. color you simply put a color specification inside a pigment
  15171. statement. For example:
  15172.  
  15173.   pigment {color Orange}
  15174. A color specification consists of the optional keyword color
  15175. followed by a color identifier or by a specification of the
  15176. amount of red, green, blue, filtered and unfiltered transparency
  15177. in the surface. See section "Specifying Colors" for more details
  15178. about colors. Any pattern modifiers used with a solid color are
  15179. ignored because there is no pattern to modify.
  15180.  
  15181.  
  15182. 4.7.1.2   Color List Pigments
  15183. There are three color list patterns: checker, hexagon and brick.
  15184. The result is a pattern of solid colors with distinct edges
  15185. rather than a blending of colors as with color mapped patterns.
  15186. Each of these patterns is covered in more detail in a later
  15187. section. The syntax is:
  15188.  
  15189. COLOR_LIST_PIGMENT:
  15190.   pigment{brick [COLOR_1, [COLOR_2]] [PIGMENT_MODIFIERS...] }
  15191.   |
  15192.   pigment{checker [COLOR_1, [COLOR_2]] [PIGMENT_MODIFIERS...] }
  15193.   |
  15194.   pigment{hexagon [COLOR_1, [COLOR_2, [COLOR_3]]]
  15195.   [PIGMENT_MODIFIERS...] }
  15196. Each COLOR_n is any valid color specification. There should be a
  15197. comma between each color or the color keyword should be used as a
  15198. separator so that POV-Ray can determine where each color
  15199. specification starts and ends. The brick and checker pattern
  15200. expects two colors and hexagon expects three.  If an insufficient
  15201. number of colors is specified then default colors are used.
  15202.  
  15203.  
  15204. 4.7.1.3   Color Maps
  15205. Most of the color patterns do not use abrupt color changes of
  15206. just two or three colors like those in the brick, checker or
  15207. hexagon patterns.  They instead use smooth transitions of many
  15208. colors that gradually change from one point to the next. The
  15209. colors are defined in a pigment modifier called a color_map that
  15210. describes how the pattern blends from one color to the next.
  15211.  
  15212. Each of the various pattern types available is in fact a
  15213. mathematical function that takes any x, y, z location and turns
  15214. it into a number between 0.0 and 1.0 inclusive. That number is
  15215. used to specify what mix of colors to use from the color map.
  15216.  
  15217. The syntax for color_map is as follows:
  15218.  
  15219. COLOR_MAP:
  15220.   color_map{ COLOR_MAP_BODY }   |   colour_map{ COLOR_MAP_BODY }
  15221. COLOR_MAP_BODY:
  15222.   COLOR_MAP_IDENTIFIER   |   COLOR_MAP_ENTRY...
  15223. COLOR_MAP_ENTRY:
  15224.   [ Value  COLOR ]   |   [ Value_1, Value_2 color COLOR_1 color
  15225.   COLOR_2 ]
  15226. Where each Value_n is a float values between 0.0 and 1.0
  15227. inclusive and each COLOR_n, is color specifications. Note that
  15228. the [] brackets are part of the actual COLOR_MAP_ENTRY. They are
  15229. not notational symbols denoting optional parts. The brackets
  15230. surround each entry in the color map. There may be from 2 to 256
  15231. entries in the map. The alternate spelling colour_map may be
  15232. used.
  15233.  
  15234. Here is an example:
  15235.  
  15236.   sphere {
  15237.     <0,1,2>, 2
  15238.     pigment {
  15239.       gradient x       //this is the PATTERN_TYPE
  15240.       color_map {
  15241.         [0.1  color Red]
  15242.         [0.3  color Yellow]
  15243.         [0.6  color Blue]
  15244.         [0.6  color Green]
  15245.         [0.8  color Cyan]
  15246.       }
  15247.     }
  15248.   }
  15249. The pattern function gradient x is evaluated and the result is a
  15250. value from 0.0 to 1.0. If the value is less than the first entry
  15251. (in this case 0.1) then the first color (red) is used. Values
  15252. from 0.1 to 0.3 use a blend of red and yellow using linear
  15253. interpolation of the two colors. Similarly values from 0.3 to 0.6
  15254. blend from yellow to blue. Note that the 3rd and 4th entries both
  15255. have values of 0.6. This causes an immediate abrupt shift of
  15256. color from blue to green. Specifically a value that is less than
  15257. 0.6 will be blue but exactly equal to 0.6 will be green. Moving
  15258. along, values from 0.6 to 0.8 will be a blend of green and cyan.
  15259. Finally any value greater than or equal to 0.8 will be cyan.
  15260.  
  15261. If you want areas of unchanging color you simply specify the same
  15262. color for two adjacent entries. For example:
  15263.  
  15264.   color_map {
  15265.     [0.1  color Red]
  15266.     [0.3  color Yellow]
  15267.     [0.6  color Yellow]
  15268.     [0.8  color Green]
  15269.   }
  15270. In this case any value from 0.3 to 0.6 will be pure yellow.
  15271.  
  15272. The first syntax version of COLOR_MAP_ENTRY with one float and
  15273. one color is the current standard.  The other double entry
  15274. version is obsolete and should be avoided.  The previous example
  15275. would look as follows using the old syntax.
  15276.  
  15277.   color_map {
  15278.     [0.0 0.1  color Red color Red]
  15279.     [0.1 0.3  color Red color Yellow]
  15280.     [0.3 0.6  color Yellow color Yellow]
  15281.     [0.6.0.8  color Yellow color Green]
  15282.     [0.8 1.0  color Green color Green]
  15283.   }
  15284. You may use color_map with any patterns except brick, checker,
  15285. hexagon and image_map. You may declare and use color_map
  15286. identifiers. For example:
  15287.  
  15288.   #declare Rainbow_Colors=
  15289.     color_map {
  15290.       [0.0   color Magenta]
  15291.       [0.33  color Yellow]
  15292.       [0.67  color Cyan]
  15293.       [1.0   color Magenta]
  15294.     }
  15295.   object{My_Object
  15296.     pigment{
  15297.       gradient x
  15298.       color_map{Rainbow_Colors}
  15299.     }
  15300.   }
  15301.  
  15302. 4.7.1.4   Pigment Maps and Pigment Lists
  15303. In addition to specifying blended colors with a color map you may
  15304. create a blend of pigments using a pigment_map. The syntax for a
  15305. pigment map is identical to a color map except you specify a
  15306. pigment in each map entry (and not a color).
  15307.  
  15308. The syntax for pigment_map is as follows:
  15309.  
  15310. PIGMENT_MAP:
  15311.   pigment_map{ PIGMENT_MAP_BODY }
  15312. PIGMENT_MAP_BODY:
  15313.   PIGMENT_MAP_IDENTIFIER   |   PIGMENT_MAP_ENTRY...
  15314. PIGMENT_MAP_ENTRY:
  15315.   [ Value  PIGMENT_BODY ]
  15316. Where Value is a float value between 0.0 and 1.0 inclusive and
  15317. each PIGMENT_BODY is anything which can be inside a pigment{...}
  15318. statement.  The pigment keyword and {} braces need not be
  15319. specified.
  15320.  
  15321. Note that the [] brackets are part of the actual
  15322. PIGMENT_MAP_ENTRY. They are not notational symbols denoting
  15323. optional parts. The brackets surround each entry in the pigment
  15324. map. There may be from 2 to 256 entries in the map.
  15325.  
  15326. For example
  15327.  
  15328.   sphere {
  15329.     <0,1,2>, 2
  15330.     pigment {
  15331.       gradient x       //this is the PATTERN_TYPE
  15332.       pigment_map {
  15333.         [0.3 wood scale 0.2]
  15334.         [0.3 Jade]    //this is a pigment identifier
  15335.         [0.6 Jade]
  15336.         [0.9 marble turbulence 1]
  15337.       }
  15338.     }
  15339.   }
  15340. When the gradient x function returns values from 0.0 to 0.3 the
  15341. scaled wood pigment is used. From 0.3 to 0.6 the pigment
  15342. identifier Jade is used. From 0.6 up to 0.9 a blend of Jade and a
  15343. turbulent marble is used. From 0.9 on up only the turbulent
  15344. marble is used.
  15345.  
  15346. Pigment maps may be nested to any level of complexity you desire.
  15347. The pigments in a map may have color maps or pigment maps or any
  15348. type of pigment you want. Any entry of a pigment map may be a
  15349. solid color however if all entries are solid colors you should
  15350. use a color_map which will render slightly faster.
  15351.  
  15352. Entire pigments may also be used with the block patterns such as
  15353. checker, hexagon and brick. For example...
  15354.  
  15355.   pigment {
  15356.     checker
  15357.     pigment { Jade scale .8 }
  15358.     pigment { White_Marble scale .5 }
  15359.   }
  15360. Note that in the case of block patterns the pigment wrapping is
  15361. required around the pigment information.
  15362.  
  15363. A pigment map is also used with the average pigment type. See
  15364. "Average" for details.
  15365.  
  15366. You may not use pigment_map or individual pigments with an
  15367. image_map. See section "Texture Maps" for an alternative way to
  15368. do this.
  15369.  
  15370. You may declare and use pigment map identifiers but the only way
  15371. to declare a pigment block pattern list is to declare a pigment
  15372. identifier for the entire pigment.
  15373.  
  15374.  
  15375. 4.7.1.5   Image Maps
  15376. When all else fails and none of the above pigment pattern types
  15377. meets your needs you can use an image_map to wrap a 2-D bit-
  15378. mapped image around your 3-D objects.
  15379.  
  15380.  
  15381. 4.7.1.5.1 Specifying an Image Map
  15382. The syntax for an image_map is:
  15383.  
  15384. IMAGE_MAP:
  15385.   pigment{
  15386.      image_map{ BITMAP_TYPE "bitmap.ext" [IMAGE_MAP_MODS...] }
  15387.      [PIGMENT_MODFIERS...]
  15388.   }
  15389. BITMAP_TYPE:
  15390.   gif   |   tga   |   iff   |   ppm   |   pgm   |   png   |
  15391.   sys
  15392. IMAGE_MAP_MOD:
  15393.   map_type  Type   |   once   |   interpolate  Type   |
  15394.   filter Palette, Amount   |   filter all Amount   |
  15395.   transmit Palette, Amount   |   transmit all Amount
  15396. After the required BITMAP_TYPE keyword is a string expression
  15397. containing the name of a bitmapped image file of the specified
  15398. type.  Several optional modifiers may follow the file
  15399. specification. The modifiers are described below. Note that
  15400. earlier versions of POV-Ray allowed some modifiers before the
  15401. BITMAP_TYPE but that syntax is being phased out in favor of the
  15402. syntax described here.  Note sys format is a system-specific
  15403. format such as BMP for Windows or Pict for Macintosh.
  15404.  
  15405. Filenames specified in the image_map statements will be searched
  15406. for in the home (current) directory first and, if not found, will
  15407. then be searched for in directories specified by any +L or
  15408. Library_Path options active. This would facilitate keeping all
  15409. your image maps files in a separate subdirectory and giving a
  15410. Library_Path option to specify where your library of image maps
  15411. are.  See "Library Paths" for details.
  15412.  
  15413. By default, the image is mapped onto the x-y-plane. The image is
  15414. projected onto the object as though there were a slide projector
  15415. somewhere in the -z-direction. The image exactly fills the square
  15416. area from (x,y) coordinates (0,0) to (1,1) regardless of the
  15417. image's original size in pixels. If you would like to change this
  15418. default you may translate, rotate or scale the pigment or texture
  15419. to map it onto the object's surface as desired.
  15420.  
  15421. In the section "Checker", the checker pigment pattern is
  15422. explained. The checks are described as solid cubes of colored
  15423. clay from which objects are carved. With image maps you should
  15424. imagine that each pixel is a long, thin, square, colored rod that
  15425. extends parallel to the z-axis. The image is made from rows and
  15426. columns of these rods bundled together and the object is then
  15427. carved from the bundle.
  15428.  
  15429. If you would like to change this default orientation you may
  15430. translate, rotate or scale the pigment or texture to map it onto
  15431. the object's surface as desired.
  15432.  
  15433. The file name is optionally followed by one or more
  15434. BITMAP_MODIFIERS.  The filter, filter all, transmit, and transmit
  15435. all modifiers are specific to image maps and are discussed in the
  15436. following sections.  An image_map may also use generic bitmap
  15437. modifiers map_type, once and interpolate described in "Bitmap
  15438. Modifiers"
  15439.  
  15440.  
  15441. 4.7.1.5.2 The Filter and Transmit Bitmap Modifiers
  15442. To make all or part of an image map transparent you can specify
  15443. filter and/or transmit values for the color palette/registers of
  15444. PNG, GIF or IFF pictures (at least for the modes that use
  15445. palettes). You can do this by adding the keyword filter or
  15446. transmit following the filename. The keyword is followed by two
  15447. numbers. The first number is the palette number value and the
  15448. second is the amount of transparency. The values should be
  15449. separated by a comma. For example:
  15450.  
  15451.   image_map {
  15452.     gif "mypic.gif"
  15453.     filter   0, 0.5 // Make color 0 50% filtered transparent
  15454.     filter   5, 1.0 // Make color 5 100% filtered transparent
  15455.     transmit 8, 0.3 // Make color 8 30% non-filtered transparent
  15456.   }
  15457. You can give the entire image a filter or transmit value using
  15458. filter all Amount or transmit all Amount. For example:
  15459.  
  15460.   image_map {
  15461.     gif "stnglass.gif"
  15462.     filter all 0.9
  15463.   }
  15464. Note that early versions of POV-Ray used the keyword alpha to
  15465. specify filtered transparency however that word is often used to
  15466. describe non-filtered transparency. For this reason alpha is no
  15467. longer used.
  15468.  
  15469. See section "Specifying Colors" for details on the differences
  15470. between filtered and non-filtered transparency.
  15471.  
  15472.  
  15473. 4.7.1.5.3 Using the Alpha Channel
  15474. Another way to specify non-filtered transmit transparency in an
  15475. image map is by using the alpha channel.  PNG file format allows
  15476. you to store a different transparency for each color index in the
  15477. PNG file, if desired. If your paint programs support this feature
  15478. of PNG you can do the transparency editing within your paint
  15479. program rather than specifying transmit values for each color in
  15480. the POV file. Since PNG and TGA image formats can also store full
  15481. alpha channel (transparency) information you can generate image
  15482. maps that have transparency which isn't dependent on the color of
  15483. a pixel but rather its location in the image.
  15484.  
  15485. Although POV uses transmit 0.0 to specify no transparency and 1.0
  15486. to specify full transparency, the alpha data ranges from 0 to 255
  15487. in the opposite direction. Alpha data 0 means the same as
  15488. transmit 1.0 and alpha data 255 produces transmit 0.0.
  15489.  
  15490.  
  15491. 4.7.1.6   Quick Color
  15492. When developing POV-Ray scenes its often useful to do low quality
  15493. test runs that render faster. The +Q command line switch or
  15494. Quality INI option can be used to turn off some time consuming
  15495. color pattern and lighting calculations to speed things up. See
  15496. "Quality Settings" for details.  However all settings of +Q5 or
  15497. Quality=5 or lower turns off pigment calculations and creates
  15498. gray objects.
  15499.  
  15500. By adding a quick_color to a pigment you tell POV-Ray what solid
  15501. color to use for quick renders instead of a patterned pigment.
  15502. For example:
  15503.  
  15504.   pigment {
  15505.     gradient x
  15506.     color_map{
  15507.       [0.0 color Yellow]
  15508.       [0.3 color Cyan]
  15509.       [0.6 color Magenta]
  15510.       [1.0 color Cyan]
  15511.     }
  15512.     turbulence 0.5
  15513.     lambda 1.5
  15514.     omega 0.75
  15515.     octaves 8
  15516.     quick_color Neon_Pink
  15517.   }
  15518. This tells POV-Ray to use solid Neon_Pink for test runs at
  15519. quality +Q5 or lower but to use the turbulent gradient pattern
  15520. for rendering at +Q6 and higher.
  15521.  
  15522. Note that solid color pigments such as
  15523.  
  15524.   pigment {color Magenta}
  15525. automatically set the quick_color to that value. You may override
  15526. this if you want. Suppose you have 10 spheres on the screen and
  15527. all are yellow. If you want to identify them individually you
  15528. could give each a different quick_color like this:
  15529.  
  15530.   sphere {
  15531.     <1,2,3>,4
  15532.     pigment { color Yellow  quick_color Red }
  15533.   }
  15534.   sphere {
  15535.     <-1,-2,-3>,4
  15536.     pigment { color Yellow  quick_color Blue }
  15537.   }
  15538. and so on. At +Q6 or higher they will all be yellow but at +Q5 or
  15539. lower each would be different colors so you could identify them.
  15540.  
  15541. The alternate spelling quick_colour is also supported.
  15542.  
  15543.  
  15544. 4.7.2     Normal
  15545. Ray-tracing is known for the dramatic way it depicts reflection,
  15546. refraction and lighting effects. Much of our perception depends
  15547. on the reflective properties of an object. Ray tracing can
  15548. exploit this by playing tricks on our perception to make us see
  15549. complex details that aren't really there.
  15550.  
  15551. Suppose you wanted a very bumpy surface on the object. It would
  15552. be very difficult to mathematically model lots of bumps. We can
  15553. however simulate the way bumps look by altering the way light
  15554. reflects off of the surface. Reflection calculations depend on a
  15555. vector called a surface normal vector. This is a vector which
  15556. points away from the surface and is perpendicular to it. By
  15557. artificially modifying (or perturbing) this normal vector you can
  15558. simulate bumps.  This is done by adding an optional normal
  15559. statement.
  15560.  
  15561. Note that attaching a normal pattern does not really modify the
  15562. surface. It only affects the way light reflects or refracts at
  15563. the surface so that it looks bumpy.  The syntax is:
  15564.  
  15565. NORMAL:
  15566.   normal{ [NORMAL_IDENTIFIER] [NORMAL_TYPE] [NORMAL_MODIFIER...]
  15567.   }
  15568. NORMAL_TYPE:
  15569.   PATTERN_TYPE Amount   |
  15570.   bump_map{ BITMAP_TYPE "bitmap.ext" [BUMP_MAP_MODS...] }
  15571. NORMAL_MODIFIER:
  15572.   PATTERN_MODIFIER   |   NORMAL_LIST   |
  15573.   normal_map{ NORMAL_MAP_BODY }   |
  15574.   slope_map{ SLOPE_MAP_BODY }   |
  15575.   bump_size Amount
  15576. Each of the items in a normal are optional but if they are
  15577. present, they must be in the order shown. Any items after the
  15578. NORMAL_IDENTIFIER modify or override settings given in the
  15579. identifier. If no identifier is specified then the items modify
  15580. the normal values in the current default texture. The
  15581. PATTERN_TYPE may optionally be followed by a float value that
  15582. controls the apparent depth of the bumps. Typical values range
  15583. from 0.0 to 1.0 but any value may be used. Negative values invert
  15584. the pattern. The default value if none is specified is 0.5.
  15585.  
  15586. There are four basic types of NORMAL_TYPEs. They are block
  15587. pattern normals, continuous pattern normals, specialized normals
  15588. and bump maps. They differ in the types of modifiers you may use
  15589. with them. The pattern type is optionally followed by one or more
  15590. normal modifiers.  In addition to general pattern modifiers such
  15591. as transformations, turbulence, and warp modifiers, normals may
  15592. also have a NORMAL_LIST, slope_map, normal_map, and
  15593. bump_sizewhich are specific to normals.  See "Pattern Modifiers"
  15594. for information on general modifiers.  The normal-specific
  15595. modifiers are described in sub-sections which follow.  Normal
  15596. modifiers of any kind apply only to the normal and not to other
  15597. parts of the texture. Modifiers must be specified last.
  15598.  
  15599. Originally POV-Ray had some patterns which were exclusively used
  15600. for pigments while others were exclusively used for normals.
  15601. Since POV-Ray 3.0 you can use any pattern for either pigments or
  15602. normals. For example it is now valid to use ripples as a pigment
  15603. or wood as a normal type. The patterns bumps, dents, ripples,
  15604. waves, wrinkles, and bump_map were once exclusively normal
  15605. patterns which could not be used as pigments. Because these six
  15606. types use specialized normal modification calculations they
  15607. cannot have slope_map, normal_map or wave shape modifiers. All
  15608. other normal pattern types may use them.  Because block patterns
  15609. checker, hexagon, and brick do not return a continuous series of
  15610. values, they cannot use these modifiers either.  See "Patterns"
  15611. for details about specific patterns.
  15612.  
  15613. A normal statement is part of a texture specification.  However
  15614. it can be tedious to use a texture statement just to add a bumps
  15615. to an object. Therefore you may attach a normal directly to an
  15616. object without explicitly specifying that it as part of a
  15617. texture. For example instead of this:
  15618.  
  15619.   object {My_Object texture{normal{bumps 0.5}}}
  15620. you may shorten it to:
  15621.  
  15622.   object {My_Object normal{bumps 0.5}}
  15623. Note however that doing so creates an entire texture structure
  15624. with default pigment and finish statements just as if you had
  15625. explicitly typed the full texture{...} around it.
  15626.  
  15627. Normal identifiers may be declared to make scene files more
  15628. readable and to parameterize scenes so that changing a single
  15629. declaration changes many values. An identifier is declared as
  15630. follows.
  15631.  
  15632. NORMAL_DECLARATION:
  15633.   #declare IDENTIFIER = NORMAL   |
  15634.   #local IDENTIFIER = NORMAL
  15635. Where IDENTIFIER is the name of the identifier up to 40
  15636. characters long and NORMAL is any valid normal statement.  See
  15637. "#declare vs. #local" for information on identifier scope.
  15638.  
  15639.  
  15640. 4.7.2.1   Slope Maps
  15641. A slope_map is a normal pattern modifier which gives the user a
  15642. great deal of control over the exact shape of the bumpy features.
  15643. Each of the various pattern types available is in fact a
  15644. mathematical function that takes any x, y, z location and turns
  15645. it into a number between 0.0 and 1.0 inclusive. That number is
  15646. used to specify where the various high and low spots are.  The
  15647. slope_map lets you further shape the contours. It is best
  15648. illustrated with a gradient normal pattern. Suppose you have...
  15649.  
  15650.   plane{ z, 0
  15651.     pigment{ White }
  15652.     normal { gradient x }
  15653.   }
  15654. This gives a ramp wave pattern that looks like small linear ramps
  15655. that climb from the points at x=0 to x=1 and then abruptly drops
  15656. to 0 again to repeat the ramp from x=1 to x=2. A slope map turns
  15657. this simple linear ramp into almost any wave shape you want. The
  15658. syntax is as follows...
  15659.  
  15660. The syntax for slope_map is as follows:
  15661.  
  15662. SLOPE_MAP:
  15663.   slope_map{ SLOPE_MAP_BODY }
  15664. SLOPE_MAP_BODY:
  15665.   SLOPE_MAP_IDENTIFIER   |   SLOPE_MAP_ENTRY...
  15666. SLOPE_MAP_ENTRY:
  15667.   [ Value, <Height, Slope> ]
  15668. Note that the [] brackets are part of the actual SLOPE_MAP_ENTRY.
  15669. They are not notational symbols denoting optional parts. The
  15670. brackets surround each entry in the slope map. There may be from
  15671. 2 to 256 entries in the map.
  15672.  
  15673. Each Value is a float value between 0.0 and 1.0 inclusive and
  15674. each <Height, Slope> is a 2 component vectors such as <0,1> where
  15675. the first value represents the apparent height of the wave and
  15676. the second value represents the slope of the wave at that point.
  15677. The height should range between 0.0 and 1.0 but any value could
  15678. be used.
  15679.  
  15680. The slope value is the change in height per unit of distance. For
  15681. example a slope of zero means flat, a slope of 1.0 means slope
  15682. upwards at a 45 degree angle and a slope of -1 means slope down
  15683. at 45 degrees. Theoretically a slope straight up would have
  15684. infinite slope. In practice, slope values should be kept in the
  15685. range -3.0 to +3.0. Keep in mind that this is only the visually
  15686. apparent slope. A normal does not actually change the surface.
  15687.  
  15688. For example here is how to make the ramp slope up for the first
  15689. half and back down on the second half creating a triangle wave
  15690. with a sharp peak in the center.
  15691.  
  15692.   normal {
  15693.     gradient x       // this is the PATTERN_TYPE
  15694.     slope_map {
  15695.       [0   <0, 1>]   // start at bottom and slope up
  15696.       [0.5 <1, 1>]   // halfway through reach top still climbing
  15697.       [0.5 <1,-1>]   // abruptly slope down
  15698.       [1   <0,-1>]   // finish on down slope at bottom
  15699.     }
  15700.   }
  15701. The pattern function is evaluated and the result is a value from
  15702. 0.0 to 1.0. The first entry says that at x=0 the apparent height
  15703. is 0 and the slope is 1. At x=0.5 we are at height 1 and slope is
  15704. still up at 1. The third entry also specifies that at x=0.5
  15705. (actually at some tiny fraction above 0.5) we have height 1 but
  15706. slope -1 which is downwards. Finally at x=1 we are at height 0
  15707. again and still sloping down with slope -1.
  15708.  
  15709. Although this example connects the points using straight lines
  15710. the shape is actually a cubic spline. This example creates a
  15711. smooth sine wave.
  15712.  
  15713.   normal {
  15714.     gradient x          // this is the PATTERN_TYPE
  15715.     slope_map {
  15716.       [0    <0.5, 1>]   // start in middle and slope up
  15717.       [0.25 <1.0, 0>]   // flat slope at top of wave
  15718.       [0.5  <0.5,-1>]   // slope down at mid point
  15719.       [0.75 <0.0, 0>]   // flat slope at bottom
  15720.       [1    <0.5, 1>]   // finish in middle and slope up
  15721.     }
  15722.   }
  15723. This example starts at height 0.5 sloping up at slope 1. At a
  15724. fourth of the way through we are at the top of the curve at
  15725. height 1 with slope 0 which is flat. The space between these two
  15726. is a gentle curve because the start and end slopes are different.
  15727. At half way we are at half height sloping down to bottom out at
  15728. 3/4ths. By the end we are climbing at slope 1 again to complete
  15729. the cycle. There are more examples in slopemap.pov in the sample
  15730. scenes.
  15731.  
  15732. A slope_map may be used with any pattern except brick, checker,
  15733. hexagon, bumps, dents, ripples, waves, wrinkles and bump_map.
  15734.  
  15735. You may declare and use slope map identifiers. For example:
  15736.  
  15737.   #declare Fancy_Wave =
  15738.     slope_map {       // Now let's get fancy
  15739.       [0.0  <0, 1>]   // Do tiny triangle here
  15740.       [0.2  <1, 1>]   //  down
  15741.       [0.2  <1,-1>]   //     to
  15742.       [0.4  <0,-1>]   //       here.
  15743.       [0.4  <0, 0>]   // Flat area
  15744.       [0.5  <0, 0>]   //   through here.
  15745.       [0.5  <1, 0>]   // Square wave leading edge
  15746.       [0.6  <1, 0>]   //   trailing edge
  15747.       [0.6  <0, 0>]   // Flat again
  15748.       [0.7  <0, 0>]   //   through here.
  15749.       [0.7  <0, 3>]   // Start scallop
  15750.       [0.8  <1, 0>]   //   flat on top
  15751.       [0.9  <0,-3>]   //     finish here.
  15752.       [0.9  <0, 0>]   // Flat remaining through 1.0
  15753.     }
  15754.   object{ My_Object
  15755.     pigment { White }
  15756.     normal {
  15757.       wood
  15758.       slope_map { Fancy_Wave }
  15759.     }
  15760.   }
  15761.  
  15762. 4.7.2.2   Normal Maps and Normal Lists
  15763. Most of the time you will apply single normal pattern to an
  15764. entire surface but you may also create a pattern or blend of
  15765. normals using a normal_map. The syntax for a normal_map is
  15766. identical to a pigment_map except you specify a normal in each
  15767. map entry.
  15768.  
  15769. The syntax for normal_map is as follows:
  15770.  
  15771. NORMAL_MAP:
  15772.   normal_map{ NORMAL_MAP_BODY }
  15773. NORMAL_MAP_BODY:
  15774.   NORMAL_MAP_IDENTIFIER   |   NORMAL_MAP_ENTRY...
  15775. NORMAL_MAP_ENTRY:
  15776.   [ Value  NORMAL_BODY ]
  15777. Where Value is a float value between 0.0 and 1.0 inclusive and
  15778. each NORMAL_BODY is anything which can be inside a normal{...}
  15779. statement.  The normal keyword and {} braces need not be
  15780. specified.
  15781.  
  15782. Note that the [] brackets are part of the actual
  15783. NORMAL_MAP_ENTRY. They are not notational symbols denoting
  15784. optional parts. The brackets surround each entry in the normal
  15785. map. There may be from 2 to 256 entries in the map.
  15786.  
  15787. For example
  15788.  
  15789.   normal {
  15790.     gradient x       //this is the PATTERN_TYPE
  15791.     normal_map {
  15792.       [0.3  bumps scale 2]
  15793.       [0.3  dents]
  15794.       [0.6  dents]
  15795.       [0.9  marble turbulence 1]
  15796.     }
  15797.   }
  15798. When the gradient x function returns values from 0.0 to 0.3 then
  15799. the scaled bumps normal is used. From 0.3 to 0.6 dents are From
  15800. 0.6 up to 0.9 a blend of dents and a turbulent marble is used.
  15801. From 0.9 on up only the turbulent marble is used.
  15802.  
  15803. Normal maps may be nested to any level of complexity you desire.
  15804. The normals in a map may have slope maps or normal maps or any
  15805. type of normal you want.
  15806.  
  15807. A normal map is also used with the average normal type. See
  15808. "Average" for details.
  15809.  
  15810. Entire normals in a normal list may also be used with the block
  15811. patterns such as checker, hexagon and brick. For example...
  15812.  
  15813.   normal {
  15814.     checker
  15815.       normal { gradient x scale .2 }
  15816.       normal { gradient y scale .2 }
  15817.     }
  15818.   }
  15819. Note that in the case of block patterns the normal wrapping is
  15820. required around the normal information.
  15821.  
  15822. You may not use normal_map or individual normals with a bump_map.
  15823. See section "Texture Maps" for an alternative way to do this.
  15824.  
  15825. You may declare and use normal map identifiers but the only way
  15826. to declare a normal block pattern list is to declare a normal
  15827. identifier for the entire normal.
  15828.  
  15829.  
  15830. 4.7.2.3   Bump Maps
  15831. When all else fails and none of the above normal pattern types
  15832. meets your needs you can use a bump_map to wrap a 2-D bit-mapped
  15833. bump pattern around your 3-D objects.
  15834.  
  15835. Instead of placing the color of the image on the shape like an
  15836. image_map a bump_map perturbs the surface normal based on the
  15837. color of the image at that point. The result looks like the image
  15838. has been embossed into the surface. By default, a bump map uses
  15839. the brightness of the actual color of the pixel. Colors are
  15840. converted to gray scale internally before calculating height.
  15841. Black is a low spot, white is a high spot. The image's index
  15842. values may be used instead (see section "Use_Index and Use_Color"
  15843. below).
  15844.  
  15845.  
  15846. 4.7.2.3.1 Specifying a Bump Map
  15847. The syntax for an bump_map is:
  15848.  
  15849. BUMP_MAP:
  15850.   normal{
  15851.      bump_map{ BITMAP_TYPE "bitmap.ext" [BUMP_MAP_MODS...] }
  15852.      [NORMAL_MODFIERS...]
  15853.   }
  15854. BITMAP_TYPE:
  15855.   gif   |   tga   |   iff   |   ppm   |   pgm   |   png   |
  15856.   sys
  15857. BUMP_MAP_MOD:
  15858.   map_type  Type   |   once   |   interpolate  Type   |
  15859.   use_color   |   use_colour   |   bump_size  Value
  15860. After the required BITMAP_TYPE keyword is a string expression
  15861. containing the name of a bitmapped bump file of the specified
  15862. type.  Several optional modifiers may follow the file
  15863. specification. The modifiers are described below. Note that
  15864. earlier versions of POV-Ray allowed some modifiers before the
  15865. BITMAP_TYPE but that syntax is being phased out in favor of the
  15866. syntax described here.  Note sys format is a system-specific
  15867. format such as BMP for Windows or Pict for Macintosh.
  15868.  
  15869. Filenames specified in the bump_map statements will be searched
  15870. for in the home (current) directory first and, if not found, will
  15871. then be searched for in directories specified by any +L or
  15872. Library_Path options active. This would facilitate keeping all
  15873. your bump maps files in a separate subdirectory and giving a
  15874. Library_Path option to specify where your library of bump maps
  15875. are.  See "Library Paths" for details.
  15876.  
  15877. By default, the bump pattern is mapped onto the x-y-plane. The
  15878. bump pattern is projected onto the object as though there were a
  15879. slide projector somewhere in the -z-direction. The pattern
  15880. exactly fills the square area from (x,y) coordinates (0,0) to
  15881. (1,1) regardless of the pattern's original size in pixels. If you
  15882. would like to change this default you may translate, rotate or
  15883. scale the pigment or texture to map it onto the object's surface
  15884. as desired.  If you would like to change this default orientation
  15885. you may translate, rotate or scale the pigment or texture to map
  15886. it onto the object's surface as desired.
  15887.  
  15888. The file name is optionally followed by one or more
  15889. BITMAP_MODIFIERS. The bump_size, use_color and use_index
  15890. modifiers are specific to bump maps and are discussed in the
  15891. following sections. See section "Bitmap Modifiers" for the
  15892. generic bitmap modifiers map_type, once and interpolate described
  15893. in "Bitmap Modifiers"
  15894.  
  15895.  
  15896. 4.7.2.3.2 Bump_Size
  15897. The relative bump size can be scaled using the bump_size
  15898. modifier.  The bump size number can be any number other than 0
  15899. but typical values are from about 0.1 to as high as 4.0 or 5.0.
  15900.  
  15901.   normal {
  15902.     bump_map {
  15903.       gif "stuff.gif"
  15904.       bump_size 5.0
  15905.     }
  15906.   }
  15907. Originally bump_size could only be used inside a bump map but it
  15908. can now be used with any normal. Typically it is used to override
  15909. a previously defined size. For example:
  15910.  
  15911.   normal {
  15912.     My_Normal   //this is a previously defined normal identifier
  15913.     bump_size 2.0
  15914.   }
  15915.  
  15916. 4.7.2.3.3 Use_Index and Use_Color
  15917. Usually the bump map converts the color of the pixel in the map
  15918. to a gray scale intensity value in the range 0.0 to 1.0 and
  15919. calculates the bumps based on that value. If you specify
  15920. use_index, the bump map uses the color's palette number to
  15921. compute as the height of the bump at that point. So, color number
  15922. 0 would be low and color number 255 would be high (if the image
  15923. has 256 palette entries). The actual color of the pixels doesn't
  15924. matter when using the index. This option is only available on
  15925. palette based formats. The use_color keyword may be specified to
  15926. explicitly note that the color methods should be used instead.
  15927. The alternate spelling use_colour is also valid. These modifiers
  15928. may only be used inside the bump_map statement.
  15929.  
  15930.  
  15931. 4.7.3     Finish
  15932. The finish properties of a surface can greatly affect its
  15933. appearance. How does light reflect? What happens in shadows? What
  15934. kind of highlights are visible. To answer these questions you
  15935. need a finish.
  15936.  
  15937. The syntax for finish is as follows:
  15938.  
  15939. FINISH:
  15940.   finish { [FINISH_IDENTIFIER] [FINISH_ITEMS...] }
  15941. FINISH_ITEMS:
  15942.   ambient COLOR   |   diffuse Amount   |   brilliance Amount   |
  15943.   phong Amount   |   phong_size Amount   |
  15944.   specular Amount   |   roughness Amount   |
  15945.   metallic [Amount]   |   reflection COLOR   |
  15946.   reflection_exponent Amount   |
  15947.   irid { Irid_Amount [IRID_ITEMS...] }   |   crand Amount
  15948. IRID_ITEMS:
  15949.   thickness Amount   |   turbulence Amount
  15950. The FINISH_IDENTIFIER is optional but should proceed all other
  15951. items. Any items after the FINISH_IDENTIFIER modify or override
  15952. settings given in the FINISH_IDENTIFIER. If no identifier is
  15953. specified then the items modify the finish values in the current
  15954. default texture.  Note that transformations are not allowed
  15955. inside a finish because finish items cover the entire surface
  15956. uniformly.  Each of the FINISH_ITEMS listed above is described in
  15957. sub-sections below.
  15958.  
  15959. In earlier versions of POV-Ray, the refraction, ior, and caustics
  15960. keywords were part of the finish statement but they are now part
  15961. of the interior statement.  They are still supported under finish
  15962. for backward compatibility but the results may not be 100%
  15963. identical to previous versions. See "Why are Interior and Media
  15964. Necessary?" for details.
  15965.  
  15966. A finish statement is part of a texture specification.  However
  15967. it can be tedious to use a texture statement just to add a
  15968. highlights or other lighting properties to an object. Therefore
  15969. you may attach a finish directly to an object without explicitly
  15970. specifying that it as part of a texture. For example instead of
  15971. this:
  15972.  
  15973.   object {My_Object texture{finish{phong 0.5}}}
  15974. you may shorten it to:
  15975.  
  15976.   object {My_Object finish{phong 0.5}}
  15977. Note however that doing so creates an entire texture structure
  15978. with default pigment and normal statements just as if you had
  15979. explicitly typed the full texture{...} around it.
  15980.  
  15981. Finish identifiers may be declared to make scene files more
  15982. readable and to parameterize scenes so that changing a single
  15983. declaration changes many values. An identifier is declared as
  15984. follows.
  15985.  
  15986. FINISH_DECLARATION:
  15987.   #declare IDENTIFIER = FINISH   |
  15988.   #local IDENTIFIER = FINISH
  15989. Where IDENTIFIER is the name of the identifier up to 40
  15990. characters long and FINISH is any valid finish statement.  See
  15991. "#declare vs. #local" for information on identifier scope.
  15992.  
  15993.  
  15994. 4.7.3.1   Ambient
  15995. The light you see in dark shadowed areas comes from diffuse
  15996. reflection off of other objects. This light cannot be directly
  15997. modeled using ray-tracing. However we can use a trick called
  15998. ambient lighting to simulate the light inside a shadowed area.
  15999.  
  16000. Ambient light is light that is scattered everywhere in the room.
  16001. It bounces all over the place and manages to light objects up a
  16002. bit even where no light is directly shining. Computing real
  16003. ambient light would take far too much time, so we simulate
  16004. ambient light by adding a small amount of white light to each
  16005. texture whether or not a light is actually shining on that
  16006. texture.
  16007.  
  16008. This means that the portions of a shape that are completely in
  16009. shadow will still have a little bit of their surface color. It's
  16010. almost as if the texture glows, though the ambient light in a
  16011. texture only affects the shape it is used on.
  16012.  
  16013. The ambient keyword controls the amount of ambient light. Usually
  16014. a single float value is specified even though the syntax calls
  16015. for a color. For example a float value of 0.3 gets promoted to
  16016. the full color vector <0.3,0.3,0.3,0.3,0.3> which is acceptable
  16017. because only the red, green and blue parts are used.
  16018.  
  16019. The default value is 0.1 which gives very little ambient light.
  16020. The value can range from 0.0 to 1.0. Ambient light affects both
  16021. shadowed and non-shadowed areas so if you turn up the ambient
  16022. value you may want to turn down the diffuse and reflection
  16023. values.
  16024.  
  16025. Note that this method doesn't account for the color of
  16026. surrounding objects. If you walk into a room that has red walls,
  16027. floor and ceiling then your white clothing will look pink from
  16028. the reflected light. POV-Ray's ambient shortcut doesn't account
  16029. for this. There is also no way to model specular reflected
  16030. indirect illumination such as the flashlight shining in a mirror.
  16031.  
  16032. You may color the ambient light using one of two methods. You may
  16033. specify a color rather than a float after the ambient keyword in
  16034. each finish statement. For example
  16035.  
  16036.    finish { ambient rgb <0.3,0.1,0.1> } //a pink ambient
  16037. You may also specify the overall ambient light source used when
  16038. calculating the ambient lighting of an object using the global
  16039. ambient_light setting. The formula is given by
  16040.  
  16041.    Ambient = Finish_Ambient * Global_Ambient_Light_Source
  16042.  
  16043. See section "Ambient Light" for details.
  16044.  
  16045.  
  16046. 4.7.3.2   Diffuse Reflection Items
  16047. When light reflects off of a surface the laws of physics say that
  16048. it should leave the surface at the exact same angle it came in.
  16049. This is similar to the way a billiard ball bounces off a bumper
  16050. of a pool table. This perfect reflection is called specular
  16051. reflection. However only very smooth polished surfaces reflect
  16052. light in this way. Most of the time, light reflects and is
  16053. scattered in all directions by the roughness of the surface. This
  16054. scattering is called diffuse reflection because the light
  16055. diffuses or spreads in a variety of directions. It accounts for
  16056. the majority of the reflected light we see.
  16057.  
  16058. POV-Ray and most other ray-tracers can only simulate directly
  16059. light which comes directly from actual light sources.  Light
  16060. coming from other objects such as mirrors via specular reflection
  16061. (such as shining a flashlight onto a mirror for example) cannot
  16062. be simulated.  Neither can we simulate light coming from other
  16063. objects via diffuse reflections.  For example look at some dark
  16064. area under a desk or in a corner: even though a lamp may not
  16065. directly illuminate that spot, you can still see a little bit
  16066. because light comes from diffuse reflection off of nearby
  16067. objects.
  16068.  
  16069.  
  16070. 4.7.3.2.1 Diffuse
  16071. The keyword diffuse is used in a finish statement to control how
  16072. much of the light coming directly from any light sources is
  16073. reflected via diffuse reflection. For example
  16074.  
  16075.   finish {diffuse 0.7}
  16076. means that 70% of the light seen comes from direct illumination
  16077. from light sources. The default value is diffuse 0.6.
  16078.  
  16079.  
  16080. 4.7.3.2.2 Brilliance
  16081. The amount of direct light that diffuses from an object depends
  16082. upon the angle at which it hits the surface. When light hits at a
  16083. shallow angle it illuminates less. When it is directly above a
  16084. surface it illuminates more. The brilliance keyword can be used
  16085. in a finish statement to vary the way light falls off depending
  16086. upon the angle of incidence.  This controls the tightness of the
  16087. basic diffuse illumination on objects and slightly adjusts the
  16088. appearance of surface shininess.  Objects may appear more
  16089. metallic by increasing their brilliance. The default value is
  16090. 1.0.  Higher values from 5.0 to about 10.0 cause the light to
  16091. fall off less at medium to low angles. There are no limits to the
  16092. brilliance value.  Experiment to see what works best for a
  16093. particular situation. This is best used in concert with
  16094. highlighting.
  16095.  
  16096.  
  16097. 4.7.3.2.3 Crand Graininess
  16098. Very rough surfaces, such as concrete or sand, exhibit a dark
  16099. graininess in their apparent color. This is caused by the shadows
  16100. of the pits or holes in the surface. The crand keyword can be
  16101. added to a finish cause a minor random darkening in the diffuse
  16102. reflection of direct illumination. Typical values range from
  16103. crand 0.01 to crand 0.5 or higher. The default value is 0. For
  16104. example:
  16105.  
  16106.   finish { crand 0.05 }
  16107. This feature is carried over from the earliest versions of POV-
  16108. Ray and is considered obsolete. This is because the grain or
  16109. noise introduced by this feature is applied on a pixel-by-pixel
  16110. basis. This means that it will look the same on far away objects
  16111. as on close objects. The effect also looks different depending
  16112. upon the resolution you are using for the rendering. Note that
  16113. this should not be used when rendering animations. This is the
  16114. one of a few truly random features in POV-Ray and will produce an
  16115. annoying flicker of flying pixels on any textures animated with a
  16116. crand value.  For these reasons it is not a very accurate way to
  16117. model the rough surface effect.
  16118.  
  16119.  
  16120. 4.7.3.3   Highlights
  16121. Highlights are the bright spots that appear when a light source
  16122. reflects off of a smooth object. They are a blend of specular
  16123. reflection and diffuse reflection. They are specular-like because
  16124. they depend upon viewing angle and illumination angle. However
  16125. they are diffuse-like because some scattering occurs. In order to
  16126. exactly model a highlight you would have to calculate specular
  16127. reflection off of thousands of microscopic bumps called micro
  16128. facets. The more that micro facets are facing the viewer the
  16129. shinier the object appears and the tighter the highlights become.
  16130. POV-Ray uses two different models to simulate highlights without
  16131. calculating micro facets. They are the specular and Phong models.
  16132.  
  16133. Note that specular and Phong highlights are not mutually
  16134. exclusive. It is possible to specify both and they will both take
  16135. effect. Normally, however, you will only specify one or the
  16136. other.
  16137.  
  16138.  
  16139. 4.7.3.3.1 Phong Highlights
  16140. The phong keyword in the finish statement controls the amount of
  16141. Phong highlighting on the object. It causes bright shiny spots on
  16142. the object that are the color of the light source being
  16143. reflected.
  16144.  
  16145. The Phong method measures the average of the facets facing in the
  16146. mirror direction from the light sources to the viewer.
  16147.  
  16148. Phong's value is typically from 0.0 to 1.0, where 1.0 causes
  16149. complete saturation to the light source's color at the brightest
  16150. area (center) of the highlight. The default phong 0.0 gives no
  16151. highlight.
  16152.  
  16153. The size of the highlight spot is defined by the phong_size
  16154. value. The larger the phong size the tighter, or smaller, the
  16155. highlight and the shinier the appearance.  The smaller the phong
  16156. size the looser, or larger, the highlight and the less glossy the
  16157. appearance.
  16158.  
  16159. Typical values range from 1.0 (very dull) to 250 (highly
  16160. polished) though any values may be used. Default phong size is 40
  16161. (plastic) if phong_size is not specified. For example:
  16162.  
  16163.   finish { phong 0.9 phong_size 60 }
  16164. If phong is not specified phong_size has no effect.
  16165.  
  16166.  
  16167. 4.7.3.3.2 Specular Highlight
  16168. The specular keyword in a finish statement produces a highlight
  16169. which is very similar to Phong highlighting but it uses slightly
  16170. different model. The specular model more closely resembles real
  16171. specular reflection and provides a more credible spreading of the
  16172. highlights occurring near the object horizons.
  16173.  
  16174. The specular value is typically from 0.0 to 1.0, where 1.0 causes
  16175. complete saturation to the light source's color at the brightest
  16176. area (center) of the highlight. The default specular 0.0 gives no
  16177. highlight.
  16178.  
  16179. The size of the spot is defined by the value given the roughness
  16180. keyword. Typical values range from 1.0 (very rough - large
  16181. highlight) to 0.0005 (very smooth - small highlight). The default
  16182. value, if roughness is not specified, is 0.05 (plastic).
  16183.  
  16184. It is possible to specify wrong values for roughness that will
  16185. generate an error when you try to render the file. Don't use 0
  16186. and if you get errors check to see if you are using a very, very
  16187. small roughness value that may be causing the error. For example:
  16188.  
  16189.   finish {specular 0.9  roughness 0.02}
  16190. If specular is not specified roughness has no effect.
  16191.  
  16192. Note that when light reflects perfectly of a smooth surface such
  16193. as a mirror, it is called specular reflection however such
  16194. reflection is not controlled by the specular keyword. The
  16195. reflection keyword controls mirror-like specular reflection.
  16196.  
  16197.  
  16198. 4.7.3.3.3 Metallic Highlight Modifier
  16199. The keyword metallic may be used with Phong or specular
  16200. highlights. This keyword indicates that the color of the
  16201. highlights will be calculated by an empirical function that
  16202. models the reflectivity of metallic surfaces.
  16203.  
  16204. Normally highlights are the color of the light source.  Adding
  16205. this keyword filters the highlight so that white light reflected
  16206. from a metallic surface takes the color of the surface.
  16207.  
  16208. The metallic keyword may optionally be follow by a numeric value
  16209. to specify the influence the amount of the effect.  If no keyword
  16210. is specified, the default value is zero.  If the keyword is
  16211. specified without a value, the default value is one. For example:
  16212.  
  16213.   finish {
  16214.     phong 0.9
  16215.     phong_size 60
  16216.     metallic
  16217.   }
  16218. If phong or specular keywords are not specified then metallic has
  16219. no effect.
  16220.  
  16221.  
  16222. 4.7.3.4   Specular Reflection
  16223. When light does not diffuse and it does reflect at the same angle
  16224. as it hits an object, it is called specular reflection. Such
  16225. mirror-like reflection is controlled by the reflection keyword in
  16226. a finish statement. For example:
  16227.  
  16228.   finish { reflection 1.0 ambient 0 diffuse 0 }
  16229. This gives the object a mirrored finish. It will reflect all
  16230. other elements in the scene. Usually a single float value is
  16231. specified after the keyword even though the syntax calls for a
  16232. color. For example a float value of 0.3 gets promoted to the full
  16233. color vector < 0.3,0.3,0.3,0.3,0.3> which is acceptable because
  16234. only the red, green and blue parts are used.
  16235.  
  16236. The value can range from 0.0 to 1.0. By default there is no
  16237. reflection.
  16238.  
  16239. Adding reflection to a texture makes it take longer to render
  16240. because an additional ray must be traced. The reflected light may
  16241. be tinted by specifying a color rather than a float. For example
  16242.  
  16243.    finish { reflection rgb <1,0,0> }
  16244. gives a red mirror that only reflects red light.
  16245.  
  16246. POV-Ray uses a limited light model that cannot distinguish
  16247. between objects which are simply brightly colored and objects
  16248. which are extremely bright.  A white piece of paper, a light
  16249. bulb, the sun, and a supernova, all would be modeled as
  16250. rgb<1,1,1> and slightly off-white objects would be only slightly
  16251. darker.  It is especially difficult to model partially reflective
  16252. surfaces in a realistic way.  Middle and lower brightness objects
  16253. typically look too bright when reflected.  If you reduce the
  16254. reflection value, it tends to darken the bright objects too much.
  16255. Therefore the reflection_exponent keyword has been added.  It
  16256. produces non-linear reflection intensities.  The default value of
  16257. 1.0 produces a linear curve.  Lower values darken middle and low
  16258. intensities and keeps high intensity reflections bright.  This is
  16259. a somewhat experimental feature designed for artistic use.  It
  16260. does not directly correspond to any real world reflective
  16261. properties.  We are researching ways to deal with this issue in a
  16262. more scientific model.  The reflection_exponent has no effect
  16263. unless reflection is used.
  16264.  
  16265. Note that although such reflection is called specular it is not
  16266. controlled by the specular keyword. That keyword controls a
  16267. specular highlight.
  16268.  
  16269.  
  16270. 4.7.3.5   Iridescence
  16271. Iridescence, or Newton's thin film interference, simulates the
  16272. effect of light on surfaces with a microscopic transparent film
  16273. overlay. The effect is like an oil slick on a puddle of water or
  16274. the rainbow hues of a soap bubble.  This effect is controlled by
  16275. the irid statement specified inside a finish statement.
  16276.  
  16277. This parameter modifies the surface color as a function of the
  16278. angle between the light source and the surface. Since the effect
  16279. works in conjunction with the position and angle of the light
  16280. sources to the surface it does not behave in the same ways as a
  16281. procedural pigment pattern.
  16282.  
  16283. The syntax is:
  16284.  
  16285. IRID:
  16286.   irid { Irid_Amount [IRID_ITEMS...] }
  16287. IRID_ITEMS:
  16288.   thickness Amount   |   turbulence Amount
  16289. The required Irid_Amount parameter is the contribution of the
  16290. iridescence effect to the overall surface color. As a rule of
  16291. thumb keep to around 0.25 (25% contribution) or less, but
  16292. experiment. If the surface is coming out too white, try lowering
  16293. the diffuse and possibly the ambient values of the surface.
  16294.  
  16295. The thickness keyword represents the film's thickness. This is an
  16296. awkward parameter to set, since the thickness value has no
  16297. relationship to the object's scale.  Changing it affects the
  16298. scale or busy-ness of the effect. A very thin film will have a
  16299. high frequency of color changes while a thick film will have
  16300. large areas of color.  The default value is zero.
  16301.  
  16302. The thickness of the film can be varied with the turbulence
  16303. keyword. You can only specify the amount of turbulence with
  16304. iridescence.  The octaves, lambda, and omega values are
  16305. internally set and are not adjustable by the user at this time.
  16306. This parameter varies only a single value: the thickness.
  16307. Therefore the value must be a single float value.  It cannot be a
  16308. vector as in other uses of the turbulence keyword.
  16309.  
  16310. In addition, perturbing the object's surface normal through the
  16311. use of bump patterns will affect iridescence.
  16312.  
  16313. For the curious, thin film interference occurs because, when the
  16314. ray hits the surface of the film, part of the light is reflected
  16315. from that surface, while a portion is transmitted into the film.
  16316. This subsurface ray travels through the film and eventually
  16317. reflects off the opaque substrate. The light emerges from the
  16318. film slightly out of phase with the ray that was reflected from
  16319. the surface.
  16320.  
  16321. This phase shift creates interference, which varies with the
  16322. wavelength of the component colors, resulting in some wavelengths
  16323. being reinforced, while others are cancelled out. When these
  16324. components are recombined, the result is iridescence.  See also
  16325. the global setting "Irid_Wavelength".
  16326.  
  16327. The concept used for this feature came from the book Fundamentals
  16328. of Three-Dimensional Computer Graphics by Alan Watt (Addison-
  16329. Wesley).
  16330.  
  16331.  
  16332. 4.7.4     Halo
  16333. Earlier versions of POV-Ray used a feature called halo to
  16334. simulate fine particles such as smoke, steam, fog, or flames.
  16335. The halo statement was part of the texture statement.  This
  16336. feature has been discontinued and replaced by the interior and
  16337. media statements which are object modifiers outside the texture
  16338. statement.
  16339.  
  16340. See "Why are Interior and Media Necessary?" for a detailed
  16341. explanation on the reasons for the change.  See "Media" for
  16342. details on media.
  16343.  
  16344.  
  16345. 4.7.5     Patterned Textures
  16346. Patterned textures are complex textures made up of multiple
  16347. textures.  The component textures may be plain textures or may be
  16348. made up of patterned textures. A plain texture has just one
  16349. pigment, normal and finish statement. Even a pigment with a
  16350. pigment map is still one pigment and thus considered a plain
  16351. texture as are normals with normal map statements.
  16352.  
  16353. Patterned textures use either a texture_map statement to specify
  16354. a blend or pattern of textures or they use block textures such as
  16355. checker with a texture list or a bitmap similar to an image map
  16356. called a material map specified with a material_map statement.
  16357.  
  16358. The syntax is...
  16359.  
  16360. PATTERNED_TEXTURE:
  16361.   texture { [PATTERNED_TEXTURE_ID] [TRANSFORMATIONS...] }   |
  16362.   texture { PATTERN_TYPE [TEXTURE_PATTERN_MODIFIERS...] }   |
  16363.   texture { tiles TEXTURE  tile2 TEXTURE [TRANSFORMATIONS...] }
  16364.   |
  16365.   texture {
  16366.      material_map{
  16367.        BITMAP_TYPE "bitmap.ext" [BITMAP_MODS...] TEXTURE...
  16368.      [TRANSFORMATIONS...]
  16369.      }
  16370.   }
  16371. TEXTURE_PATTERN_MODIFIER:
  16372.   PATTERN_MODIFIER   |   TEXTURE_LIST   |
  16373.   texture_map{ TEXTURE_MAP_BODY }
  16374. There are restrictions on using patterned textures. A patterned
  16375. texture may not be used as a default texture (see section "The
  16376. #default Directive"). A patterned texture cannot be used as a
  16377. layer in a layered texture however you may use layered textures
  16378. as any of the textures contained within a patterned texture.
  16379.  
  16380.  
  16381. 4.7.5.1   Texture Maps
  16382. In addition to specifying blended color with a color map or a
  16383. pigment map you may create a blend of textures using texture_map.
  16384. The syntax for a texture map is identical to the pigment map
  16385. except you specify a texture in each map entry.
  16386.  
  16387. The syntax for texture_map is as follows:
  16388.  
  16389. TEXTURE_MAP:
  16390.   texture_map{ TEXTURE_MAP_BODY }
  16391. TEXTURE_MAP_BODY:
  16392.   TEXTURE_MAP_IDENTIFIER   |   TEXTURE_MAP_ENTRY...
  16393. TEXTURE_MAP_ENTRY:
  16394.   [ Value  TEXTURE_BODY ]
  16395. Where Value is a float value between 0.0 and 1.0 inclusive and
  16396. each TEXTURE_BODY is anything which can be inside a texture{...}
  16397. statement.  The texture keyword and {} braces need not be
  16398. specified.
  16399.  
  16400. Note that the [] brackets are part of the actual
  16401. TEXTURE_MAP_ENTRY. They are not notational symbols denoting
  16402. optional parts. The brackets surround each entry in the texture
  16403. map. There may be from 2 to 256 entries in the map.
  16404.  
  16405. For example:
  16406.  
  16407.   texture {
  16408.     gradient x       //this is the PATTERN_TYPE
  16409.     texture_map {
  16410.       [0.3  pigment{Red} finish{phong 1}]
  16411.       [0.3  T_Wood11]    //this is a texture identifier
  16412.       [0.6  T_Wood11]
  16413.       [0.9  pigment{DMFWood4} finish{Shiny}]
  16414.     }
  16415.   }
  16416. When the gradient x function returns values from 0.0 to 0.3 the
  16417. red highlighted texture is used. From 0.3 to 0.6 the texture
  16418. identifier T_Wood11 is used. From 0.6 up to 0.9 a blend of
  16419. T_Wood11 and a shiny DMFWood4 is used. From 0.9 on up only the
  16420. shiny wood is used.
  16421.  
  16422. Texture maps may be nested to any level of complexity you desire.
  16423. The textures in a map may have color maps or texture maps or any
  16424. type of texture you want.
  16425.  
  16426. The blended area of a texture map works by fully calculating both
  16427. contributing textures in their entirety and then linearly
  16428. interpolating the apparent colors. This means that reflection,
  16429. refraction and lighting calculations are done twice for every
  16430. point.  This is in contrast to using a pigment map and a normal
  16431. map in a plain texture, where the pigment is computed, then the
  16432. normal, then reflection, refraction and lighting are calculated
  16433. once for that point.
  16434.  
  16435. Entire textures may also be used with the block patterns such as
  16436. checker, hexagon and brick. For example...
  16437.  
  16438.   texture {
  16439.     checker
  16440.       texture { T_Wood12 scale .8 }
  16441.       texture {
  16442.         pigment { White_Marble }
  16443.         finish { Shiny }
  16444.         scale .5
  16445.       }
  16446.     }
  16447.   }
  16448. Note that in the case of block patterns the texture wrapping is
  16449. required around the texture information. Also note that this
  16450. syntax prohibits the use of a layered texture however you can
  16451. work around this by declaring a texture identifier for the
  16452. layered texture and referencing the identifier.
  16453.  
  16454. A texture map is also used with the average texture type. See
  16455. "Average" for details.
  16456.  
  16457. You may declare and use texture map identifiers but the only way
  16458. to declare a texture block pattern list is to declare a texture
  16459. identifier for the entire texture.
  16460.  
  16461.  
  16462. 4.7.5.2   Tiles
  16463. Earlier versions of POV-Ray had a patterned texture called a
  16464. tiles texture.  It used the tiles and tile2 keywords to create a
  16465. checkered pattern of textures.
  16466.  
  16467. TILES_TEXTURE:
  16468.   texture { tiles TEXTURE  tile2 TEXTURE [TRANSFORMATIONS...] }
  16469. Although it is still supported for backwards compatibility you
  16470. should use a checker block texture pattern described in section
  16471. "Texture Maps" rather than tiles textures.
  16472.  
  16473.  
  16474. 4.7.5.3   Material Maps
  16475. The material_map patterned texture extends the concept of image
  16476. maps to apply to entire textures rather than solid colors. A
  16477. material map allows you to wrap a 2-D bit-mapped texture pattern
  16478. around your 3-D objects.
  16479.  
  16480. Instead of placing a solid color of the image on the shape like
  16481. an image map, an entire texture is specified based on the index
  16482. or color of the image at that point. You must specify a list of
  16483. textures to be used like a texture palette rather than the usual
  16484. color palette.
  16485.  
  16486. When used with mapped file types such as GIF, and some PNG and
  16487. TGA images, the index of the pixel is used as an index into the
  16488. list of textures you supply. For unmapped file types such as some
  16489. PNG and TGA images the 8 bit value of the red component in the
  16490. range 0-255 is used as an index.
  16491.  
  16492. If the index of a pixel is greater than the number of textures in
  16493. your list then the index is taken modulo N where N is the length
  16494. of your list of textures.
  16495.  
  16496. Note: The material_map statement has nothing to do with the
  16497. material statement.  A material_map is not a way to create
  16498. patterned material.  See "Material" for explanation of this
  16499. unrelated, yet similarly named, older feature.
  16500.  
  16501.  
  16502. 4.7.5.3.1 Specifying a Material Map
  16503. The syntax for an material_map is:
  16504.  
  16505. MATERIAL_MAP:
  16506.   texture {
  16507.      material_map{
  16508.        BITMAP_TYPE "bitmap.ext" [BITMAP_MODS...] TEXTURE...
  16509.      [TRANSFORMATIONS...]
  16510.      }
  16511.   }
  16512. BITMAP_TYPE:
  16513.   gif   |   tga   |   iff   |   ppm   |   pgm   |   png   |
  16514.   sys
  16515. BITMAP_MOD:
  16516.   map_type  Type   |   once   |   interpolate  Type
  16517. After the required BITMAP_TYPE keyword is a string expression
  16518. containing the name of a bitmapped material file of the specified
  16519. type.  Several optional modifiers may follow the file
  16520. specification. The modifiers are described below. Note that
  16521. earlier versions of POV-Ray allowed some modifiers before the
  16522. BITMAP_TYPE but that syntax is being phased out in favor of the
  16523. syntax described here.  Note sys format is a system-specific
  16524. format such as BMP for Windows or Pict for Macintosh.
  16525.  
  16526. Filenames specified in the material_map statements will be
  16527. searched for in the home (current) directory first and, if not
  16528. found, will then be searched for in directories specified by any
  16529. +L or Library_Path options active. This would facilitate keeping
  16530. all your material maps files in a separate subdirectory and
  16531. giving a Library_Path option to specify where your library of
  16532. material maps are.  See "Library Paths" for details.
  16533.  
  16534. By default, the material is mapped onto the x-y-plane. The
  16535. material is projected onto the object as though there were a
  16536. slide projector somewhere in the -z-direction. The material
  16537. exactly fills the square area from (x,y) coordinates (0,0) to
  16538. (1,1) regardless of the material's original size in pixels. If
  16539. you would like to change this default you may translate, rotate
  16540. or scale the texture or texture to map it onto the object's
  16541. surface as desired.
  16542.  
  16543. The file name is optionally followed by one or more
  16544. BITMAP_MODIFIERS.  There are no modifiers which are unique to a
  16545. material_map.  It only uses the generic bitmap modifiers
  16546. map_type, once and interpolate described in "Bitmap Modifiers".
  16547.  
  16548. Although interpolate is legal in material maps, the color index
  16549. is interpolated before the texture is chosen. It does not
  16550. interpolate the final color as you might hope it would. In
  16551. general, interpolation of material maps serves no useful purpose
  16552. but this may be fixed in future versions.
  16553.  
  16554. Next is one or more texture statements.  Each texture in the list
  16555. corresponds to an index in the bitmap file.  For example:
  16556.  
  16557.    texture {
  16558.       material_map {
  16559.          png "povmap.png"
  16560.          texture {  //used with index 0
  16561.             pigment {color red 0.3 green 0.1 blue 1}
  16562.             normal  {ripples 0.85 frequency 10 }
  16563.             finish  {specular 0.75}
  16564.             scale 5
  16565.          }
  16566.          texture {  //used with index 1
  16567.             pigment {White}
  16568.             finish {ambient 0 diffuse 0 reflection 0.9 specular
  16569. 0.75}
  16570.          }
  16571.          // used with index 2
  16572.          texture {pigment{NeonPink} finish{Luminous}}
  16573.          texture {  //used with index 3
  16574.             pigment {
  16575.                gradient y
  16576.                color_map {
  16577.                   [0.00 rgb < 1 , 0 , 0>]
  16578.                   [0.33 rgb < 0 , 0 , 1>]
  16579.                   [0.66 rgb < 0 , 1 , 0>]
  16580.                   [1.00 rgb < 1 , 0 , 0>]
  16581.                }
  16582.             }
  16583.             finish{specular 0.75}
  16584.             scale 8
  16585.          }
  16586.       }
  16587.       scale 30
  16588.       translate <-15, -15, 0>
  16589.    }
  16590. After a material_map statement but still inside the texture
  16591. statement you may apply any legal texture modifiers. Note that no
  16592. other pigment, normal, or finish statements may be added to the
  16593. texture outside the material map. The following is illegal:
  16594.  
  16595.   texture {
  16596.     material_map {
  16597.       gif "matmap.gif"
  16598.       texture {T1}
  16599.       texture {T2}
  16600.       texture {T3}
  16601.     }
  16602.     finish {phong 1.0}
  16603.   }
  16604. The finish must be individually added to each texture.  Note that
  16605. earlier versions of POV-Ray allowed such specifications but they
  16606. were ignored. The above restrictions on syntax were necessary for
  16607. various bug fixes. This means some POV-Ray 1.0 scenes using
  16608. material maps many need minor modifications that cannot be done
  16609. automatically with the version compatibility mode.
  16610.  
  16611. If particular index values are not used in an image then it may
  16612. be necessary to supply dummy textures. It may be necessary to use
  16613. a paint program or other utility to examine the map file's
  16614. palette to determine how to arrange the texture list.
  16615.  
  16616. The textures within a material map texture may be layered but
  16617. material map textures do not work as part of a layered texture.
  16618. To use a layered texture inside a material map you must declare
  16619. it as a texture identifier and invoke it in the texture list.
  16620.  
  16621.  
  16622. 4.7.6     Layered Textures
  16623. It is possible to create a variety of special effects using
  16624. layered textures. A layered texture consists of several textures
  16625. that are partially transparent and are laid one on top of the
  16626. other to create a more complex texture. The different texture
  16627. layers show through the transparent portions to create the
  16628. appearance of one texture that is a combination of several
  16629. textures.
  16630.  
  16631. You create layered textures by listing two or more textures one
  16632. right after the other. The last texture listed will be the top
  16633. layer, the first one listed will be the bottom layer. All
  16634. textures in a layered texture other than the bottom layer should
  16635. have some transparency.  For example:
  16636.  
  16637.   object {
  16638.     My_Object
  16639.     texture {T1}  // the bottom layer
  16640.     texture {T2}  // a semi-transparent layer
  16641.     texture {T3}  // the top semi-transparent layer
  16642.   }
  16643. In this example T2 shows only where T3 is transparent and T1
  16644. shows only where T2 and T3 are transparent.
  16645.  
  16646. The color of underlying layers is filtered by upper layers but
  16647. the results do not look exactly like a series of transparent
  16648. surfaces. If you had a stack of surfaces with the textures
  16649. applied to each, the light would be filtered twice: once on the
  16650. way in as the lower layers are illuminated by filtered light and
  16651. once on the way out. Layered textures do not filter the
  16652. illumination on the way in. Other parts of the lighting
  16653. calculations work differently as well. The results look great and
  16654. allow for fantastic looking textures but they are simply
  16655. different from multiple surfaces. See stones.inc in the standard
  16656. include files directory for some magnificent layered textures.
  16657.  
  16658. Note layered textures must use the texture wrapped around any
  16659. pigment, normal or finish statements. Do not use multiple
  16660. pigment, normal or finish statements without putting them inside
  16661. the texture statement.
  16662.  
  16663. Layered textures may be declared. For example
  16664.  
  16665.   #declare Layered_Examp =
  16666.     texture {T1}
  16667.     texture {T2}
  16668.     texture {T3}
  16669. may be invoked as follows:
  16670.  
  16671.   object {
  16672.     My_Object
  16673.     texture {
  16674.       Layer_Examp
  16675.       // Any pigment, normal or finish here
  16676.       // modifies the bottom layer only.
  16677.     }
  16678.   }
  16679. If you wish to use a layered texture in a block pattern, such as
  16680. checker, hexagon, or brick, or in a material_map, you must
  16681. declare it first and then reference it inside a single texture
  16682. statement. A patterned texture cannot be used as a layer in a
  16683. layered texture however you may use layered textures as any of
  16684. the textures contained within a patterned texture.
  16685.  
  16686.  
  16687. 4.7.7     Patterns
  16688. POV-Ray uses a method called three-dimensional solid texturing to
  16689. define the color, bumpiness and other properties of an object.
  16690. You specify the way that the texture varies over a surface by
  16691. specifying a pattern.  Patterns are used in pigments, normals and
  16692. texture maps as well as media density.
  16693.  
  16694. All patterns in POV-Ray are three dimensional. For every point in
  16695. space, each pattern has a unique value. Patterns do not wrap
  16696. around a surface like putting wallpaper on an object. The
  16697. patterns exist in 3d and the objects are carved from them like
  16698. carving an object from a solid block of wood or stone.
  16699.  
  16700. Consider a block of wood. It contains light and dark bands that
  16701. are concentric cylinders being the growth rings of the wood. On
  16702. the end of the block you see these concentric circles. Along its
  16703. length you see lines that are the veins. However the pattern
  16704. exists throughout the entire block. If you cut or carve the wood
  16705. it reveals the pattern inside. Similarly an onion consists of
  16706. concentric spheres that are visible only when you slice it.
  16707. Marble stone consists of wavy layers of colored sediments that
  16708. harden into rock.
  16709.  
  16710. These solid patterns can be simulated using mathematical
  16711. functions. Other random patterns such as granite or bumps and
  16712. dents can be generated using a random number system and a noise
  16713. function.
  16714.  
  16715. In each case, the x, y, z coordinate of a point on a surface is
  16716. used to compute some mathematical function that returns a float
  16717. value. When used with color maps or pigment maps, that value
  16718. looks up the color of the pigment to be used. In normal
  16719. statements the pattern function result modifies or perturbs the
  16720. surface normal vector to give a bumpy appearance. Used with a
  16721. texture map, the function result determines which combinations of
  16722. entire textures to be used.  When used with media density it
  16723. specifies the density of the particles or gasses.
  16724.  
  16725. The following sections describe each pattern. See the sections
  16726. "Pigment", "Normal", "Patterned Textures" and "Density" for more
  16727. details on how to use patterns. Unless mentioned otherwise, all
  16728. patterns use the ramp_wave wave type by default but may use any
  16729. wave type and may be used with color_map, pigment_map,
  16730. normal_map, slope_map, texture_map, density, and density_map.
  16731.  
  16732.  
  16733. 4.7.7.1   Agate
  16734. The agate pattern is a banded pattern similar to marble but it
  16735. uses a specialized built-in turbulence function that is different
  16736. from the traditional turbulence. The traditional turbulence can
  16737. be used as well but it is generally not necessary because agate
  16738. is already very turbulent. You may control the amount of the
  16739. built-in turbulence by adding the optional agate_turb keyword
  16740. followed by a float value. For example:
  16741.  
  16742.   pigment {
  16743.     agate
  16744.     agate_turb 0.5
  16745.     color_map {MyMap}
  16746.   }
  16747.  
  16748. 4.7.7.2   Average
  16749. Technically average is not a pattern type but it is listed here
  16750. because the syntax is similar to other patterns. Typically a
  16751. pattern type specifies how colors or normals are chosen from a
  16752. pigment_map╕ texture_map, density_map, or normal_map, however
  16753. average tells POV-Ray to average together all of the patterns you
  16754. specify.  Average was originally designed to be used in a normal
  16755. statement with a normal_map as a method of specifying more than
  16756. one normal pattern on the same surface. However average may be
  16757. used in a pigment statement with a pigment_map or in a texture
  16758. statement with a texture_map or media density with density_map to
  16759. average colors too.
  16760.  
  16761. When used with pigments, the syntax is:
  16762.  
  16763. AVERAGED_PIGMENT:
  16764.   pigment {
  16765.     pigment_map{ PIGMENT_MAP_ENTRY... }
  16766.   }
  16767. PIGMENT_MAP_ENTRY:
  16768.   [ [Weight]  PIGMENT_BODY ]
  16769. Where Weight is an optional float value that defaults to 1.0 if
  16770. not specified.  This weight value is the relative weight applied
  16771. to that pigment.  Each PIGMENT_BODY is anything which can be
  16772. inside a pigment{...} statement.  The pigment keyword and {}
  16773. braces need not be specified.
  16774.  
  16775. Note that the [] brackets are part of the actual
  16776. PIGMENT_MAP_ENTRY. They are not notational symbols denoting
  16777. optional parts. The brackets surround each entry in the
  16778. pigment_map. There may be from 2 to 256 entries in the map.
  16779.  
  16780. For example
  16781.  
  16782.     pigment {
  16783.       average
  16784.       pigment_map {
  16785.         [1.0  Pigment_1]
  16786.         [2.0  Pigment_2]
  16787.         [0.5  Pigment_3]
  16788.       }
  16789.     }
  16790. All three pigments are evaluated.  The weight values are
  16791. multiplied by the resulting color.  It is then divided by the
  16792. total of the weights which, in this example is 3.5.  When used
  16793. with texture_map or density_map it works the same way.
  16794.  
  16795. When used with a normal_map in a normal statement, multiple
  16796. copies of the original surface normal are created and are
  16797. perturbed by each pattern. The perturbed normals are then
  16798. weighted, added and normalized.
  16799.  
  16800. See the sections "Pigment Maps and Pigment Lists", "Normal Maps
  16801. and Normal Lists", "Texture Maps", and "Density Maps and Density
  16802. Lists" for more information.
  16803.  
  16804.  
  16805. 4.7.7.3   Boxed
  16806. The boxed pattern creates a 2x2x2 unit cube centered at the
  16807. origin.  It is computed by:
  16808.  
  16809.   value =1.0- min(1, max(abs(X), abs(Y), abs(Z)))
  16810.  
  16811. It starts at 1.0 at the origin and increases to a minimum value
  16812. of 0.0 as it approaches any plane which is one unit from the
  16813. origin.  It remains at 0.0 for all areas beyond that distance.
  16814. This pattern was originally created for use with halo or media
  16815. but it may be used anywhere any pattern may be used.
  16816.  
  16817.  
  16818. 4.7.7.4   Bozo
  16819. The bozo pattern is a very smooth, random noise function that is
  16820. traditionally used with some turbulence to create clouds. The
  16821. spotted pattern is identical to bozo but in early versions of POV-
  16822. Ray spotted did not allow turbulence to be added. Turbulence can
  16823. now be added to any pattern so these are redundant but both are
  16824. retained for backwards compatibility. The bumps pattern is also
  16825. identical to bozo when used anywhere except in a normal
  16826. statement. When used as a normal pattern, bumps uses a slightly
  16827. different method to perturb the normal with a similar noise
  16828. function.
  16829.  
  16830. The bozo noise function has the following properties:
  16831.  
  16832.   1.  It's defined over 3D space i.e., it takes x, y, and z and
  16833.   returns the noise value there.
  16834.   2.  If two points are far apart, the noise values at those
  16835.   points are relatively random.
  16836.   3.  If two points are close together, the noise values at those
  16837.   points are close to each other.
  16838. You can visualize this as having a large room and a thermometer
  16839. that ranges from 0.0 to 1.0. Each point in the room has a
  16840. temperature. Points that are far apart have relatively random
  16841. temperatures. Points that are close together have close
  16842. temperatures. The temperature changes smoothly but randomly as we
  16843. move through the room.
  16844.  
  16845. Now let's place an object into this room along with an artist.
  16846. The artist measures the temperature at each point on the object
  16847. and paints that point a different color depending on the
  16848. temperature.  What do we get? A POV-Ray bozo texture!
  16849.  
  16850.  
  16851. 4.7.7.5   Brick
  16852. The brick pattern generates a pattern of bricks. The bricks are
  16853. offset by half a brick length on every other row in the x- and z-
  16854. directions. A layer of mortar surrounds each brick. The syntax is
  16855. given by
  16856.  
  16857.     pigment {
  16858.       brick COLOR_1, COLOR_2
  16859.       [brick_size <Size>]
  16860.       [mortar Size]
  16861.     }
  16862. where COLOR_1 is the color of the mortar and COLOR_2 is the color
  16863. of the brick itself. If no colors are specified a default deep
  16864. red and dark gray are used. The default size of the brick and
  16865. mortar together is <8, 3, 4.5> units. The default thickness of
  16866. the mortar is 0.5 units. These values may be changed using the
  16867. optional brick_size and mortar pattern modifiers. You may also
  16868. use pigment statements in place of the colors. For example:
  16869.  
  16870.   pigment {
  16871.     brick pigment{Jade}, pigment{Black_Marble}
  16872.   }
  16873. This example uses normals:
  16874.  
  16875.   normal { brick 0.5 }
  16876. The float value is an optional bump size. You may also use full
  16877. normal statements. For example:
  16878.  
  16879.   normal {
  16880.     brick normal{bumps 0.2}, normal{granite 0.3}
  16881.   }
  16882. When used with textures, the syntax is
  16883.  
  16884.   texture {
  16885.     brick texture{T_Gold_1A}, texture{Stone12}
  16886.   }
  16887. This is a block pattern which cannot use wave types, color_map,
  16888. or slope_map modifiers.
  16889.  
  16890.  
  16891. 4.7.7.6   Bumps
  16892. The bumps pattern was originally designed only to be used as a
  16893. normal pattern. It uses a very smooth, random noise function that
  16894. creates the look of rolling hills when scaled large or a bumpy
  16895. orange peal when scaled small. Usually the bumps are about 1 unit
  16896. apart.
  16897.  
  16898. When used as a normal pattern, this pattern uses a specialized
  16899. normal perturbation function. This means that the pattern cannot
  16900. be used with normal_map, slope_map or wave type modifiers in a
  16901. normal statement.
  16902.  
  16903. When used as a pigment pattern or texture pattern, the bumps
  16904. pattern is identical to bozo or spotted and is similar to normal
  16905. bumps but is not identical as are most normals when compared to
  16906. pigments.
  16907.  
  16908.  
  16909. 4.7.7.7   Checker
  16910. The checker pattern produces a checkered pattern consisting of
  16911. alternating squares of two colors.  The syntax is:
  16912.  
  16913.   pigment { checker [COLOR_1 [, COLOR_2]] [PATTERN_MODIFIERS...]
  16914.   }
  16915. If no colors are specified then default blue and green colors are
  16916. used.
  16917.  
  16918. The checker pattern is actually a series of cubes that are one
  16919. unit in size. Imagine a bunch of 1 inch cubes made from two
  16920. different colors of modeling clay. Now imagine arranging the
  16921. cubes in an alternating check pattern and stacking them in layer
  16922. after layer so that the colors still alternate in every
  16923. direction. Eventually you would have a larger cube. The pattern
  16924. of checks on each side is what the POV-Ray checker pattern
  16925. produces when applied to a box object.  Finally imagine cutting
  16926. away at the cube until it is carved into a smooth sphere or any
  16927. other shape. This is what the checker pattern would look like on
  16928. an object of any kind.
  16929.  
  16930. You may also use pigment statements in place of the colors. For
  16931. example:
  16932.  
  16933.   pigment { checker pigment{Jade}, pigment{Black_Marble} }
  16934. This example uses normals:
  16935.  
  16936.   normal { checker 0.5 }
  16937. The float value is an optional bump size. You may also use full
  16938. normal statements. For example:
  16939.  
  16940.   normal {
  16941.     checker normal{gradient x scale .2},
  16942.             normal{gradient y scale .2}
  16943.   }
  16944. When used with textures, the syntax is
  16945.  
  16946.   texture { checker texture{T_Wood_3A},texture{Stone12} }
  16947. This use of checker as a texture pattern replaces the special
  16948. tiles texture in previous versions of POV-Ray. You may still use
  16949. tiles but it may be phased out in future versions so checker
  16950. textures are best.
  16951.  
  16952. This is a block pattern which cannot use wave types, color_map,
  16953. or slope_map modifiers.
  16954.  
  16955.  
  16956. 4.7.7.8   Crackle
  16957. The crackle pattern is a set of random tiled polygons. With a
  16958. large scale and no turbulence it makes a pretty good stone wall
  16959. or floor. With a small scale and no turbulence it makes a pretty
  16960. good crackle ceramic glaze. Using high turbulence it makes a good
  16961. marble that avoids the problem of apparent parallel layers in
  16962. traditional marble.
  16963.  
  16964. Mathematically, the set crackle(p)=0 is a 3D Voronoi diagram of a
  16965. field of semi random points and crackle(p) < 0 is the distance
  16966. from the set along the shortest path (a Voronoi diagram is the
  16967. locus of points equidistant from their two nearest neighbors from
  16968. a set of disjoint points, like the membranes in suds are to the
  16969. centers of the bubbles).
  16970.  
  16971.  
  16972. 4.7.7.9   Cylindrical
  16973. The cylindrical pattern creates a one unit radius cylinder along
  16974. the Y axis.  It is computed by:
  16975.  
  16976.   value = 1.0-min(1, sqrt(X^2 + Z^2))
  16977.  
  16978. It starts at 1.0 at the origin and increases to a minimum value
  16979. of 0.0 as it approaches a distance of 1 unit from the Y axis.  It
  16980. remains at 0.0 for all areas beyond that distance.  This pattern
  16981. was originally created for use with halo or media but it may be
  16982. used anywhere any pattern may be used.
  16983.  
  16984.  
  16985. 4.7.7.10  Density_File
  16986. The density_file pattern is a 3-D bitmap pattern that occupies a
  16987. unit cube from location <0,0,0> to <1,1,1>.  The data file is a
  16988. raw binary file format created for POV-Ray called df3 format.
  16989. The syntax provides for the possibility of implementing other
  16990. formats in the future.  This pattern was originally created for
  16991. use with halo or media but it may be used anywhere any pattern
  16992. may be used.  The syntax is:
  16993.  
  16994.   pigment {density_file df3 "filename.df3" [interpolate Type]
  16995.   [PIGMENT_MODIFIERS...] }
  16996. where "filename.df3" is a file name of the data file.
  16997.  
  16998. As a normal pattern, the syntax is
  16999.  
  17000.   normal {density_file df3 "filename.df3"  [, Bump_Size]
  17001.      [interpolate Type] [NORMAL_MODIFIERS...]
  17002.   }
  17003. The optional float Bump_Size should follow the file name and any
  17004. other modifiers follow that.
  17005.  
  17006. The df3 format consists of a 6 byte header of three 16-bit
  17007. integers with high order byte first.  These three values give the
  17008. x,y,z size of the data in pixels (or more appropriately called
  17009. voxels).  This is followed by x*y*z unsigned integer bytes of
  17010. data.  The data in the range of 0 to 255 is scaled into a float
  17011. value in the range 0.0 to 1.0.  It remains at 0.0 for all areas
  17012. beyond the unit cube.  The pattern occupies the unit cube
  17013. regardless of the dimensions in voxels.
  17014.  
  17015. The interpolate keyword may be specified to add interpolation of
  17016. the data.  The default value of zero specifies no interpolation.
  17017. A value of one specifies tri-linear interpolation.
  17018.  
  17019. See the sample scenes for data file include\spiral.df3,and the
  17020. scenes which use it: scenes\textures\surfaces\densfile.pov,
  17021. scenes\interior\media\galaxy.pov for examples.
  17022.  
  17023.  
  17024. 4.7.7.11  Dents
  17025. The dents pattern was originally designed only to be used as a
  17026. normal pattern. It is especially interesting when used with
  17027. metallic textures. It gives impressions into the metal surface
  17028. that look like dents have been beaten into the surface with a
  17029. hammer. Usually the dents are about 1 unit apart.
  17030.  
  17031. When used as a normal pattern, this pattern uses a specialized
  17032. normal perturbation function. This means that the pattern cannot
  17033. be used with normal_map, slope_map or wave type modifiers in a
  17034. normal statement.
  17035.  
  17036. When used as a pigment pattern or texture pattern, the dents
  17037. pattern is similar to normal dents but is not identical as are
  17038. most normals when compared to pigments.
  17039.  
  17040.  
  17041. 4.7.7.12  Gradient
  17042. One of the simplest patterns is the gradient pattern. It is
  17043. specified as
  17044.  
  17045.   pigment {gradient <Orientation> [PIGMENT_MODIFIERS...] }
  17046. where <Orientation> is a vector pointing in the direction that
  17047. the colors blend. For example
  17048.  
  17049.    pigment { gradient x } // bands of color vary as you move
  17050.                           // along the "x" direction.
  17051. produces a series of smooth bands of color that look like layers
  17052. of colors next to each other. Points at x=0 are the first color
  17053. in the color map. As the x location increases it smoothly turns
  17054. to the last color at x=1. Then it starts over with the first
  17055. again and gradually turns into the last color at x=2. The pattern
  17056. reverses for negative values of x. Using gradient y or gradient z
  17057. makes the colors blend along the y- or z-axis. Any vector may be
  17058. used but x, y and z are most common.
  17059.  
  17060. As a normal pattern, gradient generates a saw-tooth or ramped
  17061. wave appearance. The syntax is
  17062.  
  17063.   normal {gradient <Orientation> [, Bump_Size]
  17064.   [NORMAL_MODIFIERS...] }
  17065. where the vector <Orientation> is a required parameter but the
  17066. float Bump_Size which follows is optional.  Note that the comma
  17067. is required especially if Bump_Size is negative.
  17068.  
  17069.  
  17070. 4.7.7.13  Granite
  17071. The granite pattern uses a simple 1/f fractal noise function to
  17072. give a good granite pattern. This pattern is used with creative
  17073. color maps in stones.inc to create some gorgeous layered stone
  17074. textures.
  17075.  
  17076. As a normal pattern it creates an extremely bumpy surface that
  17077. looks like a gravel driveway or rough stone.
  17078.  
  17079.  
  17080. 4.7.7.14  Hexagon
  17081. The hexagon pattern is a block pattern that generates a repeating
  17082. pattern of hexagons in the x-y-plane. In this instance imagine
  17083. tall rods that are hexagonal in shape and are parallel to the y-
  17084. axis and grouped in bundles like shown in the example image.
  17085. Three separate colors should be specified as follows:
  17086.  
  17087.   pigment{hexagon [COLOR_1 [, COLOR_2 [, COLOR_3]]]
  17088.   [PATTERN_MODIFIERS...] }
  17089.                                 
  17090.                                 
  17091.                       The hexagon pattern.
  17092.                                 
  17093. The three colors will repeat the hexagonal pattern with hexagon
  17094. COLOR_1 centered at the origin, COLOR_2 in the +z-direction and
  17095. COLOR_3 to either side. Each side of the hexagon is one unit
  17096. long.  The hexagonal rods of color extend infinitely in the +y-
  17097. and -y-directions. If no colors are specified then default blue,
  17098. green and red colors are used.
  17099.  
  17100. You may also use pigment statements in place of the colors. For
  17101. example:
  17102.  
  17103.   pigment {
  17104.     hexagon pigment { Jade },
  17105.             pigment { White_Marble },
  17106.             pigment { Black_Marble }
  17107.   }
  17108. This example uses normals:
  17109.  
  17110.   normal { hexagon 0.5 }
  17111. The float value is an optional bump size. You may also use full
  17112. normal statements. For example:
  17113.  
  17114.   normal {
  17115.     hexagon
  17116.       normal { gradient x scale .2 },
  17117.       normal { gradient y scale .2 },
  17118.       normal { bumps scale .2 }
  17119.   }
  17120. When used with textures, the syntax is...
  17121.  
  17122.   texture {
  17123.     hexagon
  17124.       texture { T_Gold_3A },
  17125.       texture { T_Wood_3A },
  17126.       texture { Stone12 }
  17127.   }
  17128. This is a block pattern which cannot use wave types, color_map,
  17129. or slope_map modifiers.
  17130.  
  17131.  
  17132. 4.7.7.15  Leopard
  17133. Leopard creates regular geometric pattern of circular spots.  The
  17134. formula used is:
  17135.  
  17136.    value = Sqr((sin(x)+sin(y)+sin(z))/3)
  17137.  
  17138.  
  17139. 4.7.7.16  Mandel
  17140. The mandel pattern computes the standard Mandelbrot fractal
  17141. pattern and projects it onto the x-y-plane. It uses the x and y
  17142. coordinates to compute the Mandelbrot set.
  17143.  
  17144. It is specified as
  17145.  
  17146.   pigment {mandel Max_Iteration [PIGMENT_MODIFIERS...] }
  17147. The pattern is specified with the keyword mandel followed by an
  17148. integer number. This number is the maximum number of iterations
  17149. to be used to compute the set. Typical values range from 10 up to
  17150. 256 but any positive integer may be used. For example:
  17151.  
  17152.   pigment {
  17153.     mandel 25
  17154.     color_map {
  17155.       [0.0  color Cyan]
  17156.       [0.3  color Yellow]
  17157.       [0.6  color Magenta]
  17158.       [1.0  color Cyan]
  17159.     }
  17160.     scale .5
  17161.   }
  17162. The value passed to the color map is computed by the formula:
  17163.  
  17164.   value = number_of_iterations / max_iterations
  17165.  
  17166. When used as a normal pattern, the syntax is...
  17167.  
  17168.   normal{mandel Max_Iteration [, Bump_Size]
  17169.   [NORMAL_MODIFIERS...] }
  17170. where the integer Max_Iteration is a required parameter but the
  17171. float Bump_Size which follows is optional.  Note that the comma
  17172. is required especially if Bump_Size is negative.
  17173.  
  17174.  
  17175. 4.7.7.17  Marble
  17176. The marble pattern is very similar to the gradient x pattern. The
  17177. gradient pattern uses a default ramp_wave wave type which means
  17178. it uses colors from the color map from 0.0 up to 1.0 at location
  17179. x=1 but then jumps back to the first color for x > 1 and repeats
  17180. the pattern again and again. However the marble pattern uses the
  17181. triangle_wave wave type in which it uses the color map from 0 to
  17182. 1 but then it reverses the map and blends from 1 back to zero.
  17183. For example:
  17184.  
  17185.   pigment {
  17186.     gradient x
  17187.     color_map {
  17188.       [0.0  color Yellow]
  17189.       [1.0  color Cyan]
  17190.     }
  17191.   }
  17192. This blends from yellow to cyan and then it abruptly changes back
  17193. to yellow and repeats. However replacing gradient x with marble
  17194. smoothly blends from yellow to cyan as the x coordinate goes from
  17195. 0.0 to 0.5 and then smoothly blends back from cyan to yellow by
  17196. x=1.0.
  17197.  
  17198. Earlier versions of POV-Ray did not allow you to change wave
  17199. types.  Now that wave types can be changed for most any pattern,
  17200. the distinction between marble and gradient x is only a matter of
  17201. default wave types.
  17202.  
  17203. When used with turbulence and an appropriate color map, this
  17204. pattern looks like veins of color of real marble, jade or other
  17205. types of stone. By default, marble has no turbulence.
  17206.  
  17207.  
  17208. 4.7.7.18  Onion
  17209. The onion is a pattern of concentric spheres like the layers of
  17210. an onion.
  17211.  
  17212.   Value = mod(sqrt(Sqr(X)+Sqr(Y)+Sqr(Z)), 1.0)
  17213.  
  17214. Each layer is one unit thick.
  17215.  
  17216.  
  17217. 4.7.7.19  Planar
  17218. The planar pattern creates a horizontal stripe plus or minus one
  17219. unit above and below the X-Z plane.  It is computed by:
  17220.  
  17221.   value =1.0- min(1, abs(Y))
  17222.  
  17223. It starts at 1.0 at the origin and increases to a minimum value
  17224. of 0.0 as the Y values approaches a distance of 1 unit from the X-
  17225. Z plane.  It remains at 0.0 for all areas beyond that distance.
  17226. This pattern was originally created for use with halo or media
  17227. but it may be used anywhere any pattern may be used.
  17228.  
  17229.  
  17230. 4.7.7.20  Quilted
  17231. The quilted pattern was originally designed only to be used as a
  17232. normal pattern. The quilted pattern is so named because it can
  17233. create a pattern somewhat like a quilt or a tiled surface. The
  17234. squares are actually 3-D cubes that are 1 unit in size.
  17235.  
  17236. When used as a normal pattern, this pattern uses a specialized
  17237. normal perturbation function. This means that the pattern cannot
  17238. be used with normal_map, slope_map or wave type modifiers in a
  17239. normal statement.
  17240.  
  17241. When used as a pigment pattern or texture pattern, the quilted
  17242. pattern is similar to normal quilted but is not identical as are
  17243. most normals when compared to pigments.
  17244.  
  17245. The two parameters control0 and control1 are used to adjust the
  17246. curvature of the seam or gouge area between the quilts.  The
  17247. syntax is:
  17248.  
  17249. It is specified as
  17250.  
  17251.   pigment {quilted [QUILTED_MODIFIERS...] }
  17252. QUILTED_MODIFIERS:
  17253.   control0 Value_0   |   control Value_1   |   PIGMENT_MODIFIERS
  17254. The values should generally be kept to around the 0.0 to 1.0
  17255. range.  The default value is 1.0 if none is specified. Think of
  17256. this gouge between the tiles in cross-section as a sloped line.
  17257.  
  17258.                                 
  17259.                                 
  17260.      Quilted pattern with c0=0 and different values for c1.
  17261.                                 
  17262.                                 
  17263.                                 
  17264.     Quilted pattern with c0=0.33 and different values for c1.
  17265.                                 
  17266.                                 
  17267.                                 
  17268.     Quilted pattern with c0=0.67 and different values for c1.
  17269.                                 
  17270.                                 
  17271.                                 
  17272.      Quilted pattern with c0=1 and different values for c1.
  17273.                                 
  17274. This straight slope can be made to curve by adjusting the two
  17275. control values. The control values adjust the slope at the top
  17276. and bottom of the curve. A control values of 0 at both ends will
  17277. give a linear slope, as shown above, yielding a hard edge. A
  17278. control value of 1 at both ends will give an "s" shaped curve,
  17279. resulting in a softer, more rounded edge.
  17280.  
  17281.  
  17282. 4.7.7.21  Radial
  17283. The radial pattern is a radial blend that wraps around the +y-
  17284. axis. The color for value 0.0 starts at the +x-direction and
  17285. wraps the color map around from east to west with 0.25 in the -z-
  17286. direction, 0.5 in -x, 0.75 at +z and back to 1.0 at +x. Typically
  17287. the pattern is used with a frequency modifier to create multiple
  17288. bands that radiate from the y-axis.  For example:
  17289.  
  17290.   pigement {
  17291.     radial color_map{[0.5 Black][0.5 White]}
  17292.     frequency 10
  17293.   }
  17294. creates 10 white bands and 10 black bands radiating from the y
  17295. axis.
  17296.  
  17297.  
  17298. 4.7.7.22  Ripples
  17299. The ripples pattern was originally designed only to be used as a
  17300. normal pattern. It makes the surface look like ripples of water.
  17301. The ripples radiate from 10 random locations inside the unit cube
  17302. area <0,0,0> to <1,1,1>. Scale the pattern to make the centers
  17303. closer or farther apart.
  17304.  
  17305. Usually the ripples from any given center are about 1 unit apart.
  17306. The frequency keyword changes the spacing between ripples. The
  17307. phase keyword can be used to move the ripples outwards for
  17308. realistic animation.
  17309.  
  17310. The number of ripple centers can be changed with the global
  17311. parameter
  17312.  
  17313.   global_settings{number_of_waves Count }
  17314. somewhere in the scene. This affects the entire scene. You cannot
  17315. change the number of wave centers on individual patterns. See
  17316. section "Number_Of_Waves" for details.
  17317.  
  17318. When used as a normal pattern, this pattern uses a specialized
  17319. normal perturbation function. This means that the pattern cannot
  17320. be used with normal_map, slope_map or wave type modifiers in a
  17321. normal statement.
  17322.  
  17323. When used as a pigment pattern or texture pattern, the ripples
  17324. pattern is similar to normal ripples but is not identical as are
  17325. most normals when compared to pigments.
  17326.  
  17327.  
  17328. 4.7.7.23  Spherical
  17329. The spherical pattern creates a one unit radius sphere along the
  17330. Y axis.  It is computed by:
  17331.  
  17332.   value = 1.0-min(1, sqrt(X^2 + Y^2 + Z^2))
  17333.  
  17334. It starts at 1.0 at the origin and increases to a max value of
  17335. 0.0 as it approaches a distance of 1 unit from the origin in any
  17336. direction.  It remains at 0.0 for all areas beyond that distance.
  17337. This pattern was originally created for use with halo or media
  17338. but it may be used anywhere any pattern may be used.
  17339.  
  17340.  
  17341. 4.7.7.24  Spiral1
  17342. The spiral1 pattern creates a spiral that winds around the y-axis
  17343. similar to a screw. When viewed sliced in the X-Z plane, it looks
  17344. like the spiral arms of a galaxy.  Its syntax is:
  17345.  
  17346.   pigment {spiral1 Number_of_Arms [PIGMENT_MODIFIERS...] }
  17347. The Number_of_Arms value determines how may arms are winding
  17348. around the y-axis.
  17349.  
  17350. As a normal pattern, the syntax is
  17351.  
  17352.   normal {spiral1 Number_of_Arms  [, Bump_Size]
  17353.   [NORMAL_MODIFIERS...] }
  17354. where the vector <Orientation> is a required parameter but the
  17355. float Bump_Size which follows is optional.  Note that the comma
  17356. is required especially if Bump_Size is negative.
  17357.  
  17358. The pattern uses the triangle_wave wave type by default but may
  17359. use any wave type.
  17360.  
  17361.  
  17362. 4.7.7.25  Spiral2
  17363. The spiral2 pattern creates a double spiral that winds around the
  17364. y-axis similar spiral1 except it is two overlapping spirals the
  17365. twist in opposite directions.  The results sometimes looks like a
  17366. basket weave or perhaps the skin of pineapple.  The center of a
  17367. sunflower also has a similar double spiral pattern.  Its syntax
  17368. is:
  17369.  
  17370.   pigment {spiral2 Number_of_Arms [PIGMENT_MODIFIERS...] }
  17371. The Number_of_Arms value determines how may arms are winding
  17372. around the y-axis.
  17373.  
  17374. As a normal pattern, the syntax is
  17375.  
  17376.   normal {spiral2 Number_of_Arms  [, Bump_Size]
  17377.   [NORMAL_MODIFIERS...] }
  17378. where the vector <Orientation> is a required parameter but the
  17379. float Bump_Size which follows is optional.  Note that the comma
  17380. is required especially if Bump_Size is negative.
  17381.  
  17382. The pattern uses the triangle_wave wave type by default but may
  17383. use any wave type.
  17384.  
  17385.  
  17386. 4.7.7.26  Spotted
  17387. The spotted pattern is identical to the bozo pattern. Early
  17388. versions of POV-Ray did not allow turbulence to be used with
  17389. spotted.  Now that any pattern can use turbulence there is no
  17390. difference between bozo and spotted. See section "Bozo" for
  17391. details.
  17392.  
  17393.  
  17394. 4.7.7.27  Waves
  17395. The waves pattern was originally designed only to be used as a
  17396. normal pattern. It makes the surface look like waves on water.
  17397. The waves pattern looks similar to the ripples pattern except the
  17398. features are rounder and broader. The effect is to make waves
  17399. that look more like deep ocean waves. The waves radiate from 10
  17400. random locations inside the unit cube area <0,0,0> to <1,1,1>.
  17401. Scale the pattern to make the centers closer or farther apart.
  17402.  
  17403. Usually the waves from any given center are about 1 unit apart.
  17404. The frequency keyword changes the spacing between waves. The
  17405. phase keyword can be used to move the waves outwards for
  17406. realistic animation.
  17407.  
  17408. The number of wave centers can be changed with the global
  17409. parameter
  17410.  
  17411.   global_settings{number_of_waves Count }
  17412. somewhere in the scene. This affects the entire scene. You cannot
  17413. change the number of wave centers on individual patterns. See
  17414. section "Number_Of_Waves" for details.
  17415.  
  17416. When used as a normal pattern, this pattern uses a specialized
  17417. normal perturbation function. This means that the pattern cannot
  17418. be used with normal_map, slope_map or wave type modifiers in a
  17419. normal statement.
  17420.  
  17421. When used as a pigment pattern or texture pattern, the waves
  17422. pattern is similar to normal waves but is not identical as are
  17423. most normals when compared to pigments.
  17424.  
  17425.  
  17426. 4.7.7.28  Wood
  17427. The wood pattern consists of concentric cylinders centered on the
  17428. z-axis. When appropriately colored, the bands look like the
  17429. growth rings and veins in real wood. Small amounts of turbulence
  17430. should be added to make it look more realistic. By default, wood
  17431. has no turbulence.
  17432.  
  17433. Unlike most patterns, the wood pattern uses the triangle_wave
  17434. wave type by default. This means that like marble, wood uses
  17435. color map values 0.0 to 1.0 then repeats the colors in reverse
  17436. order from 1.0 to 0.0. However you may use any wave type.
  17437.  
  17438.  
  17439. 4.7.7.29  Wrinkles
  17440. The wrinkles pattern was originally designed only to be used as a
  17441. normal pattern. It uses a 1/f noise pattern similar to granite
  17442. but the features in wrinkles are sharper. The pattern can be used
  17443. to simulate wrinkled cellophane or foil. It also makes an
  17444. excellent stucco texture.
  17445.  
  17446. When used as a normal pattern, this pattern uses a specialized
  17447. normal perturbation function. This means that the pattern cannot
  17448. be used with normal_map, slope_map or wave type modifiers in a
  17449. normal statement.
  17450.  
  17451. When used as a pigment pattern or texture pattern, the wrinkles
  17452. pattern is similar to normal wrinkles but is not identical as are
  17453. most normals when compared to pigments.
  17454.  
  17455.  
  17456. 4.7.8     Pattern Modifiers
  17457. Pattern modifiers are statements or parameters which modify how a
  17458. pattern is evaluated or tells what to do with the pattern. The
  17459. complete syntax is:
  17460.  
  17461. PATTERN_MODIFIER:
  17462.   BLEND_MAP_MODIFIER   |   AGATE_MODIFIER   |
  17463.   DENSITY_FILE_MODIFIER   |
  17464.   QUILTED_MODIFIER   |   BRICK_MODIFIER   |
  17465.   turbulence <Amount>   |   octaves Count   |   omega Amount   |
  17466.   lambda Amount   |
  17467.   warp { [WARP_ITEMS...] }   |
  17468.   TRANSFORMATION
  17469. BLEND_MAP_MODIFIER:
  17470.   frequency Amount   |   phase Amount   |
  17471.   ramp_wave   |   triangle_wave   |   sine_wave   |
  17472.   scallop_wave   |
  17473.   cubic_wave   |   poly_wave [Exponent]
  17474. AGATE_MODIFIER:
  17475.   agate_turb Value
  17476. BRICK_MODIFIER:
  17477.   brick_size Size   |   mortar Size
  17478. DENSITY_FILE_MODIFIER:
  17479.   interpolate Type
  17480. QUILTED_MODIFIER:
  17481.   control0 Value   |   control1 Value
  17482. PIGMENT_MODIFIER:
  17483.   PATTERN_MODIFIER   |   COLOR_LIST   |   PIGMENT_LIST   |
  17484.   color_map{ COLOR_MAP_BODY }   |   colour_map{ COLOR_MAP_BODY }
  17485.   |
  17486.   pigment_map{ PIGMENT_MAP_BODY }   |
  17487.   quick_color COLOR   |   quick_colour COLOR
  17488. NORMAL_MODIFIER:
  17489.   PATTERN_MODIFIER   |   NORMAL_LIST   |
  17490.   normal_map{ NORMAL_MAP_BODY }   |
  17491.   slope_map{ SLOPE_MAP_BODY }   |
  17492.   bump_size Amount
  17493. TEXTURE_PATTERN_MODIFIER:
  17494.   PATTERN_MODIFIER   |   TEXTURE_LIST   |
  17495.   texture_map{ TEXTURE_MAP_BODY }
  17496. DENSITY_MODIFIER:
  17497.   PATTERN_MODIFIER   |   DENSITY_LIST   |   COLOR_LIST   |
  17498.   color_map{ COLOR_MAP_BODY }   |   colour_map{ COLOR_MAP_BODY }
  17499.   |
  17500.   density_map{ DENSITY_MAP_BODY }
  17501. The modifiers PIGMENT_LIST, quick_color, and pigment_map apply
  17502. only to pigments. See section "Pigment" for details on these
  17503. pigment-specific pattern modifiers.
  17504.  
  17505. The modifiers COLOR_LIST and color_map apply only to pigments and
  17506. densities. See sections "Pigment" and "Density" for details on
  17507. these pigment-specific pattern modifiers.
  17508.  
  17509. The modifiers NORMAL_LIST, bump_size, slope_map and normal_map
  17510. apply only to normals. See section "Normal" for details on these
  17511. normal-specific pattern modifiers.
  17512.  
  17513. The TEXTURE_LIST and texture_map modifiers can only be used with
  17514. patterned textures. See section "Texture Maps" for details.
  17515.  
  17516. The DENSITY_LIST and density_map modifiers only work with
  17517. media{density{..}} statements.  See "Density" for details.
  17518.  
  17519. The agate_turb modifier can only be used with the agate pattern.
  17520. See "Agate" for details.
  17521.  
  17522. The brick_size and mortar modifiers can only be used with the
  17523. brick pattern.  See "Brick" for details.
  17524.  
  17525. The control0 and control1 modifiers can only be used with the
  17526. quilted pattern.  See "Quilted" for details.
  17527.  
  17528. The interpolate modifier can only be used with the density_file
  17529. pattern.  See "Density_File" for details.
  17530.  
  17531. The general purpose pattern modifiers in the following sections
  17532. can be used with pigment, normal, texture, or density patterns.
  17533.  
  17534.  
  17535. 4.7.8.1   Transforming Patterns
  17536. The most common pattern modifiers are the transformation
  17537. modifiers translate, rotate, scale, transform, and matrix.  For
  17538. details on these commands see section "Transformations".
  17539.  
  17540. These modifiers may be placed inside pigment, normal, texture,
  17541. and density statements to change the position, size and
  17542. orientation of the patterns.
  17543.  
  17544. Transformations are performed in the order in which you specify
  17545. them.  However in general the order of transformations relative
  17546. to other pattern modifiers such as turbulence, color_map and
  17547. other maps is not important. For example scaling before or after
  17548. turbulence makes no difference. The turbulence is done first,
  17549. then the scaling regardless of which is specified first. However
  17550. the order in which transformations are performed relative to warp
  17551. statements is important. See "Warps" for details.
  17552.  
  17553.  
  17554. 4.7.8.2   Frequency and Phase
  17555. The frequency and phase modifiers act as a type of scale and
  17556. translate modifiers for various blend maps.  They only have
  17557. effect when blend maps are used.  Blend maps are color_map,
  17558. pigment_map, normal_map, slope_map, density_map, and texture_map.
  17559. This discussion uses a color map as an example but the same
  17560. principles apply to the other blend map types.
  17561.  
  17562. The frequency keyword adjusts the number of times that a color
  17563. map repeats over one cycle of a pattern. For example gradient
  17564. covers color map values 0 to 1 over the range from x=0 to x=1. By
  17565. adding frequency 2.0 the color map repeats twice over that same
  17566. range. The same effect can be achieved using scale 0.5*x so the
  17567. frequency keyword isn't that useful for patterns like gradient.
  17568.  
  17569. However the radial pattern wraps the color map around the +y-axis
  17570. once. If you wanted two copies of the map (or 3 or 10 or 100)
  17571. you'd have to build a bigger map. Adding frequency 2.0 causes the
  17572. color map to be used twice per revolution. Try this:
  17573.  
  17574.   pigment {
  17575.     radial
  17576.     color_map{[0.5 color Red][0.5 color White]}
  17577.     frequency 6
  17578.   }
  17579. The result is six sets of red and white radial stripes evenly
  17580. spaced around the object.
  17581.  
  17582. The float after frequency can be any value. Values greater than
  17583. 1.0 causes more than one copy of the map to be used. Values from
  17584. 0.0 to 1.0 cause a fraction of the map to be used. Negative
  17585. values reverses the map.
  17586.  
  17587. The phase value causes the map entries to be shifted so that the
  17588. map starts and ends at a different place. In the example above if
  17589. you render successive frames at phase 0 then phase 0.1, phase
  17590. 0.2, etc. you could create an animation that rotates the stripes.
  17591. The same effect can be easily achieved by rotating the radial
  17592. pigment using rotate y*Angle but there are other uses where phase
  17593. can be handy.
  17594.  
  17595. Sometimes you create a great looking gradient or wood color map
  17596. but you want the grain slightly adjusted in or out. You could re-
  17597. order the color map entries but that's a pain. A phase adjustment
  17598. will shift everything but keep the same scale. Try animating a
  17599. mandel pigment for a color palette rotation effect.
  17600.  
  17601. These values work by applying the following formula
  17602.  
  17603.   New_Value = fmod ( Old_Value * Frequency + Phase, 1.0 ).
  17604.  
  17605. The frequency and phase modifiers have no effect on block
  17606. patterns checker, brick, and hexagon nor do they effect
  17607. image_map, bump_map or material_map. They also have no effect in
  17608. normal statements when used with bumps, dents, quilted or
  17609. wrinkles because these normal patterns cannot use normal_map or
  17610. slope_map.
  17611.  
  17612. They can be used with normal patterns ripples and waves even
  17613. though these two patterns cannot use normal_map or slope_map
  17614. either. When used with ripples or waves, frequency adjusts the
  17615. space between features and phase can be adjusted from 0.0 to 1.0
  17616. to cause the ripples or waves to move relative to their center
  17617. for animating the features.
  17618.  
  17619.  
  17620. 4.7.8.3   Waveforms
  17621. POV-Ray allows you to apply various wave forms to the pattern
  17622. function before applying it to a blend map. Blend maps are
  17623. color_map, pigment_map, normal_map, slope_map, density_map, and
  17624. texture_map.
  17625.  
  17626. Most of the patterns which use a blend map, use the entries in
  17627. the map in order from 0.0 to 1.0. The effect can most easily be
  17628. seen when these patterns are used as normal patterns with no
  17629. maps.  Patterns such as gradient or onion generate a grove or
  17630. slot that looks like a ramp that drops off sharply.  This is
  17631. called a  ramp_wave wave type and it is the default wave type for
  17632. most patterns. However the wood and marble patterns use the map
  17633. from 0.0 to 1.0 and then reverses it and runs it from 1.0 to 0.0.
  17634. The result is a wave form which slopes upwards to a peak, then
  17635. slopes down again in a triangle_wave. In earlier versions of POV-
  17636. Ray there was no way to change the wave types. You could simulate
  17637. a triangle wave on a ramp wave pattern by duplicating the map
  17638. entries in reverse, however there was no way to use a ramp wave
  17639. on wood or marble.
  17640.  
  17641. Now any pattern that takes a map can have the default wave type
  17642. overridden. For example:
  17643.  
  17644.   pigment { wood color_map { MyMap } ramp_wave }
  17645. Also available are sine_wave, scallop_wave, cubic_wave and
  17646. poly_wave types. These types are of most use in normal patterns
  17647. as a type of built-in slope map. The  sine_wave takes the zig-zag
  17648. of a ramp wave and turns it into a gentle rolling wave with
  17649. smooth transitions. The scallop_wave uses the absolute value of
  17650. the sine wave which looks like corduroy when scaled small or like
  17651. a stack of cylinders when scaled larger.  The cubic_wave is a
  17652. gentle cubic curve from 0.0 to 1.0 with zero slope at the start
  17653. and end.  The poly_wave is an exponential function.  It is
  17654. followed by an optional float value which specifies exponent.
  17655. For example poly_wave 2 starts low and climbs rapidly at the end
  17656. while poly_wave 0.5 climbs rapidly at first and levels off at the
  17657. end.  If no float value is specified, the default is 1.0 which
  17658. produces a linear function identical to ramp_wave.
  17659.  
  17660. Although any of these wave types can be used for pigments,
  17661. normals, textures, or density the effect of many of the wave
  17662. types are not as noticeable on pigments, textures, or density as
  17663. they are for normals.
  17664.  
  17665. Wave type modifiers have no effect on block patterns checker,
  17666. brick, and hexagon nor do they effect image_map, bump_map or
  17667. material_map. They also have no effect in normal statements when
  17668. used with bumps, dents, quilted, ripples, waves, or wrinkles
  17669. because these normal patterns cannot use normal_map or slope_map.
  17670.  
  17671.  
  17672. 4.7.8.4   Turbulence
  17673. The keyword turbulence followed by a float or vector may be used
  17674. to stir up any pigment, normal, texture, irid or density. A
  17675. number of optional parameters may be used with turbulence to
  17676. control how it is computed. The syntax is:
  17677.  
  17678. TURBULENCE_ITEM:
  17679.   turbulence <Amount>   |   octaves Count   |   omega Amount   |
  17680.   lambda Amount
  17681. Typical turbulence values range from the default 0.0, which is no
  17682. turbulence, to 1.0 or more, which is very turbulent. If a vector
  17683. is specified different amounts of turbulence are applied in the x-
  17684. , y- and z-direction. For example
  17685.  
  17686.   turbulence <1.0, 0.6, 0.1>
  17687. has much turbulence in the x-direction, a moderate amount in the
  17688. y-direction and a small amount in the z-direction.
  17689.  
  17690. Turbulence uses a random noise function called DNoise. This is
  17691. similar to the noise used in the bozo pattern except that instead
  17692. of giving a single value it gives a direction. You can think of
  17693. it as the direction that the wind is blowing at that spot. Points
  17694. close together generate almost the same value but points far
  17695. apart are randomly different.
  17696.  
  17697. In general the order of turbulence parameters relative to other
  17698. pattern modifiers such as transformations, color maps and other
  17699. maps is not important. For example scaling before or after
  17700. turbulence makes no difference. The turbulence is done first,
  17701. then the scaling regardless of which is specified first. See
  17702. section "" for a way to work around this behavior.
  17703.  
  17704. In general, the order of turbulence parameters relative to each
  17705. other and to other pattern modifiers such as transformations or
  17706. color_map and other maps is not important. For example scaling
  17707. before or after turbulence makes no difference. The turbulence is
  17708. done first, then the scaling regardless of which is specified
  17709. first. However the order in which transformations are performed
  17710. relative to warp statements is important. You can also specify
  17711. turbulence inside warp and in this way you can force turbulence
  17712. to be applied after transformations.  See "Warps" for details.
  17713.  
  17714. Turbulence uses DNoise to push a point around in several steps
  17715. called octaves. We locate the point we want to evaluate, then
  17716. push it around a bit using turbulence to get to a different point
  17717. then look up the color or pattern of the new point.
  17718.  
  17719. It says in effect "Don't give me the color at this spot... take a
  17720. few random steps in different directions and give me that color".
  17721. Each step is typically half as long as the one before. For
  17722. example:
  17723.  
  17724.                                 
  17725.                                 
  17726.                      Turbulence random walk.
  17727.                                 
  17728. The magnitude of these steps is controlled by the turbulence
  17729. value. There are three additional parameters which control how
  17730. turbulence is computed. They are octaves, lambda and omega. Each
  17731. is optional. Each is followed by a single float value. Each has
  17732. no effect when there is no turbulence.
  17733.  
  17734.  
  17735. 4.7.8.5   Octaves
  17736. The octaves keyword may be followed by an integer value to
  17737. control the number of steps of turbulence that are computed.
  17738. Legal values range from 1 to 10. The default value of 6 is a
  17739. fairly high value; you won't see much change by setting it to a
  17740. higher value because the extra steps are too small. Float values
  17741. are truncated to integer. Smaller numbers of octaves give a
  17742. gentler, wavy turbulence and computes faster. Higher octaves
  17743. create more jagged or fuzzy turbulence and takes longer to
  17744. compute.
  17745.  
  17746.  
  17747. 4.7.8.6   Lambda
  17748. The lambda parameter controls how statistically different the
  17749. random move of an octave is compared to its previous octave. The
  17750. default value is 2.0 which is quite random. Values close to
  17751. lambda 1.0 will straighten out the randomness of the path in the
  17752. diagram above. The zig-zag steps in the calculation are in nearly
  17753. the same direction. Higher values can look more swirly under some
  17754. circumstances.
  17755.  
  17756.  
  17757. 4.7.8.7   Omega
  17758. The omega value controls how large each successive octave step is
  17759. compared to the previous value. Each successive octave of
  17760. turbulence is multiplied by the omega value. The default omega
  17761. 0.5 means that each octave is 1/2 the size of the previous one.
  17762. Higher omega values mean that 2nd, 3rd, 4th and up octaves
  17763. contribute more turbulence giving a sharper, crinkly look while
  17764. smaller omegas give a fuzzy kind of turbulence that gets blurry
  17765. in places.
  17766.  
  17767.  
  17768. 4.7.8.8   Warps
  17769. The warp statement is a pattern modifier that is similar to
  17770. turbulence. Turbulence works by taking the pattern evaluation
  17771. point and pushing it about in a series of random steps. However
  17772. warps push the point in very well-defined, non-random, geometric
  17773. ways. The warp statement also overcomes some limitations of
  17774. traditional turbulence and transformations by giving the user
  17775. more control over the order in which turbulence, transformation
  17776. and warp modifiers are applied to the pattern.
  17777.  
  17778. Currently there are three types of warps but the syntax was
  17779. designed to allow future expansion. The first two, the repeat
  17780. warp and the black_hole warp are new features for POV-Ray that
  17781. modify the pattern in geometric ways. The other warp provides an
  17782. alternative way to specify turbulence.
  17783.  
  17784. The syntax for using a warp statement is:
  17785.  
  17786. WARP:
  17787.   warp { WARP_ITEM }
  17788. WARP_ITEM:
  17789.   repeat <Directiont>  [REPEAT_ITEMS...]   |
  17790.   black_hole <Location>, Radius [BLACK_HOLE_ITEMS...]   |
  17791.   turbulence <Amount> [TURB_ITEMS...]
  17792. REPEAT_ITEMS:
  17793.   offset <Amount>   |   flip <Axis>
  17794. BLACK_HOLE_ITEMS:
  17795.   strength Strength   |   falloff Amount   |   inverse   |
  17796.   type Type   |
  17797.   repeat <Repeat>   |   turbulence <Amount>
  17798. TURB_ITEMS:
  17799.   octaves Count   |   omega Amount   |   lambda Amount
  17800. You may have as many separate warp statements as you like in each
  17801. pattern. The placement of warp statements relative to other
  17802. modifiers such as color_map or turbulence is not important.
  17803. However placement of warp statements relative to each other and
  17804. to transformations is significant. Multiple warps and
  17805. transformations are evaluated in the order in which you specify
  17806. them. For example if you translate, then warp or warp, then
  17807. translate, the results can be different.
  17808.  
  17809.  
  17810. 4.7.8.8.1 Black Hole Warp
  17811. A black_hole warp is so named because of its similarity to real
  17812. black holes. Just like the real thing, you cannot actually see a
  17813. black hole. The only way to detect its presence is by the effect
  17814. it has on things that surround it.
  17815.  
  17816. Take, for example, a wood grain. Using POV-Ray's normal
  17817. turbulence and other texture modifier functions, you can get a
  17818. nice, random appearance to the grain. But in its randomness it is
  17819. regular - it is regularly random! Adding a black hole allows you
  17820. to create a localized disturbance in a wood grain in either one
  17821. or multiple locations. The black hole can have the effect of
  17822. either sucking the surrounding texture into itself (like the real
  17823. thing) or pushing it away. In the latter case, applied to a wood
  17824. grain, it would look to the viewer as if there were a knothole in
  17825. the wood. In this text we use a wood grain regularly as an
  17826. example, because it is ideally suitable to explaining black
  17827. holes. However, black holes may in fact be used with any texture
  17828. or pattern.  The effect that the black hole has on the texture
  17829. can be specified.  By default, it sucks with the strength
  17830. calculated exponentially (inverse-square). You can change this if
  17831. you like.
  17832.  
  17833. Black holes may be used anywhere a warp is permitted. The syntax
  17834. is:
  17835.  
  17836. BLACK_HOLE_WARP:
  17837.   warp {black_hole <Location>, Radius [BLACK_HOLE_ITEMS...] }
  17838. BLACK_HOLE_ITEMS:
  17839.   strength Strength   |   falloff Amount   |   inverse   |
  17840.   type Type   |
  17841.   repeat <Repeat>   |   turbulence <Amount>
  17842. The minimal requirement is the black_hole keyword followed by a
  17843. vector <Location> followed by a comma and a float Radius.  Black
  17844. holes effect all points within the spherical region around the
  17845. location and within the radius.  This is optionally followed by
  17846. any number of other keywords which control how the texture is
  17847. warped.
  17848.  
  17849. The falloff keyword may be used with a float value to specify the
  17850. power by which the effect of the black hole falls off. The
  17851. default is two. The force of the black hole at any given point,
  17852. before applying the strength modifier, is as follows.
  17853.  
  17854. First, convert the distance from the point to the center to a
  17855. proportion (0 to 1) that the point is from the edge of the black
  17856. hole. A point on the perimeter of the black hole will be 0.0; a
  17857. point at the center will be 1.0; a point exactly halfway will be
  17858. 0.5, and so forth.  Mentally you can consider this to be a
  17859. closeness factor. A closeness of 1.0 is as close as you can get
  17860. to the center (i.e. at the center), a closeness of 0.0 is as far
  17861. away as you can get from the center and still be inside the black
  17862. hole and a closeness of 0.5 means the point is exactly halfway
  17863. between the two.
  17864.  
  17865. Call this value c. Raise c to the power specified in falloff. By
  17866. default Falloff is 2, so this is c2 or c squared. The resulting
  17867. value is the force of the black hole at that exact location and
  17868. is used, after applying the strength scaling factor as described
  17869. below, to determine how much the point is perturbed in space. For
  17870. example, if c is 0.5 the force is 0.52 or 0.25. If c is 0.25 the
  17871. force is 0.125. But if c is exactly 1.0 the force is 1.0.  Recall
  17872. that as c gets smaller the point is farther from the center of
  17873. the black hole. Using the default power of 2, you can see that as
  17874. c reduces, the force reduces exponentially in an inverse-square
  17875. relationship. Put in plain English, it means that the force is
  17876. much stronger (by a power of two) towards the center than it is
  17877. at the outside.
  17878.  
  17879. By increasing falloff, you can increase the magnitude of the
  17880. falloff. A large value will mean points towards the perimeter
  17881. will hardly be affected at all and points towards the center will
  17882. be affected strongly.  A value of 1.0 for falloff will mean that
  17883. the effect is linear. A point that is exactly halfway to the
  17884. center of the black hole will be affected by a force of exactly
  17885. 0.5.  A value of falloff of less than one but greater than zero
  17886. means that as you get closer to the outside, the force increases
  17887. rather than decreases. This can have some uses but there is a
  17888. side effect.  Recall that the effect of a black hole ceases
  17889. outside its perimeter.  This means that points just within the
  17890. perimeter will be affected strongly and those just outside not at
  17891. all. This would lead to a visible border, shaped as a sphere.  A
  17892. value for falloff of 0 would mean that the force would be 1.0 for
  17893. all points within the black hole, since any number larger 0
  17894. raised to the power of 0 is 1.0.
  17895.  
  17896. The strength keyword may be specified with a float value to give
  17897. you a bit more control over how much a point is perturbed by the
  17898. black hole. Basically, the force of the black hole (as determined
  17899. above) is multiplied by the value of strength, which defaults to
  17900. 1.0. If you set strength to 0.5, for example, all points within
  17901. the black hole will be moved by only half as much as they would
  17902. have been. If you set it to 2.0 they will be moved twice as much.
  17903.  
  17904. There is a rider to the latter example, though - the movement is
  17905. clipped to a maximum of the original distance from the center.
  17906. That is to say, a point that is 0.75 units from the center may
  17907. only be moved by a maximum of 0.75 units either towards the
  17908. center or away from it, regardless of the value of strength. The
  17909. result of this clipping is that you will have an exclusion area
  17910. near the center of the black hole where all points whose final
  17911. force value exceeded or equaled 1.0 were moved by a fixed amount.
  17912.  
  17913. If the inverted keyword is specified then points pushed away from
  17914. the center instead of being pulled in.
  17915.  
  17916. The repeat keyword followed by a vector, allows you to simulate
  17917. the effect of many black holes without having to explicitly
  17918. declare them. Repeat is a vector that tells POV-Ray to use this
  17919. black hole at multiple locations.  Using repeat logically divides
  17920. your scene up into cubes, the first being located at <0,0,0> and
  17921. going to <Repeat>. Suppose your repeat vector was <1,5,2>. The
  17922. first cube would be from <0,0,0> to < 1,5,2>. This cube repeats,
  17923. so there would be one at < -1,-5,-2>, <1,5,2>, <2,10,4> and so
  17924. forth in all directions, ad infinitum.
  17925.  
  17926. When you use repeat, the center of the black hole does not
  17927. specify an absolute location in your scene but an offset into
  17928. each block. It is only possible to use positive offsets. Negative
  17929. values will produce undefined results.
  17930.  
  17931. Suppose your center was <0.5,1,0.25> and the repeat vector is
  17932. <2,2,2>. This gives us a block at < 0,0,0> and <2,2,2>, etc. The
  17933. centers of the black hole's for these blocks would be <0,0,0> + <
  17934. 0.5,1.0,0.25>, i. e. <0.5,1.0,0.25>, and < 2,2,2> +
  17935. <0.5,1.0,0.25>, i. e. < 2,5,3.0,2.25>.
  17936.  
  17937. Due to the way repeats are calculated internally, there is a
  17938. restriction on the values you specify for the repeat vector.
  17939. Basically, each black hole must be totally enclosed within each
  17940. block (or cube), with no part crossing into a neighboring one.
  17941. This means that, for each of the x, y and z dimensions, the
  17942. offset of the center may not be less than the radius, and the
  17943. repeat value for that dimension must be >=the center plus the
  17944. radius since any other values would allow the black hole to cross
  17945. a boundary. Put another way, for each of x, y and z
  17946.  
  17947. Radius <= Offset or Center <= Repeat - Radius.
  17948. If the repeat vector in any dimension is too small to fit this
  17949. criteria, it will be increased and a warning message issued. If
  17950. the center is less than the radius it will also be moved but no
  17951. message will be issued.
  17952.  
  17953. Note that none of the above should be read to mean that you can't
  17954. overlap black holes. You most certainly can and in fact this can
  17955. produce some most useful effects. The restriction only applies to
  17956. elements of the same black hole which is repeating. You can
  17957. declare a second black hole that also repeats and its elements
  17958. can quite happily overlap the first and causing the appropriate
  17959. interactions.  It is legal for the repeat value for any dimension
  17960. to be 0, meaning that POV-Ray will not repeat the black hole in
  17961. that direction.
  17962.  
  17963. The turbulence can only be used in a black hole with repeat. It
  17964. allows an element of randomness to be inserted into the way the
  17965. black holes repeat, to cause a more natural look. A good example
  17966. would be an array of knotholes in wood - it would look rather
  17967. artificial if each knothole were an exact distance from the
  17968. previous.
  17969.  
  17970. The turbulence vector is a measurement that is added to each
  17971. individual back hole in an array, after each axis of the vector
  17972. is multiplied by a different random amount ranging from 0 to 1.
  17973. The resulting actual position of the black hole's center for that
  17974. particular repeat element is random (but consistent, so renders
  17975. will be repeatable) and somewhere within the above co-ordinates.
  17976. There is a rider on the use of turbulence, which basically is the
  17977. same as that of the repeat vector. You can't specify a value
  17978. which would cause a black hole to potentially cross outside of
  17979. its particular block.
  17980.  
  17981. In summary: For each of x, y and z the offset of the center must
  17982. be >=radius and the value of the repeat must be >= center +
  17983. radius + turbulence. The exception being that repeat may be 0 for
  17984. any dimension, which means do not repeat in that direction.
  17985.  
  17986. Some examples are given by
  17987.  
  17988.   warp
  17989.   {
  17990.     black_hole <0, 0, 0>, 0.5
  17991.   }
  17992.   warp
  17993.   {
  17994.     black_hole <0.15, 0.125, 0>, 0.5
  17995.     falloff 7
  17996.     strength 1.0
  17997.     repeat <1.25, 1.25, 0>
  17998.     turbulence <0.25, 0.25, 0>
  17999.     inverse
  18000.   }
  18001.   warp
  18002.   {
  18003.     black_hole <0, 0, 0>, 1.0
  18004.     falloff 2
  18005.     strength 2
  18006.     inverse
  18007.   }
  18008.  
  18009. 4.7.8.8.2 Repeat Warp
  18010. The repeat warp causes a section of the pattern to be repeated
  18011. over and over. It takes a slice out of the pattern and makes
  18012. multiple copies of it side-by-side. The warp has many uses but
  18013. was originally designed to make it easy to model wood veneer
  18014. textures. Veneer is made by taking very thin slices from a log
  18015. and placing them side-by-side on some other backing material. You
  18016. see side-by-side nearly identical ring patterns but each will be
  18017. a slice perhaps 1/32th of an inch deeper.
  18018.  
  18019. The syntax for a repeat warp is
  18020.  
  18021. REPEAT_WARP:
  18022.   warp { repeat <Directiont>  [REPEAT_ITEMS...] }
  18023. REPEAT_ITEMS:
  18024.   offset <Amount>   |   flip <Axis>
  18025. The repeat vector specifies the direction in which the pattern
  18026. repeats and the width of the repeated area. This vector must lie
  18027. entirely along an axis. In other words, two of its three
  18028. components must be 0. For example
  18029.  
  18030.   pigment {
  18031.     wood
  18032.     warp {repeat 2*x}
  18033.   }
  18034. which means that from x=0 to x=2 you get whatever the pattern
  18035. usually is. But from x=2 to x=4 you get the same thing exactly
  18036. shifted two units over in the x-direction. To evaluate it you
  18037. simply take the x-coordinate modulo 2. Unfortunately you get
  18038. exact duplicates which isn't very realistic. The optional offset
  18039. vector tells how much to translate the pattern each time it
  18040. repeats. For example
  18041.  
  18042.   pigment {
  18043.     wood
  18044.     warp {repeat x*2  offset z*0.05}
  18045.   }
  18046. means that we slice the first copy from x=0 to x=2 at z=0 but at
  18047. x=2 to x=4 we offset to z=0.05. In the 4 to 6 interval we slice
  18048. at z=0.10. At the n-th copy we slice at 0.05 n z. Thus each copy
  18049. is slightly different. There are no restrictions on the offset
  18050. vector.
  18051.  
  18052. Finally the flip vector causes the pattern to be flipped or
  18053. mirrored every other copy of the pattern. The first copy of the
  18054. pattern in the positive direction from the axis is not flipped.
  18055. The next farther is, the next is not, etc. The flip vector is a
  18056. three component x, y, z vector but each component is treated as a
  18057. boolean value that tells if you should or should not flip along a
  18058. given axis. For example
  18059.  
  18060.   pigment {
  18061.     wood
  18062.     warp {repeat 2*x  flip <1,1,0>}
  18063.   }
  18064. means that every other copy of the pattern will be mirrored about
  18065. the x- and y- axis but not the z-axis. A non-zero value means
  18066. flip and zero means do not flip about that axis. The magnitude of
  18067. the values in the flip vector doesn't matter.
  18068.  
  18069.  
  18070. 4.7.8.8.3 Turbulence Warp
  18071. The POV-Ray language contains an ambiguity and limitation on the
  18072. way you specify turbulence and transformations such as translate,
  18073. rotate, scale, matrix, and transform transforms. Usually the
  18074. turbulence is done first.  Then all translate, rotate, scale,
  18075. matrix, and transform operations are always done after turbulence
  18076. regardless of the order in which you specify them. For example
  18077. this
  18078.  
  18079.  pigment {
  18080.    wood
  18081.    scale .5
  18082.    turbulence .2
  18083.  }
  18084. works exactly the same as
  18085.  
  18086.  pigment {
  18087.    wood
  18088.    turbulence .2
  18089.    scale .5
  18090.  }
  18091. The turbulence is always first. A better example of this
  18092. limitation is with uneven turbulence and rotations.
  18093.  
  18094.   pigment {
  18095.     wood
  18096.     turbulence 0.5*y
  18097.     rotate z*60
  18098.   }
  18099.   // as compared to
  18100.   pigment {
  18101.    wood
  18102.    rotate z*60
  18103.    turbulence 0.5*y
  18104.   }
  18105. The results will be the same either way even though you'd think
  18106. it should look different.
  18107.  
  18108. We cannot change this basic behavior in POV-Ray now because lots
  18109. of scenes would potentially render differently if suddenly the
  18110. order transformation vs. turbulence suddenly mattered when in the
  18111. past, it didn't.
  18112.  
  18113. However, by specifying our turbulence inside warp statement you
  18114. tell POV-Ray that the order in which turbulence, transformations
  18115. and other warps are applied is significant. Here's an example of
  18116. a turbulence warp.
  18117.  
  18118.   warp { turbulence <0,1,1> octaves 3 lambda 1.5 omega 0.3 }
  18119. The significance is that this
  18120.  
  18121.  pigment {
  18122.    wood
  18123.    translate <1,2,3> rotate x*45 scale 2
  18124.    warp { turbulence <0,1,1> octaves 3 lambda 1.5 omega 0.3 }
  18125.  }
  18126. produces different results than this...
  18127.  
  18128.  pigment {
  18129.    wood
  18130.    warp { turbulence <0,1,1> octaves 3 lambda 1.5 omega 0.3 }
  18131.    translate <1,2,3> rotate x*45 scale 2
  18132.  }
  18133. You may specify turbulence without using a warp statement.
  18134. However you cannot control the order in which they are evaluated
  18135. unless you put them in a warp.
  18136.  
  18137. The evaluation rules are as follows:
  18138.  
  18139.  
  18140.   1)   First any turbulence not inside a warp statement is
  18141.   applied regardless of the order in which it appears relative
  18142.   to warps or transformations.
  18143.   2)   Next each warp statement, translate, rotate, scale or
  18144.   matrix one-by-one, is applied in the order the user specifies.
  18145.   If you want turbulence done in a specific order, you simply
  18146.   specify it inside a warp in the proper place.
  18147.  
  18148. 4.7.8.9   Bitmap Modifiers
  18149. A bitmap modifier is a modifier used inside an image_map,
  18150. bump_map or material_map to specify how the 2-D bitmap is to be
  18151. applied to the 3-D surface. Several bitmap modifiers apply to
  18152. specific kinds of maps and they are covered in the appropriate
  18153. sections. The bitmap modifiers discussed in the following
  18154. sections are applicable to all three types of bitmaps.
  18155.  
  18156.  
  18157. 4.7.8.9.1 The once Option
  18158. Normally there are an infinite number of repeating image maps,
  18159. bump maps or material maps created over every unit square of the
  18160. x-y-plane like tiles. By adding the once keyword after a file
  18161. name you can eliminate all other copies of the map except the one
  18162. at (0,0) to (1,1). In image maps, areas outside this unit square
  18163. are treated as fully transparent. In bump maps, areas outside
  18164. this unit square are left flat with no normal modification.  In
  18165. material maps, areas outside this unit square are textured with
  18166. the first texture of the texture list.
  18167.  
  18168. For example:
  18169.  
  18170.   image_map {
  18171.     gif "mypic.gif"
  18172.     once
  18173.   }
  18174.  
  18175. 4.7.8.9.2 The map_type Option
  18176. The default projection of the image onto the x-y-plane is called
  18177. a planar map type. This option may be changed by adding the
  18178. map_type keyword followed by an integer number specifying the way
  18179. to wrap the image around the object.
  18180.  
  18181. A map_type 0 gives the default planar mapping already described.
  18182.  
  18183. A map_type 1 gives a spherical mapping. It assumes that the
  18184. object is a sphere of any size sitting at the origin. The y-axis
  18185. is the north/south pole of the spherical mapping. The top and
  18186. bottom edges of the image just touch the pole regardless of any
  18187. scaling. The left edge of the image begins at the positive x-axis
  18188. and wraps the image around the sphere from west to east in a -y-
  18189. rotation. The image covers the sphere exactly once. The once
  18190. keyword has no meaning for this mapping type.
  18191.  
  18192. With map_type 2 you get a cylindrical mapping. It assumes that a
  18193. cylinder of any diameter lies along the y-axis. The image wraps
  18194. around the cylinder just like the spherical map but the image
  18195. remains one unit tall from y=0 to y=1. This band of color is
  18196. repeated at all heights unless the once keyword is applied.
  18197.  
  18198. Finally map_type 5 is a torus or donut shaped mapping. It assumes
  18199. that a torus of major radius one sits at the origin in the x-z-
  18200. plane. The image is wrapped around similar to spherical or
  18201. cylindrical maps. However the top and bottom edges of the map
  18202. wrap over and under the torus where they meet each other on the
  18203. inner rim.
  18204.  
  18205. Types 3 and 4 are still under development.
  18206.  
  18207. Note that the map_type option may also be applied to bump_map and
  18208. material_map statements.
  18209.  
  18210. For example:
  18211.  
  18212.   sphere{<0,0,0>,1
  18213.     pigment{
  18214.       image_map {
  18215.         gif "world.gif"
  18216.         map_type 1
  18217.       }
  18218.     }
  18219.   }
  18220.  
  18221. 4.7.8.9.3 The interpolate Option
  18222. Adding the interpolate keyword can smooth the jagged look of a
  18223. bitmap. When POV-Ray asks an image map color or a bump amount for
  18224. a bump map, it often asks for a point that is not directly on top
  18225. of one pixel but sort of between several differently colored
  18226. pixels. Interpolations returns an in-between value so that the
  18227. steps between the pixels in the map will look smoother.
  18228.  
  18229. Although interpolate is legal in material maps, the color index
  18230. is interpolated before the texture is chosen. It does not
  18231. interpolate the final color as you might hope it would. In
  18232. general, interpolation of material maps serves no useful purpose
  18233. but this may be fixed in future versions.
  18234.  
  18235. There are currently two types of interpolation:  interpolate 2
  18236. gives bilinear interpolation while interpolate 4 gives normalized
  18237. distance.  For example:
  18238.  
  18239.   image_map {
  18240.     gif "mypic.gif"
  18241.     interpolate 2
  18242.   }
  18243. Default is no interpolation. Normalized distance is the slightly
  18244. faster of the two, bilinear does a better job of picking the
  18245. between color. Normally bilinear is used.
  18246.  
  18247. If your map looks jaggy, try using interpolation instead of going
  18248. to a higher resolution image. The results can be very good.
  18249.  
  18250.  
  18251. 4.8  Media
  18252. The media statement is used to specify particulate matter
  18253. suspended in a medium such air or water.  It can be used to
  18254. specify smoke, haze, fog, gas, fire, dust etc.  Previous versions
  18255. of POV-Ray had two incompatible systems for generating such
  18256. effects.  One was halo for effects enclosed in a transparent or
  18257. semi-transparent object.  The other was atmosphere for effects
  18258. that  permeated the entire scene.  This duplication of systems
  18259. was complex and unnecessary.  Both halo and atmosphere have been
  18260. eliminated.  See "Why are Interior and Media Necessary?" for
  18261. further details on this change.  See "Object Media" for details
  18262. on how to use media with objects.  See "Atmospheric Media" for
  18263. details on using media for atmospheric effects outside of
  18264. objects.  This section and the sub-sections which follow explains
  18265. the details of the various media options which are useful for
  18266. either object media or atmospheric media.
  18267.  
  18268. Media works by sampling the density of particles at some
  18269. specified number of points along the ray's path.  Sub-samples are
  18270. also taken until the results reach a specified confidence level.
  18271. When used in an object's interior statement, sampling only occurs
  18272. inside the object.  When used for atmospheric media, the samples
  18273. run from the camera location until the ray strikes an object.
  18274. Therefore for localized effects, it is best to use an enclosing
  18275. object even though the density pattern might only produce results
  18276. in a small area whether the media was enclosed or not.
  18277.  
  18278. The complete syntax for a media statement is as follows:
  18279.  
  18280. MEDIA:
  18281.   media { [MEDIA_IDENTIFIER] [MEDIA_ITEMS...] }
  18282. MEDIA_ITEMS:
  18283.   intervals Number   |   samples Min, Max   |
  18284.   confidence Value   |   variance Value   |   ratio Value   |
  18285.   absorption  COLOR   |   emission COLOR   |
  18286.   scattering { Type, COLOR  [ eccentricity Value ] [ extinction
  18287.   Value ] }   |
  18288.   density { [DENSITY_IDENTIFIER] [PATTERN_TYPE]
  18289.   [DENSITY_MODIFIER...]  }   |
  18290.   TRANSFORMATIONS
  18291. DENSITY_MODIFIER:
  18292.   PATTERN_MODIFIER   |   DENSITY_LIST   |   COLOR_LIST   |
  18293.   color_map{ COLOR_MAP_BODY }   |   colour_map{ COLOR_MAP_BODY }
  18294.   |
  18295.   density_map{ DENSITY_MAP_BODY }
  18296. If a media identifier is specified, it must be the first item.
  18297. All other media items may be specified in any order.  All are
  18298. optional.  You may have multiple density statements in a single
  18299. media statement.  See "Multiple Density vs. Multiple Media" for
  18300. details.  Transformations apply only the density statements which
  18301. have been already specified.  Any density after a transformation
  18302. is not affected.  If the media has no density statements and none
  18303. was specified in any media identifier, then the transformation
  18304. has no effect.  All other media items except for density and
  18305. transformations override default values or any previously set
  18306. values for this media statement.
  18307.  
  18308. Note that some media effects depend upon light sources.  However
  18309. the participation of a light source depends upon the
  18310. media_interaction and media_attenuation keywords.  See
  18311. "Atmospheric Media Interaction" and "Atmospheric Attenuation" for
  18312. details.
  18313.  
  18314. Note a strange design side-effect was discovered during testing
  18315. and it was too difficult to fix.  If the enclosing object uses
  18316. transmit rather than filter for transparency, then the media
  18317. casts no shadows.  For example:
  18318.  
  18319.  object{MyObject pigment{rgbt 1.0} interior{media{MyMedia}}} //no
  18320. shadows
  18321.  object{MyObject pigment{rgbf 1.0} interior{media{MyMedia}}}
  18322. //shadows
  18323.  
  18324. 4.8.1     Media Types
  18325. There are three types of particle interaction in media:
  18326. absorbing, emitting, and scattering.  All three activities may
  18327. occur in a single media.  Each of these three specifications
  18328. requires a color.  Only the red, green, and blue components of
  18329. the color are used.  The filter and transmit values are ignored.
  18330. For this reason it is permissible to use one float value to
  18331. specify an intensity of white color.  For example the following
  18332. two lines are legal and produce the same results:
  18333.  
  18334.   emission 0.75
  18335.   emission rgb<0.75,0.75,0.75>
  18336.  
  18337. 4.8.1.1   Absorption
  18338. The absorption keyword specifies a color of light which is
  18339. absorbed when looking through the media.  For example absorption
  18340. rgb<0,1,0> blocks the green light but permits red and blue to get
  18341. through.  Therefore a white object behind the media will appear
  18342. magenta.
  18343.  
  18344. The default value is rgb<0,0,0> which means no light is absorbed
  18345. -- all light passes through normally.
  18346.  
  18347.  
  18348. 4.8.1.2   Emission
  18349. The emission keyword specifies a color of the light emitted from
  18350. the particles.  Although we say they "emit" light, this only
  18351. means that they are visible without any illumination shining on
  18352. them.  They to not really emit light that is cast on to nearby
  18353. objects.  This is similar to an object with high ambient values.
  18354. The default value is rgb<0,0,0> which means no light is emitted.
  18355.  
  18356.  
  18357. 4.8.1.3   Scattering
  18358. The syntax of a scattering statement is:
  18359.  
  18360. SCATTERING:
  18361.   scattering { Type, COLOR  [ eccentricity Value ] [ extinction
  18362.   Value ] }
  18363. The first float value specifies the type of scattering.  This is
  18364. followed by the color of the scattered light.  The default value
  18365. if no scattering statement is given is rgb<0,0,0> which means no
  18366. scattering occurs.
  18367.  
  18368. The scattering effect is only visible when light is shining on
  18369. the media from a light source.  This is similar to difuse
  18370. reflection off of an object.  In addition to reflecting light, a
  18371. scattering media also absorbs light like an absorption media.
  18372. The balance between how much absorption occurs for a given amount
  18373. of scattering is controlled by the optional extinction keyword
  18374. and a single float value.  The default value of 1.0 gives an
  18375. extinction effect that matches the scattering.  Values such as
  18376. extinction 0.25 give 25% the normal amount.  Using extinction 0.0
  18377. turns it off completely.  Any value other than the 1.0 default is
  18378. contrary to the real physical model but decreasing extinction can
  18379. give you more artistic flexibility.
  18380.  
  18381. The integer value Type specifies one of five different scattering
  18382. phase functions representing the different models: isotropic, Mie
  18383. (haze and murky atmosphere), Rayleigh, and Henyey-Greenstein.
  18384.  
  18385. Type 1, isotropic scattering is the simplest form of scattering
  18386. because it is independent of direction. The amount of light
  18387. scattered by particles in the atmosphere does not depend on the
  18388. angle between the viewing direction and the incoming light.
  18389.  
  18390. Types 2 and 3 are Mie haze and Mie murky scattering which are
  18391. used for relatively small particles such as minuscule water
  18392. droplets of fog, cloud particles, and particles responsible for
  18393. the polluted sky. In this model the scattering is extremely
  18394. directional in the forward direction i.e. the amount of scattered
  18395. light is largest when the incident light is anti-parallel to the
  18396. viewing direction (the light goes directly to the viewer). It is
  18397. smallest when the incident light is parallel to the viewing
  18398. direction. The haze and murky atmosphere models differ in their
  18399. scattering characteristics. The murky model is much more
  18400. directional than the haze model.
  18401.  
  18402.                                 
  18403.                                 
  18404.                The Mie "haze" scattering function.
  18405.                                 
  18406.                                 
  18407.                                 
  18408.               The Mie "murky" scattering function.
  18409.                                 
  18410. Type 3 Rayleigh scattering models the scattering for extremely
  18411. small particles such as molecules of the air. The amount of
  18412. scattered light depends on the incident light angle. It is
  18413. largest when the incident light is parallel or anti-parallel to
  18414. the viewing direction and smallest when the incident light is
  18415. perpendicular to the viewing direction. You should note that the
  18416. Rayleigh model used in POV-Ray does not take the dependency of
  18417. scattering on the wavelength into account.
  18418.  
  18419.                                 
  18420.                                 
  18421.                 The Rayleigh scattering function.
  18422.                                 
  18423. Type 5 is the Henyey-Greenstein scattering model.  It is based on
  18424. an analytical function and can be used to model a large variety
  18425. of different scattering types. The function models an ellipse
  18426. with a given eccentricity e. This eccentricity is specified by
  18427. the optional keyword eccentricity which is only used for
  18428. scattering type five. The default eccentricity value of zero
  18429. defines isotropic scattering while positive values lead to
  18430. scattering in the direction of the light and negative values lead
  18431. to scattering in the opposite direction of the light. Larger
  18432. values of e (or smaller values in the negative case) increase the
  18433. directional property of the scattering.
  18434.  
  18435.                                 
  18436.                                 
  18437.      The Heyney-Greenstein scattering function for different
  18438.                       eccentricity values.
  18439.                                 
  18440.  
  18441. 4.8.2     Sampling Parameters
  18442. Media effects are calculated by sampling the media along the path
  18443. of the ray.  It uses a method called Monte Carlo integration.
  18444. The intervals keyword may be used to specify the integer number
  18445. of intervals used to sample the ray.  The default number of
  18446. intervals is 10.  For object media the intervals are spread
  18447. between the entry and exit points as the ray passes through the
  18448. container object.  For atmospheric media, the intervals span
  18449. entire length of the ray from its start until it hits an object.
  18450.  
  18451. For media types which interact with spotlights or cylinder
  18452. lights, the intervals which are not illuminated by these light
  18453. types are weighted differently than the illuminated intervals
  18454. when distributing samples.  The ratio keyword distributes
  18455. intervals differently between lit and unlit areas.  The default
  18456. value of ratio 0.9 means that lit intervals get more samples than
  18457. unlit intervals.  Note that the total number of intervals must
  18458. exceed the number of illuminated intervals.  If a ray passes in
  18459. and out of 8 spotlights but you've only specified 5 intervals
  18460. then an error occurs.
  18461.  
  18462. The samples Min, Max keyword specifies the minimum and maximum
  18463. number of samples taken per interval.  The default values are
  18464. samples 1,1.
  18465.  
  18466. As each interval is sampled, the variance is computed.  If the
  18467. variance is below a threshold value, then no more samples are
  18468. needed.  The variance and confidence keywords specify the
  18469. permitted variance allowed and the confidence that you are within
  18470. that variance.  The exact calculations are quite complex and
  18471. involve chi-squared tests and other statistical principles too
  18472. messy to describe here.  The default values are varience 1.0/128
  18473. and confidence 0.9.  For slower more accurate results, decrease
  18474. the variance and increase the confidence.  Note however that the
  18475. maximum number of samples limits the calculations even if the
  18476. proper variance and confidence are never reached.
  18477.  
  18478.  
  18479. 4.8.3     Density
  18480. Particles of media are normally distributed in constant density
  18481. throughout the media.  However the density statement allows you
  18482. to vary the density across space using any of POV-Ray's pattern
  18483. functions such as those used in textures.  If no density
  18484. statement is given then the density remains a constant value of
  18485. 1.0 throughout the media.  More than one density may be specified
  18486. per media statement.  See "Multiple Density vs. Multiple Media".
  18487.  
  18488. The syntax for density is:
  18489.  
  18490. DENSITY:
  18491.   density { [DENSITY_IDENTIFIER] [DENSITY_TYPE]
  18492. [DENSITY_MODIFIER...]  }
  18493. DENSITY_TYPE:
  18494.   PATTERN_TYPE   |   COLOR
  18495. DENSITY_MODIFIER:
  18496.   PATTERN_MODIFIER   |   DENSITY_LIST   |
  18497.   color_map{ COLOR_MAP_BODY }   |   colour_map{ COLOR_MAP_BODY }
  18498.   |
  18499.   density_map{ DENSITY_MAP_BODY }
  18500. The density statement may begin with an optional density
  18501. identifier.  All subsequent values modify the defaults or the
  18502. values in the identifier.  The next item is a pattern type.  This
  18503. is any one of POV-Ray's pattern functions such as bozo, wood,
  18504. gradient, waves, etc.  Of particular usefulness are the
  18505. spherical, planar, cylindrical, and boxed patterns which were
  18506. previously available only for use with our discontinued halo
  18507. feature.  All patterns return a value from 0.0 to 1.0.  This
  18508. value is interpreted as the density of the media at that
  18509. particular point.  See "Patterns" for details on particular
  18510. pattern types.   Although a solid COLOR pattern is legal, in
  18511. general it is used only when the density statement is inside a
  18512. density_map.
  18513.  
  18514.  
  18515. 4.8.3.1   General Density Modifiers
  18516. A density statement may be modified by any of the general pattern
  18517. modifiers such as transformations, turbulence and warp.  See
  18518. "Pattern Modifiers" for details.  In addition there are several
  18519. density-specific modifiers which can be used.
  18520.  
  18521.  
  18522. 4.8.3.2   Density with color_map
  18523. Typically a media uses just one constant color throughout.  Even
  18524. if you vary the density, it is usually just one color which is
  18525. specified by the absorption, emission, or scattering keywords.
  18526. However when using emission to simulate fire or explosions, the
  18527. center of the flame (high density area) is typically brighter and
  18528. white or yellow.  The outer edge of the flame (less density)
  18529. fades to orange, red, or in some cases deep blue.  To model the
  18530. density-dependent change in color which is visible, you may
  18531. specify a color_map.  The pattern function returns a value from
  18532. 0.0 to 1.0 and the value is passed to the color map to compute
  18533. what color or blend of colors is used.  See "Color Maps" for
  18534. details on how pattern values work with color_map. This resulting
  18535. color is multiplied by the absorption, emission and scattering
  18536. color.  Currently there is no way to specify different color maps
  18537. for each media type within the same media statement.
  18538.  
  18539. Consider this example:
  18540.  
  18541.   media{
  18542.     emission 0.75
  18543.     scattering {1, 0.5}
  18544.     density { spherical
  18545.       color_map{
  18546.         [0.0 rgb <0,0,0.5>]
  18547.         [0.5 rgb <0.8, 0.8, 0.4>]
  18548.         [1.0 rgb <1,1,1>]
  18549.       }
  18550.     }
  18551.   }
  18552. The color map ranges from white at density 1.0 to bright yellow
  18553. at density 0.5 to deep blue at density 0.  Assume we sample a
  18554. point at density 0.5.  The emission is 0.75*<0.8,0.8,0.4> or
  18555. <0.6,0.6,0.3>.  Similarly the scattering color is
  18556. 0.5*<0.8,0.8,0.4> or <0.4,0.4,0.2>.
  18557.  
  18558. For block pattern types checker, hexagon, and brick you may
  18559. specify a color list such as this:
  18560.  
  18561.   density{checker rgb<1,0,0>, rgb<0,0,0>}
  18562. See "Color List Pigments" which describes how pigment uses a
  18563. color list.  The same principles apply when using them with
  18564. density.
  18565.  
  18566.  
  18567. 4.8.3.3   Density Maps and Density Lists
  18568. In addition to specifying blended colors with a color map you may
  18569. create a blend of densities using a density_map. The syntax for a
  18570. density map is identical to a color map except you specify a
  18571. density in each map entry (and not a color).
  18572.  
  18573. The syntax for density_map is as follows:
  18574.  
  18575. DENSITY_MAP:
  18576.   density_map{ DENSITY_MAP_BODY }
  18577. DENSITY_MAP_BODY:
  18578.   DENSITY_MAP_IDENTIFIER   |   DENSITY_MAP_ENTRY...
  18579. DENSITY_MAP_ENTRY:
  18580.   [ Value  DENSITY_BODY ]
  18581. Where Value is a float value between 0.0 and 1.0 inclusive and
  18582. each DENSITY_BODY is anything which can be inside a density{...}
  18583. statement.  The density keyword and {} braces need not be
  18584. specified.
  18585.  
  18586. Note that the [] brackets are part of the actual
  18587. DENSITY_MAP_ENTRY. They are not notational symbols denoting
  18588. optional parts. The brackets surround each entry in the density
  18589. map. There may be from 2 to 256 entries in the map.
  18590.  
  18591. Density maps may be nested to any level of complexity you desire.
  18592. The densities in a map may have color maps or density maps or any
  18593. type of density you want.
  18594.  
  18595. Entire densities may also be used with the block patterns such as
  18596. checker, hexagon and brick. For example...
  18597.  
  18598.   density {
  18599.     checker
  18600.     density { Flame scale .8 }
  18601.     density { Fire scale .5 }
  18602.   }
  18603. Note that in the case of block patterns the density wrapping is
  18604. required around the density information.
  18605.  
  18606. A density map is also used with the average density type. See
  18607. "Average" for details.
  18608.  
  18609. You may declare and use density map identifiers but the only way
  18610. to declare a density block pattern list is to declare a density
  18611. identifier for the entire density.
  18612.  
  18613.  
  18614. 4.8.3.4   Multiple Density vs. Multiple Media
  18615. It is possible to have more than one media specified per object
  18616. and it is legal to have more than one density per media.  The
  18617. effects are quite different.  Consider this example:
  18618.  
  18619.   object{MyObject
  18620.     pigment{rgbf 1}
  18621.     interior{
  18622.       media{
  18623.         density{Some_Density}
  18624.         density{Another_Density}
  18625.       }
  18626.     }
  18627.   }
  18628. As the media is sampled, calculations are performed for each
  18629. density pattern at each sample point.  The resulting samples are
  18630. multiplied together.  Suppose one density returned rgb<.8,.8,.4>
  18631. and the other returned rgb<.25,.25,0>.  The resulting color is
  18632. rgb<.2,.2,0>.  Note that in areas where one density returns zero,
  18633. it will wipe out the other density.  The end result is that only
  18634. density areas which overlap will be visible.  This is similar to
  18635. a CSG intersection operation.  Now consider
  18636.  
  18637.   object{MyObject
  18638.     pigment{rgbf 1}
  18639.     interior{
  18640.       media{
  18641.         density{Some_Density}
  18642.       }
  18643.       media{
  18644.         density{Another_Density}
  18645.       }
  18646.     }
  18647.   }
  18648. In this case each media is computed independently.  The resulting
  18649. colors are added together.  Suppose one density and media
  18650. returned rgb<.8,.8,.4> and the other returned rgb<.25,.25,0>.
  18651. The resulting color is rgb<1.05,1.05,.4>.  The end result is that
  18652. density areas which overlap will be especially bright and all
  18653. areas will be visible.  This is similar to a CSG union operation.
  18654. See the sample scene scenes/interior/media/media4.pov for an
  18655. example which illustrates this.
  18656.  
  18657.  
  18658.  
  18659. 4.9  Atmospheric Effects
  18660. Atmospheric effects are a loosely-knit group of features that
  18661. affect the background and/or the atmosphere enclosing the scene.
  18662. POV-Ray includes the ability to render a number of atmospheric
  18663. effects, such as fog, haze, mist, rainbows and skies.
  18664.  
  18665.  
  18666. 4.9.1     Atmospheric Media
  18667. Atmospheric effects such as fog, dust, haze, or visible gas may
  18668. be simulated by a media statement specified in the scene but not
  18669. attached to any object.  All areas not inside a non-hollow object
  18670. in the entire scene.  A very simple approach to add fog to a
  18671. scene is explained in section "Fog" however this kind of fog does
  18672. not interact with any light sources like media does. It will not
  18673. show light beams or other effects and is therefore not very
  18674. realistic.
  18675.  
  18676. The atmosphere media effect overcomes some of the fog's
  18677. limitations by calculating the interaction between light and the
  18678. particles in the atmosphere using volume sampling. Thus shaft of
  18679. light beams will become visible and objects will cast shadows
  18680. onto smoke or fog.
  18681.  
  18682. With spotlights you'll be able to create the best results because
  18683. their cone of light will become visible. Pointlights can be used
  18684. to create effects like street lights in fog. Lights can be made
  18685. to not interact with the atmosphere by adding media_interaction
  18686. off to the light source. They can be used to increase the overall
  18687. light level of the scene to make it look more realistic.
  18688.  
  18689. Complete details on media are given in the section "Media".
  18690. Earlier versions of POV-Ray used an atmosphere statement for
  18691. atmospheric effects but that system was incompatible with the old
  18692. object halo system.  So atmosphere has been eliminated and
  18693. replaced with a simpler and more powerful media feature.  The
  18694. user now only has to learn one media system for either
  18695. atmospheric or object use.
  18696.  
  18697. If you only want media effects in a particular area, you should
  18698. use object media rather than only relying upon the media pattern.
  18699. In general it will be faster and more accurate because it only
  18700. calculates inside the constraining object.
  18701.  
  18702. You should note that the atmosphere feature will not work if the
  18703. camera is inside a non-hollow object (see section "Empty and
  18704. Solid Objects" for a detailed explanation).
  18705.  
  18706.  
  18707. 4.9.2     Background
  18708. A background color can be specified if desired. Any ray that
  18709. doesn't hit an object will be colored with this color. The
  18710. default background is black. The syntax for background is:
  18711.  
  18712. BACKGROUND:
  18713.   background {COLOR}
  18714.  
  18715. 4.9.3     Fog
  18716. If it is not necessary for light beams to interact with
  18717. atmospheric media, then fog may be a faster way to simulate haze
  18718. or fog.  This feature artificially adds color to every pixel
  18719. based on the distance the ray has traveled.  The syntax for fog
  18720. is:
  18721.  
  18722. FOG:
  18723.   fog { [FOG_IDENTIFIER] [FOG_ITEMS...] }
  18724. FOG_ITEMS:
  18725.   fog_type Fog_Type   |   distance Distance   |   COLOR   |
  18726.   turbulence <Turbulence>   |   turb_depth Turb_Depth   |
  18727.   omega Omega   |   lambda Lambda   |   octaves Octaves   |
  18728.   fog_offset Fog_Offset   |   fog_alt Fog_Alt   |
  18729.   up <Fog_Up>   |   TRANSFORMATION
  18730. Currently there are two fog types, the default fog_type 1 is a
  18731. constant fog and fog_type 2 is ground fog. The constant fog has a
  18732. constant density everywhere while the ground fog has a constant
  18733. density for all heights below a given point on the up axis and
  18734. thins out along this axis.
  18735.  
  18736. The color of a pixel with an intersection depth d is calculated
  18737. by
  18738.  
  18739.   PIXEL_COLOR = exp(-d/D) * OBJECT_COLOR + (1-exp(-d/D)) *
  18740. FOG_COLOR
  18741.  
  18742. where D is the specified value of the required fog distance
  18743. keyword. At depth 0 the final color is the object's color. If the
  18744. intersection depth equals the fog distance the final color
  18745. consists of 64% of the object's color and 36% of the fog's color.
  18746.  
  18747. For ground fog, the height below which the fog has constant
  18748. density is specified by the fog_offset keyword. The fog_alt
  18749. keyword is used to specify the rate by which the fog fades away.
  18750. The default values for both are 0.0 so be sure to specify them if
  18751. ground fog is used.  At an altitude of Fog_Offset+Fog_Alt the fog
  18752. has a density of 25%. The density of the fog at height less than
  18753. or equal to Fog_Alt is 1.0 and for height y less than Fog_Alt is
  18754. calculated by
  18755.  
  18756.   1/(1 + (y - Fog_Offset) / Fog_Alt) ^2)
  18757.  
  18758. The total density along a ray is calculated by integrating from
  18759. the height of the starting point to the height of the end point.
  18760.  
  18761. The optional up vector specifies a direction pointing up,
  18762. generally the same as the camera's up vector. All calculations
  18763. done during the ground fog evaluation are done relative to this
  18764. up vector, i. e. the actual heights are calculated along this
  18765. vector. The up vector can also be modified using any of the known
  18766. transformations described in "Transformations". Though it may not
  18767. be a good idea to scale the up vector - the results are hardly
  18768. predictable - it is quite useful to be able to rotate it. You
  18769. should also note that translations do not affect the up direction
  18770. (and thus don't affect the fog).
  18771.  
  18772. The required fog color has three purposes. First it defines the
  18773. color to be used in blending the fog and the background. Second
  18774. it is used to specify a translucency threshold. By using a
  18775. transmittance larger than zero one can make sure that at least
  18776. that amount of light will be seen through the fog.  With a
  18777. transmittance of 0.3 you'll see at least 30% of the background.
  18778. Third it can be used to make a filtering fog. With a filter value
  18779. larger than zero the amount of background light given by the
  18780. filter value will be multiplied with the fog color. A filter
  18781. value of 0.7 will lead to a fog that filters 70% of the
  18782. background light and leaves 30% unfiltered.
  18783.  
  18784. Fogs may be layered. That is, you can apply as many layers of fog
  18785. as you like. Generally this is most effective if each layer is a
  18786. ground fog of different color, altitude and with different
  18787. turbulence values. To use multiple layers of fogs, just add all
  18788. of them to the scene.
  18789.  
  18790. You may optionally stir up the fog by adding turbulence. The
  18791. turbulence keyword may be followed by a float or vector to
  18792. specify an amount of turbulence to be used. The omega, lambda and
  18793. octaves turbulence parameters may also be specified. See section
  18794. "Pattern Modifiers" for details on all of these turbulence
  18795. parameters.
  18796.  
  18797. Additionally the fog turbulence may be scaled along the direction
  18798. of the viewing ray using the turb_depth amount. Typical values
  18799. are from 0.0 to 1.0 or more. The default value is 0.5 but any
  18800. float value may be used.
  18801.  
  18802. You should note that the fog feature will not work if the camera
  18803. is inside a non-hollow object (see section "Empty and Solid
  18804. Objects" for a detailed explanation).
  18805.  
  18806.  
  18807. 4.9.4     Sky Sphere
  18808. The sky sphere is used create a realistic sky background without
  18809. the need of an additional sphere to simulate the sky. Its syntax
  18810. is:
  18811.  
  18812. SKY_SPHERE:
  18813.   sky_sphere { [SKY_SPHERE_IDENTIFIER] [SKY_SPHERE_ITEMS...] }
  18814. SKY_SPHERE_ITEM:
  18815.   PIGMENT   |   TRANSFORMATION
  18816. The sky sphere can contain several pigment layers with the last
  18817. pigment being at the top, i. e. it is evaluated last, and the
  18818. first pigment being at the bottom, i. e. it is evaluated first.
  18819. If the upper layers contain filtering and/or transmitting
  18820. components lower layers will shine through. If not lower layers
  18821. will be invisible.
  18822.  
  18823. The sky sphere is calculated by using the direction vector as the
  18824. parameter for evaluating the pigment patterns. This leads to
  18825. results independent from the view point which pretty good models
  18826. a real sky where the distance to the sky is much larger than the
  18827. distances between visible objects.
  18828.  
  18829. If you want to add a nice color blend to your background you can
  18830. easily do this by using the following example.
  18831.  
  18832.   sky_sphere {
  18833.     pigment {
  18834.       gradient y
  18835.       color_map {
  18836.         [ 0.5  color CornflowerBlue ]
  18837.         [ 1.0  color MidnightBlue ]
  18838.       }
  18839.       scale 2
  18840.       translate -1
  18841.     }
  18842.   }
  18843. This gives a soft blend from CornflowerBlue at the horizon to
  18844. MidnightBlue at the zenith. The scale and translate operations
  18845. are used to map the direction vector values, which lie in the
  18846. range from <-1, -1, -1> to <1, 1, 1>, onto the range from <0, 0,
  18847. 0> to <1, 1, 1>. Thus a repetition of the color blend is avoided
  18848. for parts of the sky below the horizon.
  18849.  
  18850. In order to easily animate a sky sphere you can transform it
  18851. using the usual transformations described in "Transformations".
  18852. Though it may not be a good idea to translate or scale a sky
  18853. sphere - the results are hardly predictable - it is quite useful
  18854. to be able to rotate it. In an animation the color blendings of
  18855. the sky can be made to follow the rising sun for example.
  18856.  
  18857. You should note that only one sky sphere can be used in any
  18858. scene. It also will not work as you might expect if you use
  18859. camera types like the orthographic or cylindrical camera. The
  18860. orthographic camera uses parallel rays and thus you'll only see a
  18861. very small part of the sky sphere (you'll get one color skies in
  18862. most cases). Reflections in curved surface will work though, e.
  18863. g. you will clearly see the sky in a mirrored ball.
  18864.  
  18865.  
  18866. 4.9.5     Rainbow
  18867. Rainbows are implemented using fog-like, circular arcs. Their
  18868. syntax is:
  18869.  
  18870. RAINBOW:
  18871.   rainbow { [RAINBOW_IDENTIFIER] [RAINBOW_ITEMS...] }
  18872. RAINBOW_ITEM:
  18873.   direction <Dir>   |   angle Angle   |   width Width   |
  18874. distance Distance   |
  18875.   COLOR_MAP   |   jitter Jitter   |   up <Up>   |
  18876.   arc_angle Arc_Angle   |   falloff_angle Falloff_Angle
  18877. The required direction vector determines the direction of the
  18878. (virtual) light that is responsible for the rainbow. Ideally this
  18879. is an infinitely far away light source like the sun that emits
  18880. parallel light rays. The position and size of the rainbow are
  18881. specified by the required angle and width keywords. To understand
  18882. how they work you should first know how the rainbow is
  18883. calculated.
  18884.  
  18885. For each ray the angle between the rainbow's direction vector and
  18886. the ray's direction vector is calculated. If this angle lies in
  18887. the interval from Angle-Width/2 to Angle+Width/2 the rainbow is
  18888. hit by the ray. The color is then determined by using the angle
  18889. as an index into the rainbow's color_map. After the color has
  18890. been determined it will be mixed with the background color in the
  18891. same way like it is done for fogs.
  18892.  
  18893. Thus the angle and width parameters determine the angles under
  18894. which the rainbow will be seen. The optional jitter keyword can
  18895. be used to add random noise to the index. This adds some
  18896. irregularity to the rainbow that makes it look more realistic.
  18897.  
  18898. The required distance keyword is the same like the one used with
  18899. fogs. Since the rainbow is a fog-like effect it's possible that
  18900. the rainbow is noticeable on objects. If this effect is not
  18901. wanted it can be avoided by using a large distance value. By
  18902. default a sufficiently large value is used to make sure that this
  18903. effect does not occur.
  18904.  
  18905. The color_map statement is used to assign a color map that will
  18906. be mapped onto the rainbow. To be able to create realistic
  18907. rainbows it is important to know that the index into the color
  18908. map increases with the angle between the ray's and rainbow's
  18909. direction vector. The index is zero at the innermost ring and one
  18910. at the outermost ring. The filter and transmittance values of the
  18911. colors in the color map have the same meaning as the ones used
  18912. with fogs (see section "Fog").
  18913.  
  18914. The default rainbow is a 360 degree arc that looks like a circle.
  18915. This is no problem as long as you have a ground plane that hides
  18916. the lower, non-visible part of the rainbow. If this isn't the
  18917. case or if you don't want the full arc to be visible you can use
  18918. the optional keywords up, arc_angle and falloff_angle to specify
  18919. a smaller arc.
  18920.  
  18921. The arc_angle keyword determines the size of the arc in degrees
  18922. (from 0 to 360 degrees). A value smaller than 360 degrees results
  18923. in an arc that abruptly vanishes. Since this doesn't look nice
  18924. you can use the falloff_angle keyword to specify a region in
  18925. which the rainbow will smoothly blend into the background making
  18926. it vanish softly. The falloff angle has to be smaller or equal to
  18927. the arc angle.
  18928.  
  18929. The up keyword determines were the zero angle position is. By
  18930. changing this vector you can rotate the rainbow about its
  18931. direction. You should note that the arc goes from -Arc_Angle/2 to
  18932. +Arc_Angle/2. The soft regions go from -Arc_Angle/2 to -
  18933. Falloff_Angle/2 and from +Falloff_Angle/2 to +Arc_Angle/2.
  18934.  
  18935. The following example generates a 120 degrees rainbow arc that
  18936. has a falloff region of 30 degrees at both ends:
  18937.  
  18938.   rainbow {
  18939.     direction <0, 0, 1>
  18940.     angle 42.5
  18941.     width 5
  18942.     distance 1000
  18943.     jitter 0.01
  18944.     color_map { Rainbow_Color_Map }
  18945.     up <0, 1, 0>
  18946.     arc_angle 120
  18947.     falloff_angle 30
  18948.   }
  18949. It is possible to use any number of rainbows and to combine them
  18950. with other atmospheric effects.
  18951.  
  18952.  
  18953.  
  18954.  
  18955.  
  18956. 4.10  C4A-Global Settings
  18957. The global_settings statement is a catch-all statement that
  18958. gathers together a number of global parameters. The statement may
  18959. appear anywhere in a scene as long as it is not inside any other
  18960. statement. You may have multiple global_settings statements in a
  18961. scene. Whatever values were specified in the last global_settings
  18962. statement override any previous settings.  Regardless of where
  18963. you specify the statement, the feature applies to the entire
  18964. scene.
  18965.  
  18966. Note that some items which were language directives in earlier
  18967. versions of POV-Ray have been moved inside the global_settings
  18968. statement so that it is more obvious to the user that their
  18969. effect is global. The old syntax is permitted but generates a
  18970. warning.  The new syntax is:
  18971.  
  18972. GLOBAL_SETTINGS:
  18973.   global_settings { [GLOBAL_SETTINGS_ITEMS...] }
  18974. GLOBAL_SETTINGS_ITEM:
  18975.   adc_bailout Value   |   ambient_light COLOR   |
  18976.   assumed_gamma Value   |
  18977.   hf_gray_16 [Bool}   |   irid_wavelength COLOR   |
  18978.   max_intersections Number   |
  18979.   max_trace_level Number   |   number_of_waves Number   |
  18980.   radiosity { RADIOSITY_ITEMS... }
  18981. Each item is optional and may appear in and order. If an item is
  18982. specified more than once, the last setting overrides previous
  18983. values. Details on each item are given in the following sections.
  18984.  
  18985.  
  18986. 4.10.1     ADC_Bailout
  18987. In scenes with many reflective and transparent surfaces, POV-Ray
  18988. can get bogged down tracing multiple reflections and refractions
  18989. that contribute very little to the color of a particular pixel.
  18990. The program uses a system called Adaptive Depth Control (ADC) to
  18991. stop computing additional reflected or refracted rays when their
  18992. contribution is insignificant.
  18993.  
  18994. You may use the global setting adc_bailout keyword followed by
  18995. float value to specify the point at which a ray's contribution is
  18996. considered insignificant.  For example:
  18997.  
  18998.   global_settings { adc_bailout 0.01 }
  18999. The default value is 1/255, or approximately 0.0039, since a
  19000. change smaller than that could not be visible in a 24 bit image.
  19001. Generally this setting is perfectly adequate and should be left
  19002. alone. Setting adc_bailout to 0 will disable ADC, relying
  19003. completely on max_trace_level to set an upper limit on the number
  19004. of rays spawned.
  19005.  
  19006. See section "Max_Trace_Level" for details on how ADC and
  19007. max_trace_level interact.
  19008.  
  19009.  
  19010. 4.10.2     Ambient Light
  19011. Ambient light is used to simulate the effect of inter-diffuse
  19012. reflection that is responsible for lighting areas that partially
  19013. or completely lie in shadow.  POV-Ray provides the ambient_light
  19014. keyword to let you easily change the brightness of the ambient
  19015. lighting without changing every ambient value in all finish
  19016. statements. It also lets you create interesting effects by
  19017. changing the color of the ambient light source. The syntax is:
  19018.  
  19019.   global_settings { ambient_light COLOR }
  19020. The default is a white ambient light source set at rgb <1,1,1>.
  19021. Only the rgb components are used.  The actual ambient used is:
  19022. Ambient = Finish_Ambient * Global_Ambient.
  19023.  
  19024. See section "Ambient" for more information.
  19025.  
  19026.  
  19027. 4.10.3     Assumed_Gamma
  19028. Many people may have noticed at one time or another that some
  19029. images are too bright or dim when displayed on their system. As a
  19030. rule, Macintosh users find that images created on a PC are too
  19031. bright, while PC users find that images created on a Macintosh
  19032. are too dim.
  19033.  
  19034. The assumed_gamma global setting works in conjunction with the
  19035. Display_Gamma INI setting (see section "Display Hardware
  19036. Settings") to ensure that scene files render the same way across
  19037. the wide variety of hardware platforms that POV-Ray is used on.
  19038. The assumed gamma setting is used in a scene file by adding
  19039.  
  19040.   global_settings { assumed_gamma Value }
  19041. where the assumed gamma value is the correction factor to be
  19042. applied before the pixels are displayed and/or saved to disk. For
  19043. scenes created in older versions of POV-Ray, the assumed gamma
  19044. value will be the same as the display gamma value of the system
  19045. the scene was created on. For PC systems, the most common display
  19046. gamma is 2.2, while for scenes created on Macintosh systems
  19047. should use a scene gamma of 1.8. Another gamma value that
  19048. sometimes occurs in scenes is 1.0.
  19049.  
  19050. Scenes that do not have an assumed_gamma global setting will not
  19051. have any gamma correction performed on them, for compatibility
  19052. reasons. If you are creating new scenes or rendering old scenes,
  19053. it is strongly recommended that you put in an appropriate
  19054. assumed_gamma global setting. For new scenes, you should use an
  19055. assumed gamma value of 1.0 as this models how light appears in
  19056. the real world more realistically.
  19057.  
  19058. The following sections explain more thoroughly what gamma is and
  19059. why it is important.
  19060.  
  19061.  
  19062. 4.10.3.1   Monitor Gamma
  19063. The differences in how images are displayed is a result of how a
  19064. computer actually takes an image and displays it on the monitor.
  19065. In the process of rendering an image and displaying it on the
  19066. screen, several gamma values are important, including the POV
  19067. scene file or image file gamma and the monitor gamma.
  19068.  
  19069. Most image files generated by POV-Ray store numbers in the range
  19070. from 0 to 255 for each of the red, green and blue components of a
  19071. pixel. These numbers represent the intensity of each color
  19072. component, with 0 being black and 255 being the brightest color
  19073. (either 100% red, 100% green or 100% blue). When an image is
  19074. displayed, the graphics card converts each color component into a
  19075. voltage which is sent to the monitor to light up the red, green
  19076. and blue phosphors on the screen.  The voltage is usually
  19077. proportional to the value of each color component.
  19078.  
  19079. Gamma becomes important when displaying intensities that aren't
  19080. the maximum or minimum possible values. For example, 127 should
  19081. represent 50% of the maximum intensity for pixels stored as
  19082. numbers between 0 and 255. On systems that don't do gamma
  19083. correction, 127 will be converted to 50% of the maximum voltage,
  19084. but because of the way the phosphors and the electron guns in a
  19085. monitor work, this may be only 22% of the maximum color intensity
  19086. on a monitor with a gamma of 2.2.  To display a pixel which is
  19087. 50% of the maximum intensity on this monitor, we would need a
  19088. voltage of 73% of the maximum voltage, which translates to
  19089. storing a pixel value of 186.
  19090.  
  19091. The relationship between the input pixel value and the displayed
  19092. intensity can be approximated by an exponential function obright
  19093. = ibright ^ display_gamma where obright is the output intensity
  19094. and ibright is the input pixel intensity. Both values are in the
  19095. range from 0 to 1 (0% to 100%). Most monitors have a fixed gamma
  19096. value in the range from 1.8 to 2.6. Using the above formula with
  19097. display_gamma values greater than 1 means that the output
  19098. brightness will be less than the input brightness. In order to
  19099. have the output and input brightness be equal an overall system
  19100. gamma of 1 is needed. To do this, we need to gamma correct the
  19101. input brightness in the same manner as above but with a gamma
  19102. value of 1/display_gamma before it is sent to the monitor. To
  19103. correct for a display gamma of 2.2, this pre-monitor gamma
  19104. correction uses a gamma value of 1.0/2.2 or approximately 0.45.
  19105.  
  19106. How the pre-monitor gamma correction is done depends on what
  19107. hardware and software is being used. On Macintosh systems, the
  19108. operating system has taken it upon itself to insulate
  19109. applications from the differences in display hardware. Through a
  19110. gamma control panel the user may be able to set the actual
  19111. monitor gamma and Mac will then convert all pixel intensities so
  19112. that the monitor will appear to have the specified gamma value.
  19113. On Silicon Graphics machines, the display adapter has built-in
  19114. gamma correction calibrated to the monitor which gives the
  19115. desired overall gamma (the default is 1.7). Unfortunately, on PCs
  19116. and most UNIX systems, it is up to the application to do any
  19117. gamma correction needed.
  19118.  
  19119.  
  19120. 4.10.3.2   Image File Gamma
  19121. Since most PC and UNIX applications and image file formats don't
  19122. understand display gamma, they don't do anything to correct for
  19123. it.  As a result, users creating images on these systems adjust
  19124. the image in such a way that it has the correct brightness when
  19125. displayed. This means that the data values stored in the files
  19126. are made brighter to compensate for the darkening effect of the
  19127. monitor. In essence, the 0.45 gamma correction is built in to the
  19128. image files created and stored on these systems. When these files
  19129. are displayed on a Macintosh system, the gamma correction built
  19130. in to the file, in addition to gamma correction built into MacOS,
  19131. means that the image will be too bright. Similarly, files that
  19132. look correct on Macintosh or SGI systems because of the built-in
  19133. gamma correction will be too dark when displayed on a PC.
  19134.  
  19135. The new PNG format files generated by POV-Ray 3.0 overcome the
  19136. problem of too much or not enough gamma correction by storing the
  19137. image file gamma (which is 1.0/display_gamma) inside the PNG file
  19138. when it is generated by POV-Ray. When the PNG file is later
  19139. displayed by a program that has been set up correctly, it uses
  19140. this gamma value as well as the current display gamma to correct
  19141. for the potentially different display gamma used when originally
  19142. creating the image.
  19143.  
  19144. Unfortunately, of all the image file formats POV-Ray supports,
  19145. PNG is the only one that has any gamma correction features and is
  19146. therefore preferred for images that will be displayed on a wide
  19147. variety of platforms.
  19148.  
  19149.  
  19150. 4.10.3.3   Scene File Gamma
  19151. The image file gamma problem itself is just a result of how
  19152. scenes themselves are generated in POV-Ray. When you start out
  19153. with a new scene and are placing light sources and adjusting
  19154. surface textures and colors, you generally make several attempts
  19155. before the lighting is how you like it. How you choose these
  19156. settings depends upon the preview image or the image file stored
  19157. to disk, which in turn is dependent upon the overall gamma of the
  19158. display hardware being used.
  19159.  
  19160. This means that as the artist you are doing gamma correction in
  19161. the POV-Ray scene file for your particular hardware. This scene
  19162. file will generate an image file that is also gamma corrected for
  19163. your hardware and will display correctly on systems similar to
  19164. your own.  However, when this scene is rendered on another
  19165. platform, it may be too bright or too dim, regardless of the
  19166. output file format used.  Rather than have you change all the
  19167. scene files to have a single fixed gamma value (heaven forbid!),
  19168. POV-Ray 3.0 allows you to specify in the scene file the display
  19169. gamma of the system that the scene was created on.
  19170.  
  19171. The assumed_gamma global setting, in conjunction with the
  19172. Display_Gamma INI setting lets POV-Ray know how to do gamma
  19173. correction on a given scene so that the preview and output image
  19174. files will appear the correct brightness on any system. Since the
  19175. gamma correction is done internally to POV-Ray, it will produce
  19176. output image files that are the correct brightness for the
  19177. current display, regardless of what output format is used. As
  19178. well, since the gamma correction is performed in the high-
  19179. precision data format that POV-Ray uses internally, it produces
  19180. better results than gamma correction done after the file is
  19181. written to disk.
  19182.  
  19183. Although you may not notice any difference in the output on your
  19184. system with and without an assumed_gamma setting, the assumed
  19185. gamma is important if the scene is ever rendered on another
  19186. platform.
  19187.  
  19188.  
  19189. 4.10.4     HF_Gray_16
  19190. The hf_gray_16 setting is useful when using POV-Ray to generate
  19191. heightfields for use in other POV-Ray scenes. The syntax is...
  19192.  
  19193.   global_settings { hf_gray_16 [Bool] }
  19194. The boolean value turns the option on or off. If the keyword is
  19195. specified without the boolean value then the option is turned on.
  19196. If hf_gray_16 is not specified in any global_settings statement
  19197. in the entire scene then the default is off.
  19198.  
  19199. When hf_gray_16 is on, the output file will be in the form of a
  19200. heightfield, with the height at any point being dependent on the
  19201. brightness of the pixel. The brightness of a pixel is calculated
  19202. in the same way that color images are converted to grayscale
  19203. images:  height = 0.3 * red + 0.59 * green + 0.11 * blue.
  19204.  
  19205. Setting the hf_gray_16 option will cause the preview display, if
  19206. used, to be grayscale rather than color. This is to allow you to
  19207. see how the heightfield will look because some file formats store
  19208. heightfields in a way that is difficult to understand afterwards.
  19209. See section "Height Field" for a description of how POV-Ray
  19210. heightfields are stored for each file type.
  19211.  
  19212.  
  19213. 4.10.5     Irid_Wavelength
  19214. Iridescence calculations depend upon the dominant wavelengths of
  19215. the primary colors of red, green and blue light. You may adjust
  19216. the values using the global setting irid_wavelength as follows...
  19217.  
  19218.   global_settings { irid_wavelength COLOR }
  19219. The default value is rgb <0.25,0.18,0.14> and any filter or
  19220. transmit values are ignored. These values are proportional to the
  19221. wavelength of light but they represent no real world units.
  19222.  
  19223. In general, the default values should prove adequate but we
  19224. provide this option as a means to experiment with other values.
  19225.  
  19226.  
  19227. 4.10.6     Max_Trace_Level
  19228. In scenes with many reflective and transparent surfaces POV-Ray
  19229. can get bogged down tracing multiple reflections and refractions
  19230. that contribute very little to the color of a particular pixel.
  19231. The global setting max_trace_level defines the integer maximum
  19232. number of recursive levels that POV-Ray will trace a ray.
  19233.  
  19234.   global_settings { max_trace_level Level }
  19235. This is used when a ray is reflected or is passing through a
  19236. transparent object and when shadow rays are cast. When a ray hits
  19237. a reflective surface, it spawns another ray to see what that
  19238. point reflects. That is trace level one. If it hits another
  19239. reflective surface another ray is spawned and it goes to trace
  19240. level two.  The maximum level by default is five.
  19241.  
  19242. One speed enhancement added to POV-Ray in version 3.0 is Adaptive
  19243. Depth Control (ADC). Each time a new ray is spawned as a result
  19244. of reflection or refraction its contribution to the overall color
  19245. of the pixel is reduced by the amount of reflection or the filter
  19246. value of the refractive surface. At some point this contribution
  19247. can be considered to be insignificant and there is no point in
  19248. tracing any more rays. Adaptive depth control is what tracks this
  19249. contribution and makes the decision of when to bail out. On
  19250. scenes that use a lot of partially reflective or refractive
  19251. surfaces this can result in a considerable reduction in the
  19252. number of rays fired and makes it safer to use much higher
  19253. max_trace_level values.
  19254.  
  19255. This reduction in color contribution is a result of scaling by
  19256. the reflection amount and/or the filter values of each surface,
  19257. so a perfect mirror or perfectly clear surface will not be
  19258. optimizable by ADC. You can see the results of ADC by watching
  19259. the Rays Saved and Highest Trace Level displays on the statistics
  19260. screen.
  19261.  
  19262. The point at which a ray's contribution is considered
  19263. insignificant is controlled by the adc_bailout value. The default
  19264. is 1/255 or approximately 0.0039 since a change smaller than that
  19265. could not be visible in a 24 bit image.  Generally this setting
  19266. is perfectly adequate and should be left alone. Setting
  19267. adc_bailout to 0 will disable ADC, relying completely on
  19268. max_trace_level to set an upper limit on the number of rays
  19269. spawned.
  19270.  
  19271. If max_trace_level is reached before a non-reflecting surface is
  19272. found and if ADC hasn't allowed an early exit from the ray tree
  19273. the color is returned as black. Raise max_trace_level if you see
  19274. black areas in a reflective surface where there should be a
  19275. color.
  19276.  
  19277. The other symptom you could see is with transparent objects. For
  19278. instance, try making a union of concentric spheres with a clear
  19279. texture on them. Make ten of them in the union with radius's from
  19280. 1 to 10 and render the scene. The image will show the first few
  19281. spheres correctly, then black. This is because a new level is
  19282. used every time you pass through a transparent surface. Raise
  19283. max_trace_level to fix this problem.
  19284.  
  19285. Note that raising max_trace_level will use more memory and time
  19286. and it could cause the program to crash with a stack overflow
  19287. error, although ADC will alleviate this to a large extent. Values
  19288. for max_trace_level are not restricted, so it can be set to any
  19289. number as long as you have the time and memory. However,
  19290. increasing its setting does not necessarily equate to increased
  19291. image quality unless such depths are really needed by the scene.
  19292.  
  19293.  
  19294. 4.10.7     Max_Intersections
  19295. POV-Ray uses a set of internal stacks to collect ray/object
  19296. intersection points. The usual maximum number of entries in these
  19297. I-Stacks is 64. Complex scenes may cause these stacks to
  19298. overflow.  POV-Ray doesn't stop but it may incorrectly render
  19299. your scene. When POV-Ray finishes rendering, a number of
  19300. statistics are displayed. If you see I-Stack Overflows reported
  19301. in the statistics you should increase the stack size. Add a
  19302. global setting to your scene as follows:
  19303.  
  19304.   global_settings { max_intersections Integer }
  19305. If the I-Stack Overflows remain increase this value until they
  19306. stop.
  19307.  
  19308.  
  19309. 4.10.8     Number_Of_Waves
  19310. The waves and ripples pattern are generated by summing a series
  19311. of waves, each with a slightly different center and size. By
  19312. default, ten waves are summed but this amount can be globally
  19313. controlled by changing the number_of_waves setting.
  19314.  
  19315.   global_settings { number_of_waves Integer }
  19316. Changing this value affects both waves and ripples alike on all
  19317. patterns in the scene.
  19318.  
  19319.  
  19320. 4.10.9     Radiosity
  19321. Important notice: The radiosity features in POV-Ray are somewhat
  19322. experimental. There is a high probability that the design and
  19323. implementation of these features will be changed in future
  19324. versions. We cannot guarantee that scenes using these features in
  19325. this version will render identically in future releases or that
  19326. full backwards compatibility of language syntax can be
  19327. maintained.
  19328.  
  19329. Radiosity is an extra calculation that more realistically
  19330. computes the diffuse interreflection of light. This diffuse
  19331. interreflection can be seen if you place a white chair in a room
  19332. full of blue carpet, blue walls and blue curtains. The chair will
  19333. pick up a blue tint from light reflecting off of other parts of
  19334. the room. Also notice that the shadowed areas of your
  19335. surroundings are not totally dark even if no light source shines
  19336. directly on the surface. Diffuse light reflecting off of other
  19337. objects fills in the shadows. Typically ray-tracing uses a trick
  19338. called ambient light to simulate such effects but it is not very
  19339. accurate.
  19340.  
  19341. Radiosity is more accurate than simplistic ambient light but it
  19342. takes much longer to compute. For this reason, POV-Ray does not
  19343. use radiosity by default. Radiosity is turned on using the
  19344. Radiosity INI file option or the +QR command line switch.
  19345.  
  19346. The following sections describes how radiosity works, how to
  19347. control it with various global settings and tips on trading
  19348. quality vs.  speed.
  19349.  
  19350.  
  19351. 4.10.9.1   How Radiosity Works
  19352. The problem of ray-tracing is to figure out what the light level
  19353. is at each point that you can see in a scene. Traditionally, in
  19354. ray tracing, this is broken into the sum of these components:
  19355.  
  19356.   -  Diffuse, the effect that makes the side of things facing the
  19357.   light brighter;
  19358.   -  Specular, the effect that makes shiny things have dings or
  19359.   sparkles on them;
  19360.   -  Reflection, the effect that mirrors give; and
  19361.   -  Ambient, the general all-over light level that any scene
  19362.   has, which keeps things in shadow from being pure black.
  19363. POV-Ray's radiosity system, based on a method by Greg Ward,
  19364. provides a way to replace the last term - the constant ambient
  19365. light value - with a light level which is based on what surfaces
  19366. are nearby and how bright in turn they are.
  19367.  
  19368. The first thing you might notice about this definition is that it
  19369. is circular: the light of everything is dependent on everything
  19370. else and vice versa. This is true in real life but in the world
  19371. of ray-tracing, we can make an approximation. The approximation
  19372. that is used is: the objects you are looking at have their
  19373. ambient values calculated for you by checking the other objects
  19374. nearby. When those objects are checked during this process,
  19375. however, a traditional constant ambient term is used.
  19376.  
  19377. How does POV-Ray calculate the ambient term for each point? By
  19378. sending out more rays, in many different directions, and
  19379. averaging the results. A typical point might use 200 or more rays
  19380. to calculate its ambient light level correctly.
  19381.  
  19382. Now this sounds like it would make the ray-tracer 200 times
  19383. slower. This is true, except that the software takes advantage of
  19384. the fact that ambient light levels change quite slowly (remember,
  19385. shadows are calculated separately, so sharp shadow edges are not
  19386. a problem). Therefore, these extra rays are sent out only once in
  19387. a while (about 1 time in 50), then these calculated values are
  19388. saved and reused for nearby pixels in the image when possible.
  19389.  
  19390. This process of saving and reusing values is what causes the need
  19391. for a variety of tuning parameters, so you can get the scene to
  19392. look just the way you want.
  19393.  
  19394.  
  19395. 4.10.9.2   Adjusting Radiosity
  19396. As described earlier, radiosity is turned on by using the
  19397. Radiosity INI file option or the +QR command line switch. However
  19398. radiosity has many parameters that are specified in a radiosity
  19399. statement inside a global_settings statement as follows:
  19400.  
  19401.   global_settings { radiosity { [RADIOSITY_ITEMS...] }}
  19402. RADIOSITY_ITEMS:
  19403.   brightness Float   |   count Integer   |   distance_maximum
  19404.   Float   |
  19405.   error_bound Float   |   gray_threshold Float   |
  19406.   low_error_factor Float   |
  19407.   minimum_reuse Float   |   nearest_count Integer   |
  19408.   recursion_limit Integer
  19409. Each item is optional and may appear in and order. If an item is
  19410. specified more than once the last setting overrides previous
  19411. values. Details on each item is given in the following sections.
  19412.  
  19413.  
  19414. 4.10.9.2.1 brightness
  19415. This brightness keyword specifies a float value that is the
  19416. degree to which ambient values are brightened before being
  19417. returned upwards to the rest of the system. If an object is red
  19418. rgb<1,0 0>, with an ambient value of 0.3, in normal situations a
  19419. red component of 0.3 will be added in. With radiosity on, assume
  19420. it was surrounded by an object of gray color rgb<0.6,0.6,0.6>.
  19421. The average color returned by the gathering process will be the
  19422. same. This will be multiplied by the texture's ambient weight
  19423. value of 0.3, returning rgb<0.18,0.18,0.18>. This is much darker
  19424. than the 0.3 which would be added in normally. Therefore, all
  19425. returned values are brightened by the inverse of the average of
  19426. the calculated values, so the average ambient added in does not
  19427. change.  Some will be higher than specified (higher than 0.3 in
  19428. this example) and some will be lower but the overall scene
  19429. brightness will be unchanged.  The default value is 3.3.
  19430.  
  19431.  
  19432. 4.10.9.2.2 count
  19433. The integer number of rays that are sent out whenever a new
  19434. radiosity value has to be calculated is given by count. Values of
  19435. 100 to 150 make most scenes look good.  Higher values might be
  19436. needed for scenes with high contrast between light levels or
  19437. small patches of light causing the illumination.  This would be
  19438. used only for a final rendering on an image because it is very
  19439. compute intensive. Since most scenes calculate the ambient value
  19440. at 1% to 2% of pixels, as a rough estimate, your rendering will
  19441. take 1% to 2% of this number times as long. If you set it to 300
  19442. your rendering might take 3 to 6 times as long to complete (1% to
  19443. 2% times 300).
  19444.  
  19445. When this value is too low, the light level will tend to look a
  19446. little bit blotchy, as if the surfaces you're looking at were
  19447. slightly warped. If this is not important to your scene (as in
  19448. the case that you have a bump map or if you have a strong
  19449. texture) then by all means use a lower number.  The default value
  19450. is 100.
  19451.  
  19452.  
  19453. 4.10.9.2.3 distance_maximum
  19454. The distance_maximum float value is the only tuning value that
  19455. depends upon the size of the objects in the scene. This one must
  19456. be set for scenes to render properly... the rest can be ignored
  19457. for a first try. It is difficult to describe the meaning simply
  19458. but it sets the distance in model units from a sample at which
  19459. the error is guaranteed to hit 100% (radiosity_error_bound >=1):
  19460. no samples are reused at a distance larger than this from their
  19461. original calculation point.
  19462.  
  19463. Imagine an apple at the left edge of a table. The goal is to make
  19464. sure that samples on the surface of the table at the right are
  19465. not used too close to the apple and definitely not underneath the
  19466. apple.  If you had enough rays there wouldn't be a problem since
  19467. one of them would be guaranteed to hit the apple and set the
  19468. reuse radius properly for you. In practice, you must limit this.
  19469.  
  19470. We use this technique: find the object in your scene which might
  19471. have the following problem: a small object on a larger flatter
  19472. surface that you want good ambient light near. Now, how far from
  19473. this would you have to get to be sure that one of your rays had a
  19474. good chance of hitting it? In the apple-on-the-table example,
  19475. assuming I used one POV-Ray unit as one inch, I might use 30
  19476. inches. A theoretically sound way (when you are running lots of
  19477. rays) is the distance at which this object's top is 5 degrees
  19478. above the horizon of the sample point you are considering. This
  19479. corresponds to about 11 times the height of the object. So, for a
  19480. 3-inch apple, 33 inches makes some sense. For good behavior under
  19481. and around a 1/3 inch pea, use 3 inches etc. Another VERY rough
  19482. estimate is one third the distance from your eye position to the
  19483. point you are looking at. The reasoning is that you are probably
  19484. no more than 90 inches from the apple on the table, if you care
  19485. about the shading underneath it.  The default value is 0.
  19486.  
  19487.  
  19488. 4.10.9.2.4 error_bound
  19489. The error_bound float value is one of the two main speed/quality
  19490. tuning values (the other is of course the number of rays shot).
  19491. In an ideal world, this would be the only value needed. It is
  19492. intended to mean the fraction of error tolerated. For example, if
  19493. it were set to 1 the algorithm would not calculate a new value
  19494. until the error on the last one was estimated at as high as 100%.
  19495. Ignoring the error introduced by rotation for the moment, on flat
  19496. surfaces this is equal to the fraction of the reuse distance,
  19497. which in turn is the distance to the closest item hit. If you
  19498. have an old sample on the floor 10 inches from a wall, an error
  19499. bound of 0.5 will get you a new sample at a distance of about 5
  19500. inches from the wall. 0.5 is a little rough and ready, 0.33 is
  19501. good for final renderings. Values much lower than 0.3 take
  19502. forever. The default value is 0.4.
  19503.  
  19504.  
  19505. 4.10.9.2.5 gray_threshold
  19506. Diffusely interreflected light is a function of the objects
  19507. around the point in question. Since this is recursively defined
  19508. to millions of levels of recursion, in any real life scene, every
  19509. point is illuminated at least in part by every other part of the
  19510. scene. Since we can't afford to compute this, we only do one
  19511. bounce and the calculated ambient light is very strongly affected
  19512. by the colors of the objects near it. This is known as color
  19513. bleed and it really happens but not as much as this calculation
  19514. method would have you believe. The gray_threshold float value
  19515. grays it down a little, to make your scene more believable. A
  19516. value of .6 means to calculate the ambient value as 60% of the
  19517. equivalent gray value calculated, plus 40% of the actual value
  19518. calculated. At 0%, this feature does nothing. At 100%, you always
  19519. get white/gray ambient light, with no hue. Note that this does
  19520. not change the lightness/darkness, only the strength of
  19521. hue/grayness (in HLS terms, it changes S only).  The default
  19522. value is 0.5
  19523.  
  19524.  
  19525. 4.10.9.2.6 low_error_factor
  19526. If you calculate just enough samples, but no more, you will get
  19527. an image which has slightly blotchy lighting. What you want is
  19528. just a few extra interspersed, so that the blending will be nice
  19529. and smooth.  The solution to this is the mosaic preview: it goes
  19530. over the image one or more times beforehand, calculating
  19531. radiosity values. To ensure that you get a few extra, the
  19532. radiosity algorithm lowers the error bound during the pre-final
  19533. passes, then sets it back just before the final pass. The
  19534. low_error_factor is a float tuning value which sets the amount
  19535. that the error bound is dropped during the preliminary image
  19536. passes. If your low error factor is 0.8 and your error bound is
  19537. set to 0.4 it will really use an error bound of 0.32 during the
  19538. first passes and 0.4 on the final pass.  The default value is
  19539. 0.8.
  19540.  
  19541.  
  19542. 4.10.9.2.7 minimum_reuse
  19543. The minimum effective radius ratio is set by minimum_reuse float
  19544. value. This is the fraction of the screen width which sets the
  19545. minimum radius of reuse for each sample point (actually, it is
  19546. the fraction of the distance from the eye but the two are roughly
  19547. equal). For example, if the value is 0.02 the radius of maximum
  19548. reuse for every sample is set to whatever ground distance
  19549. corresponds to 2% of the width of the screen. Imagine you sent a
  19550. ray off to the horizon and it hits the ground at a distance of
  19551. 100 miles from your eye point. The reuse distance for that sample
  19552. will be set to 2 miles. At a resolution of 300*400 this will
  19553. correspond to (very roughly) 8 pixels. The theory is that you
  19554. don't want to calculate values for every pixel into every crevice
  19555. everywhere in the scene, it will take too long. This sets a
  19556. minimum bound for the reuse. If this value is too low, (which it
  19557. should be in theory) rendering gets slow, and inside corners can
  19558. get a little grainy. If it is set too high, you don't get the
  19559. natural darkening of illumination near inside edges, since it
  19560. reuses. At values higher than 2% you start getting more just
  19561. plain errors, like reusing the illumination of the open table
  19562. underneath the apple.  Remember that this is a unitless ratio.
  19563. The default value is 0.015.
  19564.  
  19565.  
  19566. 4.10.9.2.8 nearest_count
  19567. The nearest_count integer value is the maximum number of old
  19568. ambient values blended together to create a new interpolated
  19569. value. It will always be the n geometrically closest reusable
  19570. points that get used. If you go lower than 4, things can get
  19571. pretty patchy. This can be good for debugging, though. Must be no
  19572. more than 10, since that is the size of the array allocated.  The
  19573. default value is 6.
  19574.  
  19575.  
  19576. 4.10.9.2.9 recursion_limit
  19577. The recursion_limit is an integer value which determines how many
  19578. recursion levels are used to calculate the diffuse inter-
  19579. reflection. Valid values are one and two. The default value is 1.
  19580.  
  19581.  
  19582. 4.10.9.3   Tips on Radiosity
  19583. If you want to see where your values are being calculated set
  19584. radiosity count down to about 20, set radiosity nearest_count to
  19585. 1 and set gray_threshold to 0. This will make everything
  19586. maximally patchy, so you'll be able to see the borders between
  19587. patches. There will have been a radiosity calculation at the
  19588. center of most patches. As a bonus, this is quick to run. You can
  19589. then change the error_bound up and down to see how it changes
  19590. things. Likewise modify minimum_reuse and distance_maximum.
  19591.  
  19592. One way to get extra smooth results: crank up the sample count
  19593. (we've gone as high as 1300) and drop the low_error_factor to
  19594. something small like 0.6. Bump up the nearest_count to 7 or 8.
  19595. This will get better values, and more of them, then interpolate
  19596. among more of them on the last pass. This is not for people with
  19597. a lack of patience since it is like a squared function. If your
  19598. blotchiness is only in certain corners or near certain objects
  19599. try tuning the error bound instead. Never drop it by more than a
  19600. little at a time, since the run time will get very long.
  19601.  
  19602. If your scene looks good but right near some objects you get
  19603. spots of the right (usually darker) color showing on a flat
  19604. surface of the wrong color (same as far away from the object),
  19605. then try dropping distance_maximum. If that still doesn't work
  19606. well increase your ray count by 100 and drop the error bound just
  19607. a bit. If you still have problems, drop nearest_count to about 4.
  19608.  
  19609.  
  19610.  
  19611. 5.0  APPENDICES
  19612.  
  19613. 5.1  Copyright, Legal Information and License -- POVLEGAL.DOC
  19614. The following sections contain the legal information and license
  19615. for the Persistence of Vision(tm) Ray-Tracer, also called POV-Ray(tm).
  19616. Before you use this program you have to read the sections below.
  19617.  
  19618.  
  19619. 5.1.1     General License Agreement -- POVLEGAL.DOC
  19620. Revised May 1999.
  19621.  
  19622. THIS NOTICE MUST ACCOMPANY ALL OFFICIAL OR CUSTOM PERSISTENCE OF
  19623. VISION FILES. IT MAY NOT BE REMOVED OR MODIFIED. THIS INFORMATION
  19624. PERTAINS TO ALL USE OF THE PACKAGE WORLDWIDE.  THIS DOCUMENT
  19625. SUPERSEDES ALL PREVIOUS GENERAL LICENSES OR DISTRIBUTION
  19626. POLICIES. ANY INDIVIDUALS, COMPANIES OR GROUPS WHO HAVE BEEN
  19627. GRANTED SPECIAL LICENSES MAY CONTINUE TO DISTRIBUTE VERSION 2.x
  19628. BUT MUST RE-APPLY FOR VERSION 3.00 OR LATER.
  19629.  
  19630. This document pertains to the use and distribution of the
  19631. Persistence of Vision(tm) Ray Tracer a.k.a POV-Ray(tm). It applies to
  19632. all POV-Ray program source files, executable (binary) files,
  19633. scene files, documentation files, help file, bitmaps and INI
  19634. files contained in official POV-Ray Team(tm) archives.  All of these
  19635. are referred to here as "the software". The POV-Team reserves the
  19636. right to revise these rules in future versions and to make
  19637. additional rules to address new circumstances at any time.
  19638.  
  19639. All of this software is Copyright 1991,1999 by the POV-Ray Team(tm).
  19640. Although it is distributed as freeware, it is NOT PUBLIC DOMAIN.
  19641.  
  19642. The copyrighted package may ONLY be distributed and/or modified
  19643. according to the license granted herein.  The spirit of the
  19644. license is to promote POV-Ray as a standard ray tracer, provide
  19645. the full POV-Ray package freely to as many users as possible,
  19646. prevent POV-Ray users and developers from being taken advantage
  19647. of, enhance the life quality of those who come in contact with
  19648. POV-Ray.  This license was created so these goals could be
  19649. realized.  You are legally bound to follow these rules, but we
  19650. hope you will follow them as a matter of ethics, rather than fear
  19651. of litigation.
  19652.  
  19653.  
  19654. 5.1.2     Usage Provisions
  19655. Permission is granted to the user to use the software and
  19656. associated files in this package to create and render images. The
  19657. use of this software for the purpose of creating images is
  19658. completely free. The creator of a scene file and the image
  19659. created from the scene file, retains all rights to the image and
  19660. scene file they created and may use them for any purpose
  19661. commercial or non-commercial.
  19662.  
  19663. The user is also granted the right to use the scenes files,
  19664. fonts, bitmaps, and include files distributed in the INCLUDE and
  19665. SCENES\INCDEMO sub-directories in their own scenes.  Such
  19666. permission does not extend to files in the SCENES directory or
  19667. its sub-directories.  The SCENES files are for your enjoyment and
  19668. education but may not be the basis of any derivative works.
  19669.  
  19670.  
  19671. 5.1.3     General Rules For All Distribution
  19672. The permission to distribute this package under certain very
  19673. specific conditions is granted in advance, provided that the
  19674. following conditions are met.
  19675.  
  19676. These archives must not be re-archived using a different method
  19677. without the explicit permission of the POV-Team.  You may rename
  19678. the archives only to meet the file name conventions of your
  19679. system or to avoid file name duplications but we ask that you try
  19680. to keep file names as similar to the originals as possible.  (For
  19681. example: POVSRC.ZIP to POVSRC30.ZIP)
  19682.  
  19683. Ready-to-run unarchived distribution on CD-ROM is also permitted
  19684. if the files are arranged in our standard directory or folder
  19685. structure as though it had been properly installed on a hard
  19686. disk.
  19687.  
  19688. You must distribute a FULL PACKAGE of files as described in the
  19689. next section.  No portion of this package may be separated from
  19690. the package and distributed separately other than under the
  19691. conditions specified in the provisions given below.
  19692.  
  19693. Non-commercial distribution in which no money or compensation is
  19694. charged (such as a user copying the software for a personal
  19695. friend or colleague) is permitted with no other restrictions.
  19696.  
  19697. Teachers and educational institutions may also distribute the
  19698. material to students for free or they may charge minimal copying
  19699. costs if the software is to be used in a course.
  19700.  
  19701.  
  19702. 5.1.4     Definition Of "Full Package"
  19703. A "full package" contains an executable program, documentation,
  19704. and sample scenes.  For generic Unix platforms, there are no
  19705. executables available so the portable C source code must be
  19706. included instead of the executable program.
  19707.  
  19708. POV-Ray is officially distributed for MS-Dos; Windows 95/98/NT;
  19709. Linux for Intel x86 series; Apple Macintosh; Apple PowerPC;
  19710. SunOS; and Amiga. Other systems may be added in the future.
  19711.  
  19712. Distributors need not support all platforms but for each platform
  19713. you support you must distribute a full package. For example a
  19714. Macintosh only CD-ROM need not distribute the Windows versions.
  19715.  
  19716. This software may ONLY be bundled with other software packages
  19717. according to the conditions specified in the provisions below.
  19718.  
  19719.  
  19720. 5.1.5     Conditions For CD-ROM or Shareware/Freeware
  19721.      Distribution
  19722. Shareware and freeware distribution companies may distribute the
  19723. software included in software-only compilations using media such
  19724. as, but not limited to, floppy disk, CD-ROM, tape backup, optical
  19725. disks, hard disks, or memory cards. This section only applies to
  19726. distributors of collected programs. Anyone wishing to bundle the
  19727. package with a shareware product must use the commercial bundling
  19728. rules.
  19729.  
  19730. Distribution on CD-ROM or high capacity media such as backup tape
  19731. is permitted if the total cost to the user is no more than $0.08
  19732. U.S. dollars per megabyte of data. For example a CD-ROM with 600
  19733. meg could cost no more than $48.00 US.
  19734.  
  19735. Any bundling with books, magazines or other print media is
  19736. permitted if the total cost of the book or magazine with CD is
  19737. less than the $48.00 limit. Bundling with more expensive
  19738. publications or distributions should also use the commercial
  19739. rules.
  19740.  
  19741. For floppy disk distribution, no more than five dollars U.S. ($5)
  19742. can be charged per disk for the copying of this software and the
  19743. media it is provided on. Space on each disk must be used as fully
  19744. as possible. You may not spread the files over more disks than
  19745. are necessary.
  19746.  
  19747.  
  19748. 5.1.6     Conditions For On-Line Services And Bbs's Including
  19749.      Internet
  19750. On-line services, BBS's and internet sites may distribute the POV-
  19751. Ray software under the conditions in this section. Sites which
  19752. allow users to run POV-Ray from remote locations must use
  19753. separate provisions in the section below.
  19754.  
  19755. The archives must all be easily available on the service and
  19756. should be grouped together in a similar on-line area.
  19757.  
  19758. It is strongly requested that sites remove prior versions of POV-
  19759. Ray to avoid user confusion and simplify or minimize our support
  19760. efforts.
  19761.  
  19762. The site may only charge standard usage rates for the downloading
  19763. of this software. A premium may not be charged for this package.
  19764. I.E. CompuServe or America On-Line may make these archives
  19765. available to their users, but they may only charge regular usage
  19766. rates for the time required to download.
  19767.  
  19768.  
  19769. 5.1.7     Online Or Remote Execution Of POV-Ray
  19770. Some internet sites have been set up so that remote users can
  19771. actually run POV-Ray software on the internet server. Other
  19772. companies sell CPU time for running POV-Ray software on
  19773. workstations or high-speed computers. Such use of POV-Ray
  19774. software is permitted under the following conditions.
  19775.  
  19776. Fees or charges, if any, for such services must be for connect
  19777. time, storage or processor usage ONLY. No premium charges may be
  19778. assessed for use of POV-Ray beyond that charged for use of other
  19779. software. Users must be clearly notified that they are being
  19780. charged for use of the computer and not for use of POV-Ray
  19781. software.
  19782.  
  19783. Users must be prominently informed that they are using POV-Ray
  19784. software, that such software is free, and where they can find
  19785. official POV-Ray software. Any attempt to obscure the fact that
  19786. the user is running POV-Ray is expressly prohibited.
  19787.  
  19788. All files normally available in a full package distribution,
  19789. especially a copy of this license and full documentation must be
  19790. available for download or readable online so that users of an
  19791. online executable have access to all of the material of a full
  19792. user package.
  19793.  
  19794. If the POV-Ray software has been modified in any way, it must
  19795. also follow the provisions for custom versions below.
  19796.  
  19797.  
  19798. 5.1.8     Permitted Modification And Custom Versions
  19799. Although the full source code for POV-Ray is distributed, there
  19800. are strict rules for the use of the source code. The source
  19801. distribution is provided to;  1) promote the porting of POV-Ray
  19802. to hardware and operating systems which the POV-Team cannot
  19803. support.  2) promote experimentation and development of new
  19804. features to the core code which might eventually be incorporated
  19805. into the official version.  3) provide insight into the inner
  19806. workings of the program for educational purposes.
  19807.  
  19808. These license provisions have been established to promote the
  19809. growth of POV-Ray and prevent difficulties for users and
  19810. developers alike. Please follow them carefully for the benefit of
  19811. all concerned when creating a custom version.
  19812.  
  19813. The user is granted the privilege to modify and compile the
  19814. source code for their own personal use in any fashion they see
  19815. fit. What you do with the software in your own home is your
  19816. business.
  19817.  
  19818. However severe restrictions are imposed if the user wishes to
  19819. distribute a modified version of the software, documentation or
  19820. other parts of the package (here after referred to as a "custom
  19821. version"). You must follow the provisions given below. This
  19822. includes any translation of the documentation into other
  19823. languages or other file formats.
  19824.  
  19825. A "custom version" is defined as a fully functional version of
  19826. POV-Ray with all existing features intact. ANY OTHER USE OF ANY
  19827. POV-Ray SOURCE CODE IS EXPRESSLY PROHIBITED. The POV-Team does
  19828. not license source code for any use outside POV-Ray. No portion
  19829. of the POV-Ray source code may be incorporated into another
  19830. program unless it is clearly a custom version of POV-Ray that
  19831. includes all of the basic functions of POV-Ray.
  19832.  
  19833. All executables, documentation, modified files and descriptions
  19834. of the same must clearly identify themselves as a modified and
  19835. unofficial version of POV-Ray. Any attempt to obscure the fact
  19836. that the user is running POV-Ray or to obscure that this is an
  19837. unofficial version expressly prohibited.
  19838.  
  19839. POV-Ray may not be linked into other software either at compile-
  19840. time using an object code linker nor at run-time as a DLL,
  19841. ActiveX, or other system. Such linkage can tend to blur the end-
  19842. user's perception of which program provides which functions and
  19843. thus qualifies as an attempt to obscure what is running.
  19844.  
  19845. To allow POV-Ray to communicate with outside programs, the
  19846. official versions of POV-Ray include several internal
  19847. communication "hooks" for it to call other tasks, often called an
  19848. Application Programming Interface, or API. For example: the
  19849. generic part of POV-Ray provides operating system shell-out API
  19850. commands. The Windows version has a GUI-extension API and the
  19851. ability to replace the text editor. Modification to these APIs or
  19852. other officially supported communication mechanisms to increase
  19853. functionality beyond that of the official version IS EXPRESSLY
  19854. PROHIBITED.
  19855.  
  19856.  
  19857. 5.1.9     Conditions For Distribution Of Custom Versions
  19858. If your re-compiled version meets all requirements for custom
  19859. versions listed above, the following conditions apply to its
  19860. distribution:
  19861.  
  19862. You must provide all POV-Ray support for all users who use your
  19863. custom version. You must provide information so that user may
  19864. contact you for support for your custom version. The POV-Ray Team
  19865. is not obligated to provide you or your users any technical
  19866. support.
  19867.  
  19868. Include contact information in the DISTRIBUTION_MESSAGE macros in
  19869. the source file OPTOUT.H and insure that the program prominently
  19870. displays this information. Display all copyright notices and
  19871. credit screens for the official version.
  19872.  
  19873. Custom versions may only be distributed as freeware. You must
  19874. make all of your modifications to POV-Ray freely and publicly
  19875. available with FULL SOURCE CODE to the modified portions of POV-
  19876. Ray and must freely distribute full source to any new parts of
  19877. the custom version. The goal is that users must be able to re-
  19878. compile the program themselves using readily available compilers
  19879. and run-time libraries and to be able to further improve the
  19880. program with their own modifications.
  19881.  
  19882. You must provide documentation for any and all modifications that
  19883. you have made to the program that you are distributing. Include
  19884. clear and obvious information on how to obtain the official POV-
  19885. Ray.
  19886.  
  19887. The user is encouraged to send enhancements and bug fixes to the
  19888. POV-Ray Team, but the team is in no way required to utilize these
  19889. enhancements or fixes. By sending material to the team, the
  19890. contributor asserts that he owns the materials or has the right
  19891. to distribute these materials. He authorizes the team to use the
  19892. materials any way they like. The contributor still retains rights
  19893. to the donated material, but by donating, grants unrestricted,
  19894. irrevocable usage and distribution rights to the POV- Team. The
  19895. team doesn't have to use the material, but if we do, you do not
  19896. acquire any rights related to POV-Ray. The team will give you
  19897. credit as the creator of new code if applicable.
  19898.  
  19899. Include a copy of this document (POVLEGAL.DOC).
  19900.  
  19901.  
  19902. 5.1.10    Conditions For Commercial Bundling
  19903. Vendors wishing to bundle POV-Ray with commercial software
  19904. (including shareware) or other distribution not already described
  19905. above must first obtain explicit permission from the POV-Team.
  19906. Such permission is rarely granted. The POV-Team will decide if
  19907. such distribution will be allowed on a case-by-case basis and may
  19908. impose certain restrictions as it sees fit. The minimum terms are
  19909. given below. Other conditions may be imposed.
  19910.  
  19911.   *    The product must be an existing product that has proven
  19912.   itself as commercially viable without POV-Ray included.
  19913.   *    The inclusion of POV-Ray should be promoted only as a
  19914.   free bonus and not as a feature designed to encourage
  19915.   customers to purchase or upgrade solely for the POV-Ray
  19916.   capability.
  19917.   *    Purchasers of your product must not be led to believe
  19918.   that they are paying for POV-Ray. Any mention of the POV-Ray
  19919.   bundle on the box, in advertising or in instruction manuals
  19920.   must be clearly marked with a disclaimer that POV-Ray is free
  19921.   software and can be obtained for free or nominal cost from
  19922.   various sources.
  19923.   *    Include clear and obvious information on how to obtain
  19924.   the official POV-Ray.
  19925.   *    You must provide all POV-Ray support for all users who
  19926.   acquired POV-Ray through your product. The POV-Team is not
  19927.   obligated to provide you or your customers any technical
  19928.   support.
  19929.   *    Include a credit page or pages in your documentation for
  19930.   POV-Ray.
  19931.   *    If you modify any portion POV-Ray for use with your
  19932.   hardware or software, you must follow the custom version rules
  19933.   in addition to these rules.
  19934.   *    Include contact and support information for your product.
  19935.   *    Include a full user package as described above.
  19936.  
  19937. 5.1.11    POV-Team Endorsement Prohibitions
  19938. On rare occasions, the POV-Team endorses distributions in which
  19939. POV-Team members are compensated participants and which the POV-
  19940. Team has given approval.
  19941.  
  19942. Without specific approval, distributors (whether free or
  19943. commercial) must not claim or imply in any way that the POV-Team
  19944. officially endorses or supports the distributor or the product
  19945. (such as CD, book, or magazine) associated with the distribution.
  19946.  
  19947. You may not claim or imply that the POV-Team derives any benefit
  19948. from your distribution.
  19949.  
  19950. If you wish to emphasize that your distribution is legal, you may
  19951. use this language "This distribution of the official version of
  19952. POV-Ray is permitted under the terms of the General License in
  19953. the file POVLEGAL.DOC. The POV- Team does not endorse the
  19954. distributor or its products. The POV-Team receives no
  19955. compensation for this distribution."
  19956.  
  19957.  
  19958. 5.1.12    Retail Value Of This Software
  19959. Although POV-Ray is, when distributed within the terms of this
  19960. agreement, free of charge, the retail value (or price) of this
  19961. program is determined as US$20.00 per copy distributed or copied.
  19962. If the software is distributed or copied without authorization
  19963. you are legally liable to this debt to the copyright holder or
  19964. any other person or organization delegated by the copyright
  19965. holder for the collection of this debt, and you agree that you
  19966. are legally bound by the above and will pay this debt within 30
  19967. days of the event.
  19968.  
  19969. However, none of the above paragraph constitutes permission for
  19970. you to distribute this software outside of the terms of this
  19971. agreement. In particular, the conditions and debt mentioned above
  19972. (whether paid or unpaid) do not allow you to avoid statutory
  19973. damages or other legal penalties and does not constitute any
  19974. agreement that would allow you to avoid such other legal remedies
  19975. as are available to the copyright holder.
  19976.  
  19977. Put simply, POV-Ray is only free if you comply with our
  19978. distribution conditions; it is not free otherwise. The copyright
  19979. holder of this software chooses to give it away free under these
  19980. and only these conditions.
  19981.  
  19982. For the purpose of copyright regulations, the retail value of
  19983. this software is US$20.00 per copy.
  19984.  
  19985.  
  19986. 5.1.13    Other Provisions
  19987. The team permits and encourages the creation of programs,
  19988. including commercial packages, which import, export or translate
  19989. files in the POV-Ray Scene Description Language. There are no
  19990. restrictions on use of the language itself. We reserve the right
  19991. to add or remove or change any part of the language.
  19992.  
  19993. "POV-Ray", "Persistence of Vision", "POV-Team" and "POV-Help" are
  19994. trademarks of the POV-Team.
  19995.  
  19996. While we do not claim any restrictions on the letters "POV"
  19997. alone, we humbly request that you not use POV in the name of your
  19998. product. Such use tends to imply it is a product of the POV-Team.
  19999. Existing programs which used "POV" prior to the publication of
  20000. this document need not feel guilty for doing so provided that you
  20001. make it clear that the program is not the work of the team nor
  20002. endorsed by us.
  20003.  
  20004.  
  20005. 5.1.14    Revocation Of License
  20006. VIOLATION OF THIS LICENSE IS A VIOLATION OF COPYRIGHT LAWS. IT
  20007. WILL RESULT IN REVOCATION OF ALL DISTRIBUTION PRIVILEGES AND MAY
  20008. RESULT IN CIVIL OR CRIMINAL PENALTY.
  20009.  
  20010. Such violators who are prohibited from distribution will be
  20011. identified in this document.
  20012.  
  20013. In this regard, "PC Format", a magazine published by Future
  20014. Publishing, Ltd. in the United Kingdom, distributed incomplete
  20015. versions of POV-Ray 1.0 in violation the license which was effect
  20016. at the time. They later attempted to distribute POV-Ray 2.2
  20017. without prior permission of the POV- Team in violation the
  20018. license which was in effect at the time. There is evidence that
  20019. other Future Publishing companies have also violated our terms.
  20020. Therefore "PC Format", and any other magazine, book or CD-ROM
  20021. publication owned by Future Publishing is expressly prohibited
  20022. from any distribution of POV-Ray software until further notice.
  20023.  
  20024.  
  20025. 5.1.15    Disclaimer
  20026. This software is provided as is without any guarantees or
  20027. warranty. Although the authors have attempted to find and correct
  20028. any bugs in the package, they are not responsible for any damage
  20029. or losses of any kind caused by the use or misuse of the package.
  20030. The authors are under no obligation to provide service,
  20031. corrections, or upgrades to this package.
  20032.  
  20033.  
  20034. 5.1.16    Technical Support
  20035. We sincerely hope you have fun with our program. If you have any
  20036. problems with the program, the team would like to hear about
  20037. them. Also, if you have any comments, questions or enhancements,
  20038. please the POV-Ray Team on the internet at http://www.povray.org
  20039. or our private news server news.povray.org with over a dozen
  20040. povray-related news groups.  The USENET group
  20041. comp.graphics.rendering.raytracing is also a great source of
  20042. information on POV-Ray and related topics.
  20043.  
  20044. License inquiries should be made via email and limited technical
  20045. support is available via email to:
  20046.  
  20047. POV-Ray Team Coordinator  team-coord@povray.org
  20048.  
  20049. The following postal address is only for official license
  20050. business and only if email is impossible.
  20051.  
  20052. We do not provide technical support via regular mail, only email.
  20053. We don't care if you don't have a modem or online access. We will
  20054. not mail you disks with updated versions. Do not send money.
  20055.  
  20056. Chris Young; 3119 Cossell Drive; Indianapolis, IN 46224 U.S.A.
  20057.  
  20058. The other authors' contact information may be found in the
  20059. documentation.
  20060.  
  20061.  
  20062. 5.2  Authors
  20063. Following is a list in alphabetic order of all people who have
  20064. ever worked on the POV-Ray Team or who have made a note-worthy
  20065. contribution. If you want to contact or thank the authors read
  20066. the sections "Contacting the Authors" or use email addresses
  20067. below.
  20068.  
  20069.  
  20070.                  CURRENT POV-Team MEMBERS
  20071. NAME            PARTICIPATION            EMAIL
  20072. Dieter Bayer    Wrote sor, lathe,        dbayer@tomtec.de
  20073.                 prism, media and many
  20074.                 other features
  20075. Thomas Baier    New 3.1 team member,     thbaier@ibm.net
  20076.                 tester
  20077. Chris Cason     Windows version          
  20078.                 coordinator and other
  20079.                 contributions
  20080. Dale C. Brodin  Alpha & Beta tester,     brodin@execpc.com
  20081.                 forum support
  20082. Thorsten        Mac developer            ThorstenFroehlich@
  20083. Froehlich                                compuserve.com
  20084. Alan Kong       Alpha & Beta tester,     akong@pacbell.net
  20085.                 forum support
  20086. Lutz            Moray author, MS-Dos 24- lutz@stmuc.com
  20087. Kretzschmar     bit VGA, part of the
  20088.                 anti-aliasing code
  20089. Joel Newkirk    Primary Amiga developer  newkirk@snip.net
  20090. Nathan O'Brien  Artist, tester           no13@no13.net
  20091. Redaelli Paolo  Amiga developer          redaelli@inc.it
  20092. Anton Raves     Alpha & Beta tester,     100022.2603@compus
  20093.                 Mac contributor          erve.com
  20094. Eduard Schwan   Mac version              espsw@home.com
  20095.                 coordinator, mosaic
  20096.                 preview, docs
  20097. Erkki           Alpha & Beta tester,     
  20098. Sondergaard     3.0 Scene files
  20099. Timothy Wegner  Fractal objects, PNG     twegner@phoenix.ne
  20100.                 support                  t
  20101. Chris Young     POV-Team coordinator,    team-
  20102.                 parser code              coord@povray.org
  20103.  
  20104.  
  20105.            PAST POV-Team MEMBERS and CONTRIBTORS
  20106. NAME            PARTICIPATION            EMAIL
  20107. Claire          Tutorials for the POV-   
  20108. Amundsen        Ray User Guide
  20109. Steve Anger     POV-Ray 2.0/3.0          sanger@globalserve
  20110.                 developer                .net
  20111. Randy Antler    MS-Dos display code      
  20112.                 enhancements
  20113. John Baily      RLE targa code           
  20114. Eric Barish     Ground fog code          
  20115. Kendall         PMODE library support    
  20116. Bennett
  20117. Steve Bennett   GIF support              
  20118. David Buck      Original author of       
  20119.                 DKBTrace
  20120.                 POV-Ray 1.0 developer
  20121. Aaron Collins   Co-author of DKBTrace    
  20122.                 2.12
  20123.                 POV-Ray 1.0 developer
  20124. Chris Dailey    POV-Ray 3.0 developer    
  20125. Steve Demlow    POV-Ray 3.0 developer    
  20126. Andreas Dilger  Former Unix              adilger@enel.ucalg
  20127.                 coordinator, Linux       ary.ca
  20128.                 developer, PNG support   www-
  20129.                                          mddsp.enel.ucalgar
  20130.                                          y.ca/People/adilge
  20131.                                          r/
  20132. Joris van       Mac beta tester          
  20133. Drunen Littel
  20134. Alexander       POV-Ray 1.0/2.0/3.0      xander@mitre.com
  20135. Enzmann         developer
  20136. Dan Farmer      POV-Ray 1.0/2.0/3.0      
  20137.                 developer
  20138. Charles Fusner  Blob, lathe and prism    
  20139.                 tutorial tutorials for
  20140.                 the POV-Ray User Guide
  20141. David Harr      Mac balloon help and     
  20142.                 palette code
  20143. Jimmy Hoeks     Help file for Windows    
  20144.                 user interface
  20145. Terry Kanakis   Camera fix               
  20146. Kari Juharvi    Ground fog code          
  20147. Kivisalo
  20148. Charles         MS-Dos display code      
  20149. Marslett
  20150. Pascal          Fractal objects          
  20151. Massimino
  20152. Jim McElhiney   POV-Ray 3.0 developer    
  20153. Robert A.       Artist, 3.0 docs         ram@iu.net
  20154. Mickelsen       contributor              www.mickelsenstudi
  20155.                                          os.com
  20156. Mike Miller     Artist, scene files,     
  20157.                 stones.inc
  20158. Douglas Muir    Bump maps, height        
  20159.                 fields
  20160. Jim Nitchals    Mac version, scene       
  20161.                 files (Jim passed away
  20162.                 in June 1998 but his
  20163.                 contributions to POV-
  20164.                 Ray will not be
  20165.                 forgotten)
  20166. Paul Novak      Texture contributions    
  20167. Dave Park       Amiga support, AGA       
  20168.                 video code
  20169. David Payne     RLE targa code           
  20170. Bill Pulver     Time code                
  20171. Dan Richardson  3.0 Docs                 
  20172. Tim Rowley      PPM and Windows-         trowley@geom.umn.e
  20173.                 specific BMP image       du
  20174.                 format support
  20175. Robert Skinner  Noise functions          
  20176. Zsolt           Halo code which was      zsolt@cg.tuwien.ac
  20177. Szalavari       later turned into media  .at
  20178. Scott Taylor    Leopard and onion        
  20179.                 textures
  20180. Drew Wells      POV-Ray 1.0 developer,   
  20181.                 POV-Ray 1.0 team
  20182.                 coordinator
  20183.  
  20184.  
  20185. 5.2.1     Contacting the Authors
  20186. The POV-Team is a collection of volunteer programmers, designers,
  20187. animators and artists meeting via the internet at
  20188. http://www.povray.org. The POV-Team's goal is to create freely
  20189. distributable, high quality rendering and animation software
  20190. written in C that can be easily ported to many different
  20191. computers.
  20192.  
  20193. If you have any questions about POV-Ray, please contact
  20194.  
  20195.   POV-Team Coordinator
  20196.   team-coord@povray.org
  20197. We love to hear about how you're using and enjoying the program.
  20198. We also will do our best try to solve any problems you have with
  20199. POV-Ray and incorporate good suggestions into the program.
  20200.  
  20201. If you have a question regarding commercial use or distribution
  20202. of POV-Ray, or anything else particularly sticky, please contact
  20203. Chris Young, the development team coordinator. Otherwise, spread
  20204. the mail around. We all love to hear from you!
  20205.  
  20206. Please do not send large files to us through the e-mail without
  20207. asking first. Send a query before you send the file, thanks!
  20208.  
  20209.  
  20210. 5.3  What to do if you don't have POV-Ray
  20211. This documentation assumes you already have POV-Ray installed and
  20212. running however the POV-Team does distribute this file by itself
  20213. in various formats including online on the internet.  If you
  20214. don't have POV-Ray or aren't sure you have the official version
  20215. or the latest version, then the following sections will tell you
  20216. what to get and where to get it.
  20217.  
  20218.  
  20219. 5.3.1     Which Version of POV-Ray should you use?
  20220. POV-Ray can be used under MS-Dos, Windows 3.x, Windows for
  20221. Workgroups 3.11, Windows 95, Windows NT, Apple Macintosh 68k,
  20222. Power PC, Amiga, Linux, UNIX and other platforms.  The latest
  20223. versions of the necessary files are available on our web site at
  20224. http://www.povray.org and through various CD distributions.  See
  20225. section "Where to Find POV-Ray Files" for more info.  If your
  20226. platform is not supported and you are proficient in compiling
  20227. source code programs written in C then, see section "Compiling
  20228. POV-Ray" for more information.
  20229.  
  20230.  
  20231. 5.3.1.1   Microsoft Windows 95/98/NT
  20232. The Windows version runs under Windows 95, Windows 98, and
  20233. Windows NT4 also should run under OS/2 Warp.
  20234.  
  20235. Windows 3.1 and Windows for Workgroups are no longer supported
  20236. however the MS-Dos version will run as a dos application under
  20237. those operating systems.
  20238.  
  20239. Required hardware and software:
  20240.  
  20241.   Minimum - 486/100 with 16mb RAM and Windows 95.
  20242.   Disk space - 15 megabytes
  20243. Required POV-Ray files:
  20244.  
  20245.   User archive POVWIN3.EXE - a self-extracting archive
  20246.      containing the program, sample scenes, standard include
  20247.      files and documentation. This file may be split into smaller
  20248.      files for easier downloading. Check the directory of your
  20249.      download or ftp site to see if other files are needed.
  20250. Recommended:
  20251.  
  20252.   Pentium 200 or Pentium II with 32mb and Windows 95 or NT4.
  20253.   SVGA display preferably with high color or true color ability
  20254.      and drivers installed.  (Note: accelerated graphics hardware
  20255.      will not improve performance.)
  20256. Optional: The source code is not needed to use POV-Ray. It is
  20257. provided for the curious and adventurous.
  20258.  
  20259.   POVWIN_S.ZIP --- The C source code for POV-Ray for Windows.
  20260.      Contains generic parts and Windows specific parts. It does
  20261.      not include sample scenes, standard include files and
  20262.      documentation so you should also get the executable archive
  20263.      as well.  POV-Ray can only be compiled using C compilers
  20264.      that create 32-bit Windows applications. We support Watcom
  20265.      10.5a or higher, Borland 4.52/5.0 compilers.
  20266.  
  20267. 5.3.1.2   MS-Dos & Windows 3.x
  20268.  The MS-Dos version runs under MS-Dos or as a DOS application
  20269. under Windows 3.1 or Windows for Workgroups 3.11. Although it
  20270. also runs under Windows 95/98/NT4 and OS/2 Warp, users of those
  20271. systems should use the Windows version..
  20272.  
  20273. Required hardware and software:
  20274.  
  20275.   A 386 or better CPU and at least 8 meg of RAM.
  20276.   About 6 meg disk space to install and 2-10 meg or more beyond
  20277.      that for working space.
  20278.   A text editor capable of editing plain ASCII text files. The
  20279.      EDIT program that comes with MS-Dos will work for moderate
  20280.      size files.
  20281.   Graphic file viewer capable of viewing GIF and perhaps TGA and
  20282.      PNG formats.
  20283. Required POV-Ray files:
  20284.  
  20285.   POVMSDOS.EXE - a self-extracting archive containing the
  20286.      program, sample scenes, standard include files and
  20287.      documentation in plain ASCII text format. This file may be
  20288.      split into smaller files for easier downloading. Check the
  20289.      directory of your download or ftp site to see if other files
  20290.      are needed.
  20291. Recommended:
  20292.  
  20293.   Pentium 200 or Pentium II (faster the better) 32 meg or more
  20294.      RAM.  SVGA display preferably with VESA interface and high
  20295.      color or true color ability.    (Note: accelerated graphics
  20296.      hardware will not improve performance.)
  20297.  
  20298. Optional: The source code is not needed to use POV-Ray. It is
  20299. provided for the curious and adventurous.
  20300.  
  20301.   POVMSD_S.ZIP - The C source code for POV-Ray for MS-Dos.
  20302.      Contains generic parts and MS-Dos specific parts. It does
  20303.      not include sample scenes, standard include files and
  20304.      documentation so you should also get the executable archive
  20305.      as well. Requires a C compiler that can create 32-bit
  20306.      protected mode applications. We support Watcom 11, Borland
  20307.      4.52 with DOS Power Pack and DJGPP 2.
  20308.  
  20309. 5.3.1.3   Linux for Intel x86
  20310. Required hardware and software:
  20311.  
  20312.   A 386 or better CPU and at least 8 meg of RAM.
  20313.   About 6 meg disk space to install and 2-10 meg or more beyond
  20314.      that for working space.
  20315.   A text editor capable of editing plain ASCII text files.
  20316.   Graphic file viewer capable of viewing PPM, TGA or PNG
  20317.      formats.
  20318.   Any recent (1994 onwards) Linux kernel and support for ELF
  20319.      format binaries. POV-Ray for Linux is not in a.out-format.
  20320.      ELF libraries libc.so.5, libm.so.5 and one or both of
  20321.      libX11.so.6 or libvga.so.1.
  20322.   
  20323. Required POV-Ray files:
  20324.  
  20325.   POVLINUX.TGZ or POVLINUX.TAR.GZ - archive containing an
  20326.      official binary for each SVGALib and X-Windows modes. Also
  20327.      contains sample scenes, standard include files and
  20328.      documentation in plain ASCII text.
  20329. Recommended:
  20330.  
  20331.   Pentium 200 or Pentium II (faster the better) 32 meg or more
  20332.      RAM.  SVGA display preferably with VESA interface and high
  20333.      color or true color ability.  If you want display, you'll
  20334.      need either SVGALib or X-Windows.  (Note: accelerated
  20335.      graphics hardware will not improve performance.)
  20336. Optional: The source code is not needed to use POV-Ray. It is
  20337. provided for the curious and adventurous.
  20338.  
  20339.   POVUNI_S.TAR.GZ or POVUNI_S.TGZ - The C source code for POV-
  20340.      Ray for Linux. Contains generic parts and Linux specific
  20341.      parts. It does not include sample scenes, standard include
  20342.      files and documentation so you should also get the
  20343.      executable archive as well.  Requires the GNU C compiler and
  20344.      (optionally) the X include files and libraries.
  20345.  
  20346. 5.3.1.4   Apple Macintosh
  20347. The MacOS versions run under Apple's MacOS operating system
  20348. version 7.1 or newer, on any 68020/030/040-based Macintosh-
  20349. compatible computer (with or without a floating point
  20350. coprocessor) or any of the PowerPC Macintosh-compatible
  20351. computers.
  20352.  
  20353. Required hardware and software:
  20354.  
  20355.   A 68020 or better CPU without a floating point unit (LC or
  20356.      Performa or Centris series); at least 8 MB RAM or
  20357.   A 68020 or better CPU *with* a floating point unit (Mac II or
  20358.      Quadra series); at least 8 MB RAM or
  20359.   Any PowerPC Macintosh computer and at least 8 MB RAM.
  20360.   System 7.1 or newer and color QuickDraw (System 6 is no longer
  20361.      supported).
  20362.   Appearance Extension is also required now.  This comes
  20363.      standard in MacOS 8, but can be downloaded from Apple's web
  20364.      site <http://developer.apple.com/sdk/> and installed on any
  20365.      Mac running 7.1 or newer.
  20366.   Navigation Services is not required, but will enhance the
  20367.      open/save dialogs if it is present.  It is also a free
  20368.      extension available from Apple's web site, which can be used
  20369.      in 7.5.5 or newer.
  20370.   About 6 MB free disk space to install and an additional 2-10
  20371.      MB free space for your own creations (scenes and images).
  20372.   Graphic file viewer utility capable of viewing Mac PICT, GIF
  20373.      and perhaps TGA and PNG formats (the shareware
  20374.      GraphicConverter or GIFConverter applications are good.)
  20375. Required POV-Ray files:
  20376.  
  20377.   POVMACNF.SIT or POVMACNF.SIT.HQX - a Stuffit archive
  20378.      containing the non-FPU 68K Macintosh application, sample
  20379.      scenes, standard include files and documentation (slower
  20380.      version for Macs without an FPU) or
  20381.   POVMAC68.SIT or POVMAC68.SIT.HQX - a Stuffit archive
  20382.      containing the FPU 68K Macintosh application, sample scenes,
  20383.      standard include files and documentation (faster version for
  20384.      Macs WITH an FPU) or
  20385.   POVPMAC.SIT or POVPMAC.SIT.HQX - a Stuffit archive containing
  20386.      the native Power Macintosh application, sample scenes,
  20387.      standard include files and documentation.
  20388. Recommended:
  20389.  
  20390.   68030/33 or faster with FPU, or any Power Macintosh
  20391.   8 MB or more RAM for 68K Macintosh;
  20392.   16 MB or more for Power Macintosh systems.
  20393.   Color monitor preferred, 256 colors OK, but thousands or
  20394.      millions of colors is even better.
  20395. Optional: The source code is not needed to use POV-Ray. It is
  20396. provided for the curious and adventurous. POV-Ray can be compiled
  20397. using Apple's MPW 3.3, Metrowerks CodeWarrior Pro or Symantec 8.
  20398.  
  20399.   POVMACS.SIT or POVMACS.SIT.HQX - The full C source code for
  20400.      POV-Ray for Macintosh. Contains generic parts and Macintosh
  20401.      specific parts. It does not include sample scenes, standard
  20402.      include files and documentation so you should also get the
  20403.      executable archive as well.
  20404.   
  20405.  
  20406. 5.3.1.5   Amiga
  20407. The Amiga version comes in several flavors, 68000/68020 without
  20408. FPU, (not recommended, very slow) 68020/68030 with FPU, 68040,
  20409. and 68060. There's two way to use POV: Shell only and using the
  20410. provided GUI interface which requires MUI 3.8. All versions run
  20411. under OS3.x and up. Support exists for pensharing and window
  20412. display under OS3.x with 256 color palettes, plus CyberGraphics
  20413. and Picasso 96 24-bit display.
  20414.  
  20415. Required:
  20416.  
  20417.   At least 4 meg of RAM.
  20418.   At least 2 meg of hard disk space for the necessities, 5-20
  20419.      more recommended for workspace.
  20420.   An ASCII text editor, GUI configurable to launch the editor of
  20421.      your choice.
  20422.   Graphic file viewer - POV-Ray outputs to PNG, Targa (TGA), and
  20423.      PPM formats. POV-Ray Amiga can load any image format with
  20424.      Picture.Datatype V43 and the appropriate datatype.
  20425. Required POV-Ray files:
  20426.  
  20427.   POVAMIx0.LHA -- a LHA archive containing executable, sample
  20428.      scenes, standard include files, and documentation for the
  20429.      680x0 version of POV-Ray (i.e.: POVAMI60.LHA stands for
  20430.      68060 version); 68020 version needs FPU.
  20431. Recommended:
  20432.  
  20433.   8 meg or more of RAM.
  20434.   68030 & 68882 or higher processor.
  20435.   24bit display card (CyberGFX and Picasso 96 library supported)
  20436. Amiga PowerPC version of POV-Ray is now in beta testing. Watch
  20437. the or www.povray.org for further news.
  20438.  
  20439. Optional: The source code is not needed to use POV-Ray. It is
  20440. provided for the curious and adventurous.
  20441.  
  20442.   POVAMI_S.LHA --- The C source code for POV-Ray for Amiga.
  20443.      Contains generic parts and Amiga specific parts. It does not
  20444.      include sample scenes, standard include files, and
  20445.      documentation so you should also get the executable archive
  20446.      as well.
  20447.  
  20448. 5.3.1.6   SunOS
  20449. Required hardware and software:
  20450.  
  20451.   A Sun SPARC processor and at least 4 meg of RAM.
  20452.   About 6 meg disk space to install and 2-10 meg or more beyond
  20453.      that for working space.
  20454.   Graphic file viewer capable of viewing PPM, TGA or PNG
  20455.      formats.
  20456.   A text editor capable of editing plain ASCII text files.
  20457.   SunOS 4.1.3 or other operating system capable of running such
  20458.      a binary (Solaris or possibly Linux for Sparc).
  20459. Required POV-Ray files:
  20460.  
  20461.   POVSUNOS.TGZ or POVSUNOS.TAR.GZ - archive containing an
  20462.      official binary for each text-only and X-Windows modes. Also
  20463.      contains sample scenes, standard include files and
  20464.      documentation.
  20465. Recommended:
  20466.  
  20467.   8 meg or more RAM.
  20468.   If you want display, you'll need X-Windows or an X-Term.-
  20469.      preferably 24-bit TrueColor display ability, although the X
  20470.      display code is known to work with ANY combination of visual
  20471.      and color depth.
  20472.   Graphic file viewer capable of viewing PPM, TGA or PNG
  20473.      formats.
  20474. Optional: The source code is not needed to use POV-Ray. It is
  20475. provided for the curious and adventurous.
  20476.  
  20477.   POVUNI_S.TGZ or POVUNI_S.TAR.GZ - The C source code for POV-
  20478.      Ray for UNIX.  Contains generic parts and Unix/Linux
  20479.      specific parts. It does not include sample scenes, standard
  20480.      include files and documentation so you should also get the
  20481.      executable archive as well. You will need a C compiler and
  20482.      (optionally) the X include files and libraries and knowledge
  20483.      of how to use it. Although we provide source code for
  20484.      generic Unix systems, we do not provide technical support on
  20485.      how to compile the program.
  20486.  
  20487. 5.3.1.7   Generic Unix
  20488. Because Unix runs on a wide variety of hardware and CPUs, the POV-
  20489. Team cannot provide executable versions for every type of Unix.
  20490. We distribute generic Unix source code in portable ANSI C source
  20491. code.  You will need a C compiler and (optionally) the X include
  20492. files and libraries and knowledge of how to use it. Although we
  20493. provide source code for generic Unix systems, we do not provide
  20494. technical support on how to compile the program.
  20495.  
  20496. Required:
  20497.  
  20498.   POVUNI_S.TGZ or POVUNI_S.TAR.GZ - The C source code for POV-
  20499.      Ray for UNIX.  Contains generic parts and Unix/Linux
  20500.      specific parts. It does not include sample scenes, standard
  20501.      include files and documentation so you should also get an
  20502.      executable archive for another platform or get
  20503.   POVUNI_D.TGZ or POVUNI_D.TAR.GZ which contains the sample
  20504.      scenes, standard include files and documentation.
  20505.   A C compiler for your computer and KNOWLEDGE OF HOW TO USE IT.
  20506.   Graphic file viewer capable of viewing PPM, TGA or PNG
  20507.      formats.
  20508.   A text editor capable of editing plain ASCII text files.
  20509. Recommended:
  20510.  
  20511.   Math co-processor.
  20512.   8 meg or more RAM.
  20513. Optional:
  20514.  
  20515.   X Windows if you want to be able to display as you render.
  20516.   You will need the X-Windows include files as well. If you're
  20517.      not familiar with compiling programs for X-Windows you may
  20518.      need some help from someone who is knowledgeable at your
  20519.      installation because the X include files and libraries are
  20520.      not always in a standard place.
  20521.  
  20522. 5.3.1.8   All Versions
  20523. Each executable archive includes full documentation for POV-Ray
  20524. itself as well as specific instructions for using POV-Ray with
  20525. your type of platform. All versions of the program share the same
  20526. ray-tracing features like shapes, lighting and textures. In other
  20527. words, an MS-Dos-PC can create the same pictures as a Cray
  20528. supercomputer as long as it has enough memory. The user will want
  20529. to get the executable that best matches their computer hardware.
  20530.  
  20531. In addition to the files listed above, the POV-Team also
  20532. distributes the user documentation in two alternate forms.  Note
  20533. this is the same documentation distributed in other archives but
  20534. in a different format.  This may be especially useful for MS-Dos
  20535. or Unix users because their documentation is plain ASCII text
  20536. only.
  20537.  
  20538.   POVUSER.PDF - Tutorial and Reference documentation in Adobe
  20539.      Acrobat PDF format.  Requires Adobe Acrobat Reader available
  20540.      for Windows 3.x, Windows 95/98/NT, Mac and some Unix
  20541.      systems.  Go to
  20542.      http://www.adobe.com/prodindex/acrobat/readstep.html to get
  20543.      the reader for free.
  20544.   POVHTML.ZIP - Archive containing Tutorial and Reference
  20545.      documentation in html for viewing with any internet browser.
  20546.   POV31W97.ZIP - Archive containing Tutorial and Reference
  20547.      documentation in Microsoft Word 97 format.
  20548. See the section "Where to Find POV-Ray Files" for where to find
  20549. these files. You can contact those sources to find out what the
  20550. best version is for you and your computer.
  20551.  
  20552.  
  20553. 5.3.2     Where to Find POV-Ray Files
  20554. The latest versions of the POV-Ray software are available from
  20555. the following sources.
  20556.  
  20557.  
  20558. 5.3.2.1   World Wide Website www.povray.org
  20559. The internet home of POV-Ray is reachable on the World Wide Web
  20560. via the address http://www.povray.org and via ftp as
  20561. ftp.povray.org. Please stop by often for the latest files,
  20562. utilities, news and images from the official POV-Ray internet
  20563. site.
  20564.  
  20565. The comp.graphics.rendering.raytracing newsgroup has many
  20566. competent POV-Ray users that are very willing to share their
  20567. knowledge. They generally ask that you first browse a few files
  20568. to see if someone has already answered the same question, and of
  20569. course, that you follow proper "netiquette". If you have any
  20570. doubts about the qualifications of the folks that frequent the
  20571. group, a few minutes spend at the Ray Tracing Competition pages
  20572. at www.povray.org will quickly convince you!
  20573.  
  20574. Also the POV-Team operates its own news server on the internet
  20575. with several news groups related to POV-Ray and other interesting
  20576. programs.  For more information about the server see
  20577. http://www.povray.org/groups.html.
  20578.  
  20579.  
  20580. 5.3.2.2   Books, Magazines and CD-ROMs
  20581. Unfortunately all English language books on POV-Ray are out of
  20582. print and there are no plans to reprint them.  However there is
  20583. now a POV-Ray 3.02 book and CD-ROM available in Japanese.  It
  20584. talks about the Windows and Mac versions of POV-Ray, and various
  20585. utilities.  The CD-ROM is dual format, Windows/Mac. It was
  20586. written in Japan by Hideki Komuro-san, and published by ASCII
  20587. Corp. in June 1998, ISBN 4-7561-1831-3.
  20588.  
  20589. Many popular computer magazines have been authorized to
  20590. distribute POV-Ray on cover CDs.  Note that such distributions of
  20591. the official version of POV-Ray is permitted under the terms of
  20592. the General License in the file POVLEGAL.DOC.  The POV-Team does
  20593. not endorse the distributor or its products.  The POV-Team
  20594. receives no compensation for this distribution.
  20595.  
  20596. The POV-Team does endorse some CD-ROMs containing POV-Ray which
  20597. are prepared by team members.  A portion of the proceeds from
  20598. these CDs support our internet sites and other team activities.
  20599. You can always find the latest information on what is available
  20600. at our web site www.povray.org.
  20601.  
  20602.  
  20603. 5.4  Compiling POV-Ray
  20604. The following sections will help you to compile the portable C
  20605. source code into a working executable version of POV-Ray. They
  20606. are only for those people who want to compile a custom version of
  20607. POV-Ray or to port it to an unsupported platform or compiler.
  20608.  
  20609. The first question you should ask yourself before proceeding is
  20610. "Do I really need to compile POV-Ray at all?" Official POV-Team
  20611. executable versions are available for MS-Dos, Windows 95/98/NT,
  20612. Mac 68k, Mac Power PC, Amiga, Linux for Intel x86, and SunOS.
  20613. Other unofficial compiles may soon be available for other
  20614. platforms. If you do not intend to add any custom or experimental
  20615. features to the program and if an executable already exists for
  20616. your platform then you need not compile this program yourself.
  20617.  
  20618. If you do want to proceed you should be aware that you are very
  20619. nearly on your own. The following sections and other related
  20620. compiling documentation assume you know what you are doing. It
  20621. assumes you have an adequate C compiler installed and working. It
  20622. assumes you know how to compile and link large, multi-part
  20623. programs using a "make" utility or an IDE project file if your
  20624. compiler supports them. Because makefiles and project files often
  20625. specify drive, directory or path information, we cannot promise
  20626. our makefiles or projects will work on your system. We assume you
  20627. know how to make changes to makefiles and projects to specify
  20628. where your system libraries and other necessary files are
  20629. located.
  20630.  
  20631. In general you should not expect any technical support from the
  20632. POV-Team on how to compile the program. Everything is provided
  20633. here as is.  All we can say with any certainty is that we were
  20634. able to compile it on our systems. If it doesn't work for you we
  20635. probably cannot tell you why.
  20636.  
  20637. There is no technical documentation for the source code itself
  20638. except for the comments in the source files. We try our best to
  20639. write clear, well- commented code but some sections are barely
  20640. commented at all and some comments may be out dated. We do not
  20641. provide any technical support to help you to add features. We do
  20642. not explain how a particular feature works. In some instances,
  20643. the person who wrote a part of the program is no longer active in
  20644. the Team and we don't know exactly how it works.
  20645.  
  20646. When making any custom version of POV-Ray or any unofficial
  20647. compile, please make sure you read and follow all provisions of
  20648. our license in POVLEGAL.DOC.  In general you can modify and use
  20649. POV-Ray on your own however you want but if you distribute your
  20650. unofficial version you must follow our rules. You may not under
  20651. any circumstances use portions of POV-Ray source code in other
  20652. programs.
  20653.  
  20654.  
  20655. 5.4.1     Directory Structure
  20656. POV-Ray source code is distributed in archives with files
  20657. arranged in a particular hierarchy of directories or folders.
  20658. When extracting the archives you should do so in a way that keeps
  20659. the directory structure intact. In general we suggest you create
  20660. a directory called povray3 or povray31 and extract the files from
  20661. there. The extraction will create a directory called source with
  20662. many files and sub-directories.
  20663.  
  20664. In general, there are separate archives for each hardware
  20665. platform and operating system but each of these archives may
  20666. support more than one compiler. For example here is the directory
  20667. structure for the MS-Dos archive.  Other platforms use similar
  20668. structures.
  20669.  
  20670.   SOURCE
  20671.   SOURCE\LPNG101
  20672.   SOURCE\ZLIB
  20673.   SOURCE\MSDOS
  20674.   SOURCE\MSDOS\PMODE
  20675.   SOURCE\MSDOS\BORLAND
  20676.   SOURCE\MSDOS\DJGPP
  20677.   SOURCE\MSDOS\WATCOM
  20678. The source directory contains source files for the generic parts
  20679. of POV-Ray that are the same on all platforms. The source\lpng101
  20680. contains files for compiling a library of routines used in
  20681. reading and writing PNG (Portable Network Graphics) image files.
  20682. The source\zlib contains files for compiling a library of
  20683. routines used by libpng to compress and uncompress data streams.
  20684. All of these files are used by all platforms and compilers.  They
  20685. are in every version of the source archives.
  20686.  
  20687. The source\msdos directory contains all source files for the MS-
  20688. Dos version common to all supported MS-Dos compilers. The pmode
  20689. sub-directory contains source files for pmode.lib which is
  20690. required by all MS-Dos versions. The borland, djgpp, and watcom
  20691. sub-directories contain source, makefiles and project files for C
  20692. compilers by Borland, DJGPP and Watcom.
  20693.  
  20694. The source\msdos directory is only in the MS-Dos archive.
  20695. Similarly the Windows archive contains a source\windows
  20696. directory. The Unix archive contains source/unix etc.
  20697.  
  20698. The source\msdos directory contains a file cmpl_msd.doc which
  20699. contains compiling information specific to the MS-Dos version.
  20700. Other platform specific directories contain similar cmpl_xxx.doc
  20701. files and the compiler specific sub-directories also contain
  20702. compiler specific cmpl_xxx.doc files.  Be sure to read all
  20703. pertinent cmpl_xxx.doc files for your platform and compiler.
  20704.  
  20705.  
  20706. 5.4.2     Configuring POV-Ray Source
  20707. Every platform has a header file config.h that is generally in
  20708. the platform specific directory but may be in the compiler
  20709. specific directory. Some platforms have multiple versions of this
  20710. file and you may need to copy or rename it as config.h. This file
  20711. is included in every module of POV-Ray. It contains any
  20712. prototypes, macros or other definitions that may be needed in the
  20713. generic parts of POV-Ray but must be customized for a particular
  20714. platform or compiler.
  20715.  
  20716. For example different operating systems use different characters
  20717. as a separator between directories and file names. MS-Dos uses
  20718. back slash, Unix a front slash or Mac a colon. The config.h file
  20719. for MS-Dos and Windows contains the following:
  20720.  
  20721.   #define FILENAME_SEPARATOR '\'
  20722.  
  20723. which tells the generic part of POV-Ray to use a back slash.
  20724.  
  20725. Every customization that the generic part of the code needs has a
  20726. default setting in the file source\frame.h which is also included
  20727. in every module after config.h. The frame.h header contains many
  20728. groups of defines such as this:
  20729.  
  20730.   #ifndef FILENAME_SEPARATOR
  20731.   #define FILENAME_SEPARATOR '/'
  20732.   #endif
  20733. which basically says "If we didn't define this previously in
  20734. config.h then here's a default value". See frame.h to see what
  20735. other values you might wish to configure.
  20736.  
  20737. If any definitions are used to specify platform specific
  20738. functions you should also include a prototype for that function.
  20739. The file source\msdos\config.h, for example, not only contains
  20740. the macro:
  20741.  
  20742.   #define POV_DISPLAY_INIT(w,h) MSDOS_Display_Init ((w), (h));
  20743. to define the name of the graphics display initialization
  20744. function, it contains the prototype:
  20745.  
  20746.   void MSDOS_Display_Init (int w, int h);
  20747. If you plan to port POV-Ray to an unsupported platform you should
  20748. probably start with the simplest, non-display generic Unix
  20749. version. Then add new custom pieces via the config.h file.
  20750.  
  20751.  
  20752. 5.4.3     Conclusion
  20753. We understand that the above sections are only the most trivial
  20754. first steps but half the fun of working on POV-Ray source is
  20755. digging in and figuring it out on your own. That's how the POV-
  20756. Team members got started. We've tried to make the code as clear
  20757. as we can.
  20758.  
  20759. Be sure to read the cmpl_xxx.doc files in your platform specific
  20760. and compiler specific directories for some more minor help if you
  20761. are working on a supported platform or compiler.
  20762.  
  20763. Good luck!
  20764.  
  20765.  
  20766. 5.5  Suggested Reading
  20767. Beside the POV-Ray material mentioned in "Books, Magazines and CD-
  20768. ROMs" there are several good books or periodicals that you should
  20769. be able to locate in your local computer book store or your local
  20770. university library.
  20771.  
  20772.   "An Introduction to Ray tracing"  Andrew S. Glassner (editor)
  20773. ISBN 0-12-286160-4;  Academic Press 1989
  20774.  
  20775.   "3D Artist" Newsletter,  "The Only Newsletter about Affordable
  20776. PC 3D Tools and Techniques")  Publisher: Bill Allen;  P.O. Box
  20777. 4787; Santa Fe, NM 87502-4787;  (505) 982-3532
  20778.  
  20779.   "Image Synthesis:  Theory and Practice" Nadia Magnenat-Thalman
  20780. and Daniel Thalmann; Springer-Verlag; 1987
  20781.  
  20782.   "The RenderMan Companion" Steve Upstill; Addison Wesley; 1989
  20783.  
  20784.   "Graphics Gems" Andrew S. Glassner (editor); Academic Press;
  20785. 1990
  20786.  
  20787.   "Fundamentals of Interactive Computer Graphics"  J. D. Foley
  20788. and A. Van Dam;  ISBN 0-201-14468-9; Addison-Wesley 1983
  20789.  
  20790.   "Computer Graphics:  Principles and Practice (2nd Ed.)"  J. D.
  20791. Foley, A. van Dam, J. F. Hughes;  ISBN 0-201-12110-7;  Addison-
  20792. Wesley, 1990
  20793.  
  20794.   "Computers, Pattern, Chaos, and Beauty" Clifford Pickover;  St.
  20795. Martin's Press; "SIGGRAPH Conference Proceedings";   Association
  20796. for Computing Machinery Special Interest Group on Computer
  20797. Graphics
  20798.  
  20799.   "IEEE Computer Graphics and Applications";  The Computer
  20800. Society; 10662, Los Vaqueros Circle; Los Alamitos, CA 90720
  20801.  
  20802.   "The CRC Handbook of Mathematical Curves and Surfaces"  David
  20803. von Seggern; CRC Press; 1990
  20804.  
  20805.   "The CRC Handbook of Standard Mathematical Tables"  CRC Press
  20806.  
  20807.  
  20808.  
  20809.