POV Ray Tutorial

437
Welcome to If this is your first visit, you may want to start on the Path of Learning below. Or, if you are interested in specific information, you may want to browse through the Exploration Toolkit, Reference Shelf and Libraries below. You can also read about the Tutorial's design. If you're not sure where to find what you want, try the Help Desk. NEW!: A word about the release of POV-Ray 3.0. The Path of Learning The Path of Learning is meant to lead you, step by step, from a ray-tracing novice to a full-fledged POV-Ray expert. If you are a beginner, we recommend you start at Step 1. If used other ray-tracing programs before, or just can't wait any longer, jump ahead to step Step 3. Step 1: Introduction to POV-Ray and Ray-tracing What is ray-tracing? What is POV-Ray? If you've never done any ray-tracing before, this is a good place to start reading. It provides a brief overview of what ray-tracing is, how it works, and how it's used. This section will also tell you what exactly POV-Ray is, how it relates to the rest of the ray-tracing world, where to find it and how to set it up. Step 2: POV-Ray Basics The Online POV-Ray Tutorial http://library.thinkquest.org/3285/?tqskip=1 (1 of 4) [9/12/2001 3:15:15 PM]

Transcript of POV Ray Tutorial

Page 1: POV Ray Tutorial

Welcome to

If this is your first visit, you may want to start on the Path of Learning below. Or, if you are interested inspecific information, you may want to browse through the Exploration Toolkit, Reference Shelf andLibraries below. You can also read about the Tutorial's design.

If you're not sure where to find what you want, try the Help Desk.

NEW!: A word about the release of POV-Ray 3.0.

The Path of Learning

The Path of Learning is meant to lead you, step by step, from a ray-tracing novice to a full-fledgedPOV-Ray expert. If you are a beginner, we recommend you start at Step 1. If used other ray-tracingprograms before, or just can't wait any longer, jump ahead to step Step 3.

Step 1: Introduction to POV-Ray and Ray-tracing

What is ray-tracing? What is POV-Ray? If you've never done any ray-tracing before, this is agood place to start reading. It provides a brief overview of what ray-tracing is, how it works, andhow it's used. This section will also tell you what exactly POV-Ray is, how it relates to the rest ofthe ray-tracing world, where to find it and how to set it up.

Step 2: POV-Ray Basics

The Online POV-Ray Tutorial

http://library.thinkquest.org/3285/?tqskip=1 (1 of 4) [9/12/2001 3:15:15 PM]

Page 2: POV Ray Tutorial

What do I need to know before I start? This section covers all the vital information you need toknow before you can start creating your own scenes in POV-Ray, including the mathematicalbackground necessary (yes, there is a little) and information about source code.

Step 3: Creating Simple Scenes

How do I get started? This section covers the basics of scene creation in POV-Ray. If you'reanxious to get going, start here.

Step 4: Advanced POV-Ray Features

What else can POV-Ray do? This section covers some of the more powerful (and complex)elements of the language, including advanced objects, attributes, lighting techniques and cameraoptions.

Step 5: Conclusion

What now? A few words of advice, and some congratulations on your new-found skills. The(sigh) end of the Path of Learning.

Reference Shelf

If you need quick access to specific information, one of the resources below may be able to help you.

POV-Ray Language Reference

A searchable glossary of all keywords and directives of the POV-Ray language. Covers themeaning, syntax and usage of all POV-Ray terms.

Glossary / Index

A combination glossary and index containing ray-tracing, POV-Ray, and other technical terms, aswell as references to the Tutorial and Language Reference.

Command-line Parameter Reference

A complete description of all command-line parameters that POV-Ray takes, what they do, andhow to use them.

Tips and Tricks

Tips and tricks covering the practical and the artistic sides of ray-tracing. Find out how to saveyourself time in ray-tracing, as well as what makes your scene look realistic, artistic and, of course,cool.

The Online POV-Ray Tutorial

http://library.thinkquest.org/3285/?tqskip=1 (2 of 4) [9/12/2001 3:15:15 PM]

Page 3: POV Ray Tutorial

Libraries

The libraries below contain useful bits of information. You can browse through each of them, or evensubmit your own for the rest of the world to use.

Texture Library

A library of included and contributed textures. Contains source code and sample images for alltextures included with POV-Ray releases, as well as textures contributed by other readers.

Object Library

A library of built-in, included and contributed objects. Contains source code and sample imagesfor all non-primitive objects included in POV-Ray releases, as well as objects contributed by otherreaders.

Scenes Library

A library of nifty scenes, with source code! Feel free to contribute your own, if you think you'vegot something worth sharing.

Resource Library

A library of contributed POV-Ray resources: web pages, programs, and anything that can be of useto POV-Ray artists.

Exploration Tools

These tools are provided in order to give you a quick and accurate "look-and-feel" of many ofPOV-Ray's features. Note that if your web browser does not support forms, Javascript or Java, some ofthe tools may not work.

Color Tool

Displays the color corresponding to a particular RGB vector. The vector elements are selected bythe user. Helpful in finding the right color for an object.

Normal Tool

An explorable interactive graphical demonstration of all the normal attributes: bumps, dents,

The Online POV-Ray Tutorial

http://library.thinkquest.org/3285/?tqskip=1 (3 of 4) [9/12/2001 3:15:15 PM]

Page 4: POV Ray Tutorial

ripples, waves, and wrinkles.

Finish Tool

An explorabale interactive graphical demonstration of all the finish attributes: ambient, brilliant,crand, diffuse, phong, reflection, refraction, roughness, specular.

Top of Document

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial

http://library.thinkquest.org/3285/?tqskip=1 (4 of 4) [9/12/2001 3:15:15 PM]

Page 5: POV Ray Tutorial

The Online POV-Ray Tutorial

About the Tutorial's DesignA lot of thinking went into the design of the Online POV-Ray Tutorial. After discussion, we developedthree major design guidelines:

To take advantage of the abilities HTML presents;1.

To constrain presentation methods to the simple and intuitive; and2.

To design with the slow network in mind.3.

By the first, we mean that design should be based upon the original goal of HTML: to provide a cleanmethod of presenting information portable over various output devices. The authors feel that far too oftenWeb page designers lose track of this and attempt to use HTML as some kind of page layout system withmultimedia extensions, which it is most definitely not.

By the second, we mean recognizing the difference between situations that help the user to understandthe information and situations that hinder the user with confusing data. The authors' favorite example isthat of HTML frames: when done wrong (as is easy to do) frames quickly become a nightmare for theuser. When done right, however, frames become an extremely valuable tool. The authors feel that theirimplementation of frames in the Tutorial meets this guideline, and is as small and user-friendly aspossible.

By the third, we mean keeping the cutesy stuff to a minumum. The authors all have extensive experiencewith slow networks and know very well the frustration of waiting for unnecessary animations or largeimages to load; furthermore, given the relative income of the targeted population (students and theirschools) with respect to hardware, the authors feel that more likely than not many users of the Tutorialwill be subject to the same speed constraints they have been.

As such, the Tutorial has taken on several noticeable design characteristics:

It has stayed away from large images (except when specifically requested). Not only are they notportable across differently-sized screens (violation of design principle #1) but are also slow(violation of design principle #2);

It has stayed away from image maps. They provide a slower, clumsier version of what is alreadypossible (violation of design principle #2);

It has stayed stayed away from dinky animations and scrolling text displays. They bloat loadingtime with unnecessary information (violation of design principle #2).

It has done everything possible to make the information presented clear, fast, and easily accessible.●

The result is that the Tutorial is not as cutesy as it could be. There are no animations or music; there is alot of text and it is all the same size and color. There are small images, when needed to illustrate a point.There are large images, but only when specifically requested by the user. There are Java applets and CGIscripts, but only when the information must be interactive, or could not have been presented as intuitivelyanother way.

More importantly, the Tutorial is portable, compact, and fast. This is not an advertisement for some

The Online POV-Ray Tutorial: About the Tutorial's Design

http://library.thinkquest.org/3285/design.html (1 of 2) [9/12/2001 3:15:20 PM]

Page 6: POV Ray Tutorial

multimedia company, it is a serious piece of on-line reference material and contains a lot of information.We are not catering to your Saturday-morning-cartoon-bred need for jumping frogs and scrolling LEDdisplays, we are providing you with serious information when and where you need it. If this meanssacrificing a few image maps and animations for a little more speed and portability, so be it.

We feel that the final design of the Tutorial has met our guidelines fully, and that serious web users willnot only find the Tutorial informative and useable, but will appreciate the work we have put into thedesign as well as the data.

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: About the Tutorial's Design

http://library.thinkquest.org/3285/design.html (2 of 2) [9/12/2001 3:15:20 PM]

Page 7: POV Ray Tutorial

The Online POV-Ray Tutorial

Help DeskThe Help Desk is here to help you find what you're looking for. Browse the links below:

Question Advice

Don't know a thing about ray-tracing? Try starting on the Path of Learning. It willtake you, step by step, through all you need tobecome a ray-tracing expert (well, almost).

Need to find information on a specific topic? Search the Glossary / Index. It containsreferences to every single topic in the Tutorial.

Want to make your scenes look good? Try browsing the Tips and Tricks page. Itcontains valuable hints on how to up theartistic juice in your page.

Need to know the syntax for a specific command? Try searching the Language Reference. It willshow you the exact syntax, meaning andpurpose of every command in the POV-Raylanguage.

Trying to find the definition of a technical term? Try searching the Glossary / Index. It containsdefinitions of many terms relating toray-tracing and POV-Ray, and even a fewthings that aren't related.

Looking for just the right texture, or have one toshare?

Browse through the Texture Library. Itcontains sample textures included with thePOV-Ray software package or contributed byother users of the Tutorial.

Trying to catch a bird? Try putting salt on its tail.

Looking for a common object, or have one to share? Browse through the Object Library. It containssample objects included with the POV-Raysoftware package and contributed by otherusers of the Tutorial.

Can't find the right color? Experiment with the Color Tool. It will helpyou find just the right color, quickly andpainlessly.

The Online POV-Ray Tutorial: Help Desk

http://library.thinkquest.org/3285/helpdesk.html (1 of 2) [9/12/2001 3:15:25 PM]

Page 8: POV Ray Tutorial

Looking for ideas? Browse through the Scenes Library. You'll findgreat pictures and the source code behind them.

Need more information? Check out the Resource Library. It containslinks to other POV-Ray and ray-tracingresources on the Internet.

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Help Desk

http://library.thinkquest.org/3285/helpdesk.html (2 of 2) [9/12/2001 3:15:25 PM]

Page 9: POV Ray Tutorial

The Online POV-Ray Tutorial

Glossary / IndexA B C D E F G H I J K L M N O P Q R S T U V W X Y Z

A

Adaptive: used to specify the level of adaptive sampling done with area lights. Adaptive sampling is amethod of speeding up lengthy shadow calculations by only checking parts of the light for visibility.(Language Reference)

Agate: a pigment which has very swirly and turbulent bands of color. (Language Reference)

Ambient: in POV-Ray, an arbitrary amount of light added to an object to simulate the effects of ambientlight. (Language Reference) (Exploration Tool)

Ambient light: light so scattered from various objects that no discernable source is evident. See ambient.

Area Light: a type of light source which is used to create shadows with soft edges, instead of those withthe usual hard, well defined edges. (Language Reference)

Attenuate: to decrease in intensity with distance; usually referring to a light source.

Attribute: a property of an object; e.g. red.

Axis: a line of reference in a coodinate system.

B

Background: the POV-Ray keyword determining what color will be assigned to a light ray that does notintersect with any object. By default, this is black. (Language Reference)

Bicubic Patch: a complex mathematical object which can be used to describe an smooth surface inspace. POV-Ray uses triangles to approximate the surface. (Tutorial) (Language Reference)

Blob: another complex mathematical object which can be used to create organic and, well, blobby (forlack of a better way to describe them) objects. (Tutorial) (Language Referece)

Bounds: a simple object which surrounds a more complex one. When tracing, POV-Ray first doesintersection tests against the simple bounding object. If the ray does not intersect the bounding object, it

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (1 of 11) [9/12/2001 3:16:48 PM]

Page 10: POV Ray Tutorial

does not intersect the complex one (since the complex one is entirely inside the simple one). Thus,POV-Ray doesn't have to perform a lengthy test with the complex object. The bounded_by statement isused to assign bounds to an object. Automatic bounding objects is controlled with a command-lineparameter. (Command-line Parameter Reference)

Bounded By: this statement can be used to assign a bounding object to any other object. (LanguageReference)

Box: a three-dimensional geometric object that can be though of as a mathematically perfect... well, box.(Language Reference)

Bozo: a pigment which consists of splotches and swirls of color. (Language Reference)

Brilliance: in POV-Ray, an attribute that affects the angle between incoming light rays and an object;controls how polished or metallic the object seems. (Language Reference) (Exploration Tool)

Bump Map: a normal modifier which allows you to map a pattern of bumps around an object. Thepattern of bumps is specified with an image. (Language Reference)

Bumps: a normal modifier which gives an object the appearance of having a bumpy surface. Note thatthis does not actually change the surface, just how it looks. (Language Reference) (Exploration Tool)

C

Camera: the object which defines how you want to look at the scene. (Tutorial) (Language Reference)

Checker: a pigment which consists of alternating blocks of color. (Language Reference)

Clipped By: the clipped_by statement allows you clip away parts of an object. (Language Reference)

Clipping: refers to the use of one object to trim away parts of another. It is similar in function tointersection, except clipping shows an object's hollow interior. The clipped_by statement can be used toassign a clipping object to another object.

Clock: a built-in variable you can use to create simple animations. Its value is set by command-lineparameter. (Language Reference) (Command-line Reference)

Color: used to set the color of any number of things, including objects and light sources. (Tutorial)(Language Reference)

Color Map: a list of colors that is used by many pigments to color an object. The default color map is ablend from black to white. (Language Reference)

Comment: a section of source code that is ignored by POV-Ray; used for including human text in sourcecode files to improve clarity. (Tutorial) (Language Reference)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (2 of 11) [9/12/2001 3:16:48 PM]

Page 11: POV Ray Tutorial

Cone:a three-dimensional geometric object that can be thought of as a perfect, well, ice-cream cone(minus the ice cream, of course). POV-Ray also lets you easily create cone that have their points choppedoff, as well. (Language Reference)

Coordinates: a set of numbers specifying a point on a coordinate system. In POV-Ray, always in vectorform. (Tutorial)

Coordinate system: a mathematical system of describing absolute positions in terms of distance (anddirection) from a given point. (Tutorial)

Crand: in POV-Ray, used to simulate roughness or graininess on an object. (Language Reference)(Exploration Tool)

CSG: Constructive Solid Geometry; a technique of combining simple objects into much more complexones. CSG can be used to group objects together (union and merge), or use objects to carve away parts ofother objects (difference and intersection). (Tutorial) (Language Reference)

Cubic: A third-order polynomial object; i.e. a polynomial in which the highest power a variable is raisedto is 3. (Tutorial) (Language Reference)

Cylinder: A cone with equal radii throughout. (Language Reference)

D

#declare: a POV-Ray directive which allows you to assign a name to an object, texture, or just aboutanything else that can exist. You can also declare constant vectors and floats. Once you have this name,you can easily create multiple copies of the object with only a minimum of extra typing. (Tutorial)(Language Reference)

#default: this statement allows you to change the initial texture on an object. You can declare a defaultpigment (normally black), a default finish (normally unpolished), and a default normal (normally flat).(Language Reference)

Degree: a unit of angle measurement. 0 degrees corresponds to no tilt; 180 degrees corresponds to ahalf-turn; 360 degrees corresponds to a full turn. POV-Ray uses degrees whenever angles are required.Degrees above 360 and below 0 are valid, but are mapped back to between 0 and 360.

Dents: a normal modifier which makes an object look like a gorilla had at it with a sledgehammer. Theamount of denting can be adjusted between "baby gorilla" and "psychopathic gorilla". (LanguageReference) (Exploration Tool)

Difference: a CSG statement used to take an object and carve different shapes out of it. Really, adifference is just an intersection with some of the objects inverted. (Tutorial) (Language Reference)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (3 of 11) [9/12/2001 3:16:48 PM]

Page 12: POV Ray Tutorial

Diffuse: in POV-Ray, an attribute that controls how much of an object's color comess from direct light.(Language Reference) (Exploration Tool)

Disc: a two dimensional object which is basically a filled-in circle. You can also create discs with holesin the center. (Language Reference)

E

Eggplant: a vegetable (well, fruit technically) which insures that have something in the "E" category ofthis glossary. See kumquat.

F

Filter: an aspect of a color which defines how much light it transmits. (Tutorial) (Language Reference)

Finish: in POV-Ray, how objects interact with light; e.g. reflectivity, refractivity, roughness. (LanguageReference) (Tutorial) (Exploration Tool)

Finite Primitive: a primitive in POV-Ray with well-defined limits; i.e. no component deals with infinity.See also infinite primitive. (Language Reference)

Float: see floating point.

Floating Point: a real number.

Fog: used to add colored mist to a scene. Using small amounts of fog can greatly enhance the realism onnearly any scene. (Language Reference)

Frequency: a modifier for certain pigments and certain normals. With pigments, it controls how manytimes the color map is cycled through in a given "distance". With ripples and waves it controls thedensity of the waves. (Language Reference)

G

GIF: an image stored in CompuServe's Graphical Interchange Format. GIFs support 256 colors and anumber of other features. All in all, they are a good general purpose image format and are popularbecause of their good compression system and short decompression time..

Gradient: a pigment which consists of parallel planes of color. (Tutorial) (Language Reference)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (4 of 11) [9/12/2001 3:16:48 PM]

Page 13: POV Ray Tutorial

Granite: a pigment which consists of spots of on color surrounded by bands of other colors. When usedwith the proper color map, it can create a very convincing stone texture. (Language Reference)

H

Height Field: a surface created from an image file which basically defines a mesh of triangles in space.The height of each individual triangle is defined by the color of the pixel in the corresponding location inthe source image. This is the easiest and least painful way to create mountains. (Language Reference)

Hexagon: a pigment which consists of hexagonal cylinders of color running parallel to the y-axis of thespace. (Language Reference)

I

Icosahedron: a three dimensional geometric shape with 20 faces, all of which are equilateral triangles.POV-Ray doesn't come with a built in facility to create icosahedra, but there's an example with thetriangles in the Language Reference.

Image: a computer term for a displayable file. Generated by POV-Ray from source code files.

Image Map: a technique for wrapping an image around an object. Image mapping is perfect for coloringan object when the standard fare of pigments doesn't contain exactly what you need. (LanguageReference)

#include: a directive which tells POV-Ray to read the specified file as if its contents were actually part ofthe current file. It's very useful for creating libraries of objects or textures. (Tutorial) (LanguageReference)

Index of Refraction: how much a translucent object refracts light rays passing through it. (LanguageReference) (Exploration Tool)

Infinite Primitive: A primitive in POV-Ray which contains elements dealing with infinity; e.g. a plane.See also finite primitive.

Intersection: a CSG statement which is used to make a new object out of the regions that are inside twoor more other objects. It's similar to clipped_by, except intersections don't show a hollow interior.(Tutorial) (Language Reference)

Inverse: a keyword which tells POV-Ray to switch an object's "inside" and "outside". The only timeinside and outside of an object matter is when it's in a CSG object or if it's clipping another object.

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (5 of 11) [9/12/2001 3:16:48 PM]

Page 14: POV Ray Tutorial

(Tutorial) (Language Reference)

IOR: see Index of Refraction.

J

Jitter: refers to random jostling of things. When applied to area lights is causes the lights to be shaken upa bit to prevent shadow bands from forming. With anti-aliasing, it bumps the extra rays around a bit,which breaks up edges. (Language Reference) (Command Line Reference)

K

Kumquat: an orange-like fruit with an edible rind and a bitter pulp. Note that the only connection withPOV-Ray is that it puts something in the "K" section. See eggplant.

L

Leopard: a pigment which consists of regularly spaced spots of color, like a leopard's coat. Well, itwould have to be a very geometric leopard, but that's the basic idea. (Language Reference)

Light ray: an imaginary geometric line describing the path of light as it leaves the light source.

Light source: an object that emits light. See also point light source. (Tutorial) (Language Reference)

M

Mandel: a pigment which paints the famous Mandelbrot fractal onto an object. Surprisingly, this is notvery time consuming for all the extra calculation that must be done. (Language Reference)

Marble: a pigment which is a variation on the gradient theme. Marble also creates parallel planes ofcolor, but uses the color map in a different fashion. With some turbulence it can create a very goodlooking marble texture. (Tutorial) (Language Reference)

Material Map: a method for mapping complete textures around objects. Material maps use images astemplates to do a sort of "paint-by-numbers" operation on an object. Material maps are very powerful for

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (6 of 11) [9/12/2001 3:16:48 PM]

Page 15: POV Ray Tutorial

creating exciting textures. (Language Reference)

Merge: a type of CSG which is very similar to a union. However, a merge takes the resulting object andremoves an internal surfaces. This is primarily useful on transparent objects, where any internal surfaceswould be visible (bad). (Tutorial) (Language Reference)

Modeller: a program that provides a visual interface to creating scenes in POV-Ray; often extremelyuseful for large scenes in which mental visualization ccan be tricky. (Resource Library)

N

Near-photorealistic: obviously not taken from a physical camera (but not blatantly so)

Normal: in POV-Ray, surface effects simulated on objects by manipulation of light rays. (LanguageReference) (Tutorial) (Exploration Tool)

O

Object: a thing in space. Objects are what you see when you render a scene. Examples of objects arespheres, boxes, and CSG objects. (Language Reference)

Onion: a pigment which consists of concentric spheres of color, like the layers of skin on an onion.(Language Reference)

Origin: the center of a coordinate system. (Tutorial).

P

Phase: a keyword which modifies pigments and some normals. With pigments, it controls where thepigment begins when it looks at the color map. With ripples and waves it controls the position of thewaves. (Language Reference)

Phong: in POV-Ray, a bright highlight on an object caused by light rays hitting directly from a lightsource. (Language Reference) (Tutorial) (Exploration Tool)

Photorealistic: as if taken from a physical camera. See also near-photorealistic.

Pigment: in POV-Ray, how colors or patterns of colors are assigned to an object. (Language Reference)(Tutorial)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (7 of 11) [9/12/2001 3:16:48 PM]

Page 16: POV Ray Tutorial

Pixel: abbreviation for picture element. One of the thousands of tiny "dots" that serve to make up thedisplay portion of a computer screen.

Point light source: an infinitly-small light-emitting point. In POV-Ray, the simplest type of light source:invisible, non-attenuating, fast. (Language Reference) (Tutorial)

Polynomial: In POV-Ray, an object that can be described in mathematical terms as the summation of theproduct of the position vector elements x, y and z raised to some power and user-specified coefficients.Used to generated mathematically-defined objects. Also see quadric, cubic, and quartic. (Tutorial)(Language Reference)

Primitive: one of the basic building blocks of all objects in POV-Ray. Examples of primitives includeboxes, cones, and cylinders. (Tutorial)

Q

Quadric: A second-order polynomial object; i.e. a polynomial in which the highest power a variable israised to is 2. (Language Reference)

Quartic: A fourth-order polynomial object; i.e. a polynomial in which the highest power a variable israised to is 4. (Tutorial) HREF="language/iobject.html#quartic">Language Reference)

R

Radial: a pigment which takes the color map and wraps it around the y-axis. (Language Reference)

Ray-tracing: the process of mathematically generating near-photorealistic images form a givendescription of a scene or object via geometrical modeling of light rays. (Tutorial)

Real number: a number between positive and negative infinity that does not have any imaginarycomponents (an imaginary component is in terms of i, or the square root of -1); the type of number thatPOV-Ray works with.

Reflect: the process in which a light ray bounces off an object and continues travelling. (Tutorial)

Reflection: in POV-Ray, an attribute which controls how much an object will reflect its surroundings.(Language Reference) (Tutorial) (Exploration Tool)

Refract: the process in which a light ray is bent slightly when entering a translucent object.(Tutorial)

Refraction: a keyword which tells POV-Ray to refract light that is being transmitted by an object. Youalso need to specify an index of refraction. (Language Reference)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (8 of 11) [9/12/2001 3:16:48 PM]

Page 17: POV Ray Tutorial

Ripples: a normal modifier which makes the surface appear like a lake into which a stone was thrown. Itcreates nice, cirlcular ripples which originate from the origin. (Tutorial) (Language Reference)(Exploration Tool)

Rotate: a transformation which revolves an object around an axis of the space. (Tutorial) (LanguageReference)

S

Scale: a transformation which changes the size of an object. (Tutorial) (Language Reference)

Software: a set of instructions executed by a computer in the form of a program.

Source code: the human-generated code given to POV-Ray to be converted into an image.

Specular: in POV-Ray, a highlight similar to phong but more accurate, as far as physical laws areconcerned. (Language Reference) (Exploration Tool)

Sphere: a three-dimensional geometric object that can be thought of as a perfectly round ball. (Tutorial)(Language Reference)

Spotlight: a type of light source which only emits light in a certain direction. (Language Reference)

Spotted: a pigment which is identical to bozo, except it doesn't respond to turbulence. (LanguageReference)

T

Targa: an image stored in the TrueVision Targa format. Targas are versatile and easy to use, and cansupport 24-bit color. This makes them a good choice for POV-Ray output (see the F command lineparameter). Their only drawback is their size, as POV-Ray outputs them in an uncompressed format. Seealso GIF.

Texture: the texture of an object defines how it looks. It's one thing to have a sphere. It's another to havea striped, bumpy, reflective sphere. A texture is composed of a pigment, a finish, and a normal. (Tutorial)(Language Reference)

Torus: the mathematical name for a doughnut or ring shape. Technically, this is a quartic shape, but it'sso useful that POV-Ray authors created an easy way to define one. (Language Reference)

Translate: a transformation which moves an object to a new location. (Tutorial) (Language Reference)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (9 of 11) [9/12/2001 3:16:48 PM]

Page 18: POV Ray Tutorial

Translucent: able to let light pass though.

Triangle: a two dimesional object which has three vertices and three sides. Exactly what you'd expectfrom a triangle. (Tutorial) (Language Reference)

Turbulence: a pigment and normal modifier which can be used to stir up a pattern. (LanguageReference)

U

Union: a CSG object which takes a number of objects and combines them together into one. (Tutorial)(Language Reference)

Unit: an arbitrary dimensionless quantity; valid in comparison only to itself. The basic unit of physicaldimension in ray-tracing.

V

Vector: a set of related numbers. In POV-Ray, enclosed with angle braces, such as <0,0>.(Tutorial)

W

Waves: a normal modifier which creates waves on the surface of an object. Waves are similar to ripples,except waves are not evenly spaced. (Language Reference) (Exploration Tool)

White space: the computer term referring to all "invisible" characters -- spaces, tab characters, new linecharacters, etc.

Wood: a pigment which consists of concentric cylinders of color, kind of like growth rings in a tree.(Language Reference)

Wrinkles: a normal modifier which makes a surface appear like it had been wadded up and thenstretched back out again. Either that, or left out in the sun too long. (Language Reference) (ExplorationTool)

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (10 of 11) [9/12/2001 3:16:48 PM]

Page 19: POV Ray Tutorial

X

X: a built-in vector (actually x, as far as case is concerned) with the value <1, 0, 0>.

Y

Y: a built-in vector (actually y, as far as case is concerned) with the value <0, 1, 0>.

Z

Z: a built-in vector (actually z, as far as case is concerned) with the value <0, 0, 1>.

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Glossary / Index

http://library.thinkquest.org/3285/glossindex.html (11 of 11) [9/12/2001 3:16:48 PM]

Page 20: POV Ray Tutorial

The Online POV-Ray Tutorial

LightsThe following topics are covered in this section.

Adaptive●

Area Light●

Falloff●

Jitter●

Light Source●

Looks Like●

Point At●

Radius●

Spotlight●

Tightness●

The following scene will be used to demonstrate the effects of different lighting effects.

AdaptiveThe adaptive keyword controls the rendering of area lights. Normally, when you create an area light,POV-Ray has to test the visibility of each point in the array. So for a 5 by 5 area light, POV-Ray has todo 25 times as much work to light one surface than it normally would. The adaptive keyword tellsPOV-Ray to use adaptive sampling of the area light. Adaptive sampling works by only testing thecorners of the light for visibility. If about the same amount of light is received from each corner,POV-Ray assumes the light is either fully visible or fully blocked. If different amounts of light arereceived, POV-Ray assumes the light is partially visible and divides the light up further to determine howmuch shadow to use. The parameter for adaptive is an integer, greater than or equal to zero, whichcontrols the minimum amount of subdividing to use. With "adaptive 0", POV-Ray will do its initial testwith only four rays (each of the corners). While this is fast, it can lead to errors in the shadows (which

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (1 of 8) [9/12/2001 3:17:36 PM]

Page 21: POV Ray Tutorial

manifest themselves as bright spots where there shouldn't be any). "adaptive 1" will initially test with 9rays, "adaptive 2" will initially test with 16 rays, etc. Note that POV-Ray will not do an adaptive test withmore rays than you have lights in the array. This means that if you have an array with 10 lights, usinganything higher than "adaptive 1" won't do any adaptive sampling.

Area LightArea lights are used to spread out shadows to make them more realistic. One of the hallmarks ofraytraced or computer generated images is the hard, well-defined shadow boundaries. This results fromthe zero dimensional quality of the standard light source. Since the light is a point, it's either visible, orit's not. Hence an area is either shaded, or it's not. Area lights can rectify this situation somewhat. Theywork by spreading the intensity of the light out into a rectangle. Since the light now has an area, it can bepartially blocked, leading to shadows which have soft edges. The general syntax for declaring an arealight like this

light_source { <location> color color

area_light <side-1>, <side-2>, len-1, len-2 [adaptive adaptive value] [jitter]

/* specifications for spotlight, if desired */}

Adaptive and jitter are both optional, and are covered in their own sections.

side-1 and side-2 are <x, y, z> vectors describing the orientation of the sides. Since area lights arerectangular, these vectors should be perpendicular. Your light will not end up like you intended if theyare at some weird angle. The lengths of these vectors correspond the lengths of the sides. len-1 and len-2are the number of lights along the corresponding dimensions of the light. For example

light_source { <0, 0, 0> color White

area_light <2, 0, 0>, <0, 0, 2>, 6, 6}

This defines an area light centered at <0, 0, 0> in the x-z plane. The light is two units on a side andcontains 36 point sources. The intensity of the light is divided evenly between the 36 points.

Interesting shadow effects can be created with linear lights. A linear light is an area light that only hasone light along one of its dimensions. This can be used to simulate fluorescent light bars.

Here's a sample image using an area light instead of a point source. Note how the shadows get softer

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (2 of 8) [9/12/2001 3:17:36 PM]

Page 22: POV Ray Tutorial

towards the top of the image.

For more information on declaring light sources, see the light source section.

FalloffThe falloff keyword only applies to spotlights. The float parameter for falloff controls the angle at whichthe lighting from the spotlight goes to zero. This parameter should always be larger than the radius valueand smaller than 180. Setting this to the same value as the radius of the hot spot gives the spotlight a hard(and rather unrealistic looking) edge. The larger the falloff value, the softer the edge. The tightnessparameter can control exactly how the light falls off between the radius value and the falloff value. Aswith the radius keyword, the parameter for this keyword is the angle (in degrees) between the center ofthe hotspot and the edge of the lit area.

The following images give examples of the falloff keyword. All three images use "radius 1.5". The firstuses "falloff 1.5" (note the hard edge on the light), the second uses "falloff 2", and the third uses "falloff3".

The falloff radius for a spotlight needs to be specified. For more information about declaring lights, seethe light source section.

JitterThe jitter keyword only applies to area lights. This keyword is just a toggle, it takes no parameter. If youuse jitter in an arealight, for each ray traced, the individual point sources in the light are moved a small

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (3 of 8) [9/12/2001 3:17:36 PM]

Page 23: POV Ray Tutorial

random amount. This creates smooth shadows that don't have bands of different intensity. This featurecan be used to create nice, smooth shadows without gargantuan area light that take years to render.However, jitter is one of the few completely random features of POV-Ray (like crand) and will not be thesame in two traces of the same scene. For this reason, using jitter in animations is probably a bad idea.

Light SourceThe light_source declaration allows you to declare various types of lights for your scenes. Light sourcesare what give your objects three dimensionality. It's possible to "light" a scene completely with ambientlighting, but this produces objects which look unexciting and rather two dimensional. Well placed lightsources, in combination with good surface finishes well make your objects appear extremely lifelike.Four types of light sources can be defined. The most basic is the point source. This is a geometric pointfrom which light rays eminate. Its only properties are its color and its position. The second type of lightis a spotlight. Spotlights are basically point sources which only cast their light in certain directions. Thethird type of light is an area light. These lights are no longer simgle points, but rather arrays of lightswhich can be used to make more realistic shadows. The fourth type is a spot area light. This is just adirectional area light. But anyway, here's the general form for a light source.

light_source {/* these two are required */ <location> color color-spec

/* optional area light specifiers */ area_light <side-1>, <side-2>, len-1, len-2 adaptive adapt level jitter

/* optional spotlight specifiers */ spotlight point_at <target> radius hotspot radius falloff falloff radius tightness tightness

/* misc. optional specifiers */ looks_like { object { obj } }}

The two required components of a light source are its location and its color. All light sources must have

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (4 of 8) [9/12/2001 3:17:36 PM]

Page 24: POV Ray Tutorial

these defined. The location is a standard three component <x, y, z> vector. The color parameter is used todefine the color of the light source (go figure). The usage of color is covered elsewhere.

The spotlight specifiers are used to turn the light into a spotlight. Spotlights can be used to emphasizeparts of a scene, or just to light things selectively.

The area light specifiers change the light from a zero dimensional object into a one or two dimensionalobject. They can be used to create objects that have soft-edged shadows, instead of the hard, well definededges produced by point lights. They can be used in conjunction with spotlights to confine the softshadow calculations to a certain area of the scene.

The looks_like parameter is just sort of weird. It can be used to assign a "shape" to the light. THe objectspecified is automatically translated to the location of the light source and has the no shadow keywordset.

The source for the various sample scenes shown in this section will give numerous examples of thedifferent types of light sources.

Looks LikeThe looks_like parameter can be used to assign a shape to a light source. Normally, individual lightsources are just invisible points which radiate light. This applies to area lights, too, as they are justcollections of points sources. Any object may put in the looks_like field. Note that the object will beautomatically translated to the location of the light source. Also, the object is automatically set to not casta shadow (see no_shadow). If this were not done, the light source object would not let any of the lightthat was on the inside out. This would be bad. If you want the associated object to cast a shadow, you caninclude the light source in a union. Here's an example of "looks_like".

light_source { <50, 50, -50> color White looks_like { sphere { <0, 0, 0>, 0.5 pigment { color rgb <0.8, 0.8, 1> } } }}

Note how the sphere is created at the origin. Again, this is because it will be automatically translated tothe light_source's location. Declaring the sphere's center to be at <50, 50, -50> would result in the spherebeing moved again (and ending up at <100, 100, -100>).

For more information on declaring light sources, see the light source section.

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (5 of 8) [9/12/2001 3:17:36 PM]

Page 25: POV Ray Tutorial

Point AtThe point_at keyword is a required specifier for spotlights. It declares the point at which you wish thelight source to point (it's similar to look_at for cameras). This parameter is used to orient the light; all inall, it's pretty intuitive. Enjoy some sample images. The first pointed at <0, 0, 0>, the second at <0, 10,0>.

For information on declaring light sources, see the light source section.

RadiusRadius is used to specify the size of the central highlight in a spotlight. It must be specified for allspotlights. The best way to think of a spotlight is as a cone of light originating from the light source. Theparameter for radius is a float specifying the angle (in degrees) between the central axis of the cone, andthe edge of the cone which defines the hot spot. This is similar to the parameter for falloff. The value forradius should always be less than the value for falloff. Here are some sample images for varying radii.The first has a radius of 0.75, the second 1.5, and the third 2.5.

For more information on declaring light sources, see the light source section.

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (6 of 8) [9/12/2001 3:17:36 PM]

Page 26: POV Ray Tutorial

SpotlightSpotlights allow you to specify directed lights. The default type of light source is a point that radiateslight in all directions. A spotlight is a point that radiates light only in specified directions. You can turnany light into a spotlight by specifying the keyword "spotlight" in its declaration. Anyway, the followingis the general syntax for a spotlight.

light_source { <location color color spec

spotlight point_at <target> radius radius falloff falloff radius [tightness tightness]}

All of the above parameters have to be specified except for tightness, which is optional. A spotlightbasically can be considered to be two coaxial cones of light. The inner cone is fully lit by the pointsource at the location. Its angular radius is specified by the "radius" keyword. The outer cone is theregion in which light falls off from fully lit (at the radius angle) to unlit (at the angle specified for"falloff"). The tightness keyword can be used to control how the light falls off in the angles betweenradius and falloff radius. Although the POV-Ray authors say that your radius may be up to 180, in myexperience, POV-Ray won't render any light beyond the 90-degree mark. Anyway, here's an example ofa spotlight.

Note how only the regions around the "point_at" point are lit. The region is elliptical because the light isnot shining straight down at the "point_at" point.

For more information on declaring light sources, see the light source section.

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (7 of 8) [9/12/2001 3:17:36 PM]

Page 27: POV Ray Tutorial

TightnessTightness is an optional modifier for spotlights. It controls how the light falls off the zero at the edge ofthe falloff radius. It also controls (to a much lesser extent) the falling off of light in the central hot spot.The default tightness is 10. Values can range to nearly zero (but zero itself is bad) for a very soft-edgedspotlight, and up to 100 for a very tight edged spotlight. Here are some variations on tightness, renderedwith "tightness 1", "tightness 10", and "tightness 100" respectively.

For more information on declaring light sources, see the light source section.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Lights

http://library.thinkquest.org/3285/language/light.html (8 of 8) [9/12/2001 3:17:36 PM]

Page 28: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light.pov

http://library.thinkquest.org/3285/language/src/light.pov [9/12/2001 3:17:40 PM]

Page 29: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1> area_light <0, 30, 0>, <30*sqrt2_2, 0, 30*sqrt2_2>, 8, 8 adaptive 2 jitter}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light1.pov

http://library.thinkquest.org/3285/language/src/light1.pov [9/12/2001 3:17:41 PM]

Page 30: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 1.5 falloff 1.5}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light2.pov

http://library.thinkquest.org/3285/language/src/light2.pov [9/12/2001 3:17:42 PM]

Page 31: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 1.5 falloff 2}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light3.pov

http://library.thinkquest.org/3285/language/src/light3.pov [9/12/2001 3:17:45 PM]

Page 32: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 1.5 falloff 3}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light4.pov

http://library.thinkquest.org/3285/language/src/light4.pov [9/12/2001 3:17:50 PM]

Page 33: POV Ray Tutorial

The Online POV-Ray Tutorial

Finish ReferenceThe topics covered in this section are the following

Ambient●

Brilliance●

Crand●

Diffuse●

Finish●

Ior●

Metallic●

Phong●

Phong Size●

Reflection●

Refraction●

Roughness●

Specular●

Here's the basic test scene used to render the examples. For comparison, this one uses only the defaultfinishes.

All images in this page are links to the scene file that generated them.

AmbientThem ambient finish controls how much of the color of a surface comes from ambient lighting. Itsparameter is a float value in the range 0.0 to 1.0 (typically). Ambient light is light in a scene that comesfrom no specific source. It's used to adequately model light that bounces off of objects. This light cannotbe efficiently modelled by raytracing due to the "backward" nature of tracing rays. POV-Ray cheats by

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (1 of 9) [9/12/2001 3:18:47 PM]

Page 34: POV Ray Tutorial

instead just mixing in a little bit of white to every pigment. The ambient value of an object controls howmuch white is mixed in. The default value is 0.1. A value of 0.0 means that objects that are not directlylighted will be completely black. Low values mean that objects which are not directly lit will retain someof their color. Higher values can make an object appear to glow (although it will not actually emit anylight). The images below show basically how ambient lighting works. The first is the default, the secondis rendered with ambient 0.6.

For more information about declaring finishes, see the finish section.

BrillianceBrilliance modifies the behavior of diffuse lighting. Brilliance takes a float parameter which modifieshow diffuse light bounces off an object. The default value is 1.0. The way diffuse lighting works is bycalculating the angle between the surface and the incoming light ray. The flatter this angle is, the less thesurface is illuminated. Higher brilliance values make the light illuminate less at flat angles. This canmake the object appear more polished or metallic. Values that are less than one cause the light toilluminate more at low angles, giving the surface a somewhat softer and less smooth feel. The first imagebelow was rendered with the default, the second with brillance 5, and the third with brilliance 0.2.

For more information about declaring finishes, see the finish section.

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (2 of 9) [9/12/2001 3:18:47 PM]

Page 35: POV Ray Tutorial

CrandCrand can be used to simulate very rough surfaces like concrete and sand which have grainy surfaces.Crand works by randomly darkening pixels of the object to create a grainy shadow effect. Crand takes afloat parameter from 0.0 to 1.0. The default is 0.0. Usually you shouldn't need more than very low values(such as 0.1). Higher values result in your objects turning into random pixel messes. Crand has someinteresting features which can make it somewhat intractable, though. First off, because it's applied topixels and not to objects, it looks the same on large objects as on small. It also changes when you changethe resolution of the image. Finally, crand is one of the few completely random features in POV-Ray,which means that you should not use crand in animations, unless you want your objects to look likestatic. Anyway, the first image is again the default, while the second has crand 0.1 thrown in.

For more information about declaring finishes, see the finish section.

DiffuseThe diffuse lighting model is the main way objects are lit. By default most of the coloring of an objectcomes from diffuse lighting. Diffuse light is basically light that comes from a light source and diffuses inall directions. It illuminates objects by striking them directly. Any object which does not have a direct,unblocked line to a light source will not be lit by diffuse lighting and will have to be lit by other models(ambient, for example). Light that directly lights a surface does so as a function of the angle at which ithits the surface. A surface which has the light source directly overhead will appear brighter than a surfacewhich is lit from a very low angle. This angle effect can be modified to some extent by the brilliancekeyword. The diffuse keyword takes a float parameter which expresses how much of an object's colorcomes from direct (diffuse) lighting. The value can range from 0.0 (no light from light sources) to 1.0(very well lit). The default value is 0.6. Here are a few sample images for your viewing (andunderstanding) pleasure. The first is the default, the second has diffuse 0.3, and the third has diffuse 0.9.

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (3 of 9) [9/12/2001 3:18:47 PM]

Page 36: POV Ray Tutorial

For more information on declaring finishes, see the finish section which, conveniently, is next.

FinishThe finish statement is used to define how objects interact with light. Specifying a finish for an objectallows you to make the object mirrored, appear polished, appear to glow, or any number of other things(if you're wondering, the above effects can be created through use of reflection, phong or specular, andambient, respectively). But moving along, the general format for a finish declaration goes something likethis

finish { ambient ambient lighting brilliance brilliance crand crand amount diffuse diffuse lighting ior index of refraction metallic phong phong highlighting phong_size phong size reflection reflected light refraction refract toggle roughness roughness specular specular highlighting}

All of the parameters for the finish specifiers are float values (except for metallic which takes noparameter). The individual sections have more specific information about each type of finish. But hereare some general things to keep in mind.

The sum of the values of ambient, diffuse, and reflection should be about 1.0. Much higher, andyour colors will saturate and look flat. Much lower, and your colors will appear dark.

Objects with reflection and refraction (actually, any object with a nonzero filter) will increase yourrendering time. Reflection requires an extra ray to be traced to determine the reflected color, whilewith transparent objects, an extra ray must be traced to determine the color that is being filtered.

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (4 of 9) [9/12/2001 3:18:47 PM]

Page 37: POV Ray Tutorial

You usually don't need both phong and specular highlights.●

The argument to refraction should be 1 or 0 only.●

Finishes can be declared like just about anything else. All the of the example finish images were renderedusing delcared finishes. As finishes aren't based on absolute locations, transforming them doesn't makesense.

IorThis value controls the index of refraction for transparent objects which refract. See refraction.

MetallicThe metallic keyword is a modifier for the phong and specular highlights. It basically means that thehighlight on an object should be modified by the object's surface color, and not just determined solelyfrom the color of the light source. Metallic takes no parameter; either it's there or it's not. This keywordwill have no effect if there isn't either phong or specular highlighting on an object. See either of thosetopics for information on highlights. The following sample images will almost undoubtedly explain thisbetter than I have. The first was rendered with phong highlighting without metallic, and the second iswith metallic.

For more information on declaring finishes, see the finish section.

PhongThe phong keyword creates a highlight on an object that is the color of the light source. This is done bycomparing the angle you're looking at a surface to the angle at which the light is striking the surface. Ifthese angles are opposite and approximately equal, the color of the light is mixed into the color of theobject. This highlight is similar to the one created with specular. Typically, phong and specularhighlights are not both used on the same object. Phong takes a float parameter which expresses howbright the highlight should be. A value of 1.0 (the max) causes a complete saturation of the light's color

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (5 of 9) [9/12/2001 3:18:47 PM]

Page 38: POV Ray Tutorial

at the center of the highlight. Lesser values cause less complete saturations. The size of the highlight canbe controlled with the phong_size parameter. These images will show exatly what phong highlights looklike. Note that there is no highlight on the box because none of the faces are oriented to reflect the lightinto the camera.First image: no highlights, second image: phong 0.9

Note that this finish does not actually make the object relfective. For that, see the reflection keyword.

If you're wondering, this lighting model was named for the person who devised it.

For more information on declaring finishes, see the finish section.

Phong SizeThe phong_size parameter is a modifier for the phong finish. It takes a float parameter (greater than zero)which defines how large the phong highlight will be. Typical values range from 1 (pretty dull) to 250(very shiny). The default is 40. Higher values make the highlight tighter, creating a surface which looksvery polished. Low values spread the highlight out a lot and make the surface appear dull. The imagesbelow were rendered with "phong_size 40" (default), "phong_size 4", and "phong_size 180",respectively. All have "phong 0.9".

Note that the phong_size parameter is ignored if there isn't a phong finish. This parameter has a similarfunction to the roughness parameter for specular. For more information on declaring finishes, see thefinish section.

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (6 of 9) [9/12/2001 3:18:47 PM]

Page 39: POV Ray Tutorial

ReflectionThe reflection finish gives an object a mirrored or partially mirrored surface. This object will then reflectother objects in the scene. This keyword takes a float parameter (between 0 and 1) which describes howmuch reflected color to mix in. A value of 0 turns off reflection for the object, a value of 1 gives theobject a perfectly mirrored surface (almost). To get an absolutely perfect reflector, you also need tospecify "ambient 0" and "diffuse 0" in your finish statement. This will turn off all other coloring for theobject. Normally you don't need high reflection values on objects that aren't suppose to be mirrors. Evenfor surfaces that are glass, a reflection value of 0.1 is sufficient to make it look realistic. Another thing tokeep in mind about reflecting objects is that they will take longer to render. For every ray that strikes areflective object, another ray has to be traced to determine what the first surface reflects. This can reallyadd up if you have a lot of reflective objects. If you start having problems with reflective surfaces beingrendered as black, try modifying the max_trace_level. But anyway, here's an example of reflection. Thefirst scene has no reflection, the second has reflection 0.3.

Note how even with this small amount of reflectance, the objects appear very reflective. Reflection tendsto like quite nice with a some phong or specular thrown in.

For more information on declaring finishes, see the finish section.

RefractionRefraction only has meaning on objects that have at least a little bit of transparency. Refraction is thebending of light rays as they pass into a more dense or less dense medium. As light does not go throughopaque things, they don't refract. Without refraction, transparent objects look like colored air. Therefraction keyword takes one of two parameters either 0 (disable refraction) or 1 (enable refraction). It islegal to specify in between values, but the POV-Ray authors strongly recommend against it. In theirwords,

Values in between will darken the refracted light in ways that do not correspond to anyphysical property. Many POV-Ray scenes were created with intermediate refraction valuesbefore this "bug" was discovered so the "feature" has been maintained. A more appropriateway to reduce the brightness of refracted light is to change the "filter" value in the colorsspecified in the pigment statement.

You should also be aware that specifying "refraction 1.0" does not make an object transparent. You need

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (7 of 9) [9/12/2001 3:18:47 PM]

Page 40: POV Ray Tutorial

to use filter in your pigment to make an object transmit light.

Now, specifying "refraction 1.0" alone does not change the way your object looks. It will still lookamazingly like colored air. This is because the default ior (index of refraction) is the same as thesurrounding empty space. The index of refraction describes how much light bends when it passes intoand out of an object. Ior values are positive, and typically greater than 1.0. Empty space is arbitrarilydefined to have "ior 1.0" (the default in POV). You can change the ior of a refracting object with the"ior" keyword. Some examples of indices of refraction are "ior 1.000292" (air) "ior 1.33" (water), and"ior 1.5" (glass).

For the following example images, the filter value of the objects was set to 1.0. The first image has norefraction, the second has "ior 1.5", and the third has "ior 2.0".

For more information on declaring finishes, see the finish section.

RoughnessThe roughness parameter controls the size of the highlight produced by the specular keyword. Typicalvalues range from 1.0 (sand paper) to 0.0005 (polished glass). The default roughness is 0.05. High valuesgive very a very soft, very large highlight. Small values give a very small, tight highlight. 0 is a very badnumber for roughness. Roughness is to specular as phong_size is to phong. Here are some roughnessexamples. All use "specular 0.9". The first uses the default roughness, the second uses "roughness 0.75",the third "roughness 0.001".

For more information on declaring finishes, see the finish section.

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (8 of 9) [9/12/2001 3:18:47 PM]

Page 41: POV Ray Tutorial

SpecularThe specular finish is similar to phong, but this one is more accurate as far as physical laws areconcerned. It produces a highlight on the object where the reflection of the light source would be if theobject were reflective. This keyword takes a parameter between 0.0 and 1.0 which describes how muchspecular highlighting to use on an object. 0.0 (default) creates no highlight, while 1.0 creates a highlightwhich is completely saturated to the color of the light_source. The size of the highlight can be controlled(to some extent) with the roughness parameter. Here's what specular (0.9) looks like.

For more information on declaring finishes, see the finish section.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Finish Reference

http://library.thinkquest.org/3285/language/finish.html (9 of 9) [9/12/2001 3:18:47 PM]

Page 42: POV Ray Tutorial

#declare Fin = finish {// just default}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin.pov

http://library.thinkquest.org/3285/language/src/fin.pov [9/12/2001 3:18:51 PM]

Page 43: POV Ray Tutorial

#declare Fin = finish { ambient 0.6}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin1.pov

http://library.thinkquest.org/3285/language/src/fin1.pov [9/12/2001 3:18:53 PM]

Page 44: POV Ray Tutorial

#declare Fin = finish { brilliance 5}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin2.pov

http://library.thinkquest.org/3285/language/src/fin2.pov [9/12/2001 3:18:57 PM]

Page 45: POV Ray Tutorial

#declare Fin = finish { brilliance 0.2}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin3.pov

http://library.thinkquest.org/3285/language/src/fin3.pov [9/12/2001 3:18:58 PM]

Page 46: POV Ray Tutorial

#declare Fin = finish { crand 0.1}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin4.pov

http://library.thinkquest.org/3285/language/src/fin4.pov [9/12/2001 3:19:01 PM]

Page 47: POV Ray Tutorial

#declare Fin = finish { diffuse 0.3}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin5.pov

http://library.thinkquest.org/3285/language/src/fin5.pov [9/12/2001 3:19:06 PM]

Page 48: POV Ray Tutorial

#declare Fin = finish { diffuse 0.9}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin6.pov

http://library.thinkquest.org/3285/language/src/fin6.pov [9/12/2001 3:19:10 PM]

Page 49: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Language ThingsThis section covers POV-Ray directives, object transformations, and various miscellaneous features.These include

Background●

Clock●

Comment●

Declare●

Default●

Fog●

Include●

Max Intersections●

Max Trace Level●

Rotate●

Scale●

Transformations●

Translate●

Version●

X, Y, and Z●

BackgroundThe background statement allows you to change the background color of the image. Any rays which donot strike any objects are colored with the background color. This must be a solid color; fancy pigmentsand textures are not allowed. Also, Objects do not cast shadows on the background. All in all, thebackground will look positively flat, but it also requires no extra effort from the POV-Ray to change thebackground color. This effect sometimes be exactly what you need, other times it'll just make your scenelook strange. The syntax for specifying the background is as follows.

background { color color-spec}

color-spec is any solid color, whether declared with a name or defined with rgb. Here are two example

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (1 of 13) [9/12/2001 3:19:25 PM]

Page 50: POV Ray Tutorial

background statements.

background { color Red}

background { color rgb <0.3, 0.6, 0.7>}

Note that you should only have one background statement in your scene file. If you want a texturedbackground, try using a "sky sphere." This is a large sphere (radius of maybe 10000) on which you placea texture. Note that the texture will doubtless have to scaled up (by a factor oy maybe 5000. it depends onthe texture). If you don't want objects to cast shadows on your sky sphere, include the followingstatements in the sky sphere's finish.

finish { diffuse 0 ambient 0.7}

This will make your sphere look somewhat flat, too, but that may be the effect you want from your sky.As always, experiment with it until you get something you like.

Clock"clock" is a float whose value is controlled by the +K command-line parameter. You can use it to createsimple animations with ease (although it won't help you with complex stuff). For example to make asimple animation of a sphere orbiting the origin, you might try this

sphere { <5, 0, 0>, 1 rotate clock*y}

Then you could render this scene with +K0, +K15, +K30, etc, to get your frames. This is much moreconvenient than modifying your scene file for each frame. The value of clock is 0 if no +K argument isgiven to POV-Ray.

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (2 of 13) [9/12/2001 3:19:25 PM]

Page 51: POV Ray Tutorial

CommentComments are used to describe what you were thinking in English (or whatever language you speak).Commenting a scene makes it much easier to return in a week and modify it. Nothing's worse thenhaving a scene that you can't do anything with because you can't figure out what you meant.

Comments in POV-Ray follow the C++ syntax. By putting the characters "//" on a line, any charactersafter it (on that line) will be ignored. This kind of comment ends when the line does. You can also start acomment with "/*". Then, any and all characters will be ignored until POV-Ray sees a "*/" to end thecomment. This kind of comment can stretch as many lines as it needs to; it won't end until a "*/" is read.Here are some examples of comments.

/* following these line, there will be a sphere declaration just so you know */

sphere { <1000, 0, 0>, 10 pigment { color Red } rotate 45*y // rotate sphere into position}

That code segment demonstrates both kinds of comments. Note that you can include //'s in /**/comments without a problem. But including other /**/ comments inside a /**/ comment may or may notwork. Take for example

/* outer comment /* inner comment */ boogaboogabooga*/

With this segment, the first */ encountered ends the comment. Thus the "boogaboogabooga" is(unsuccessfully) parsed by POV-Ray, which promptly generates an error. However, in some versions ofPOV-Ray, you are allowed to nest comments, so the previous example may not apply to you.

Comments are also useful for when you're debugging a scene. If there's some object that's generating anerror, but you don't know what it is, you can go through and comment out blocks of code. If the errorgoes away, you know that the code you just commented out was causing it.

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (3 of 13) [9/12/2001 3:19:25 PM]

Page 52: POV Ray Tutorial

#declareThe declare directive is used to create object definitions without actually creating the objects. It can beused with floats and vectors to declare constants, or to declare pigments, finishes, textures, objects, oranything else in POV-Ray. Note that declare does not create a macro. To use, for example, a declaredtexture, you need to enclose the name in texture statement. Declares are incredibly useful for creatingseveral duplicates of a very complex object. For example

#declare Complex_Object = union { /* pages and pages of object code is omitted */}

object { Complex_Object}

object { Complex_Object translate <5, 0, 0>}

object { Complex_Object translate <-5, 0, 0>}

Once an indentifier is declared, that identifier can be used anywhere in the scene after the declaration.You can also use declared things in other #declare statements. Note that declared names, as witheverything else in POV-Ray are case sensitive. The POV-Ray authors recommend that your declarednames should have some upper case letters in them to distiguish them from built in things, and to keepthem from conflicting with reserved words.

One thing to keep in mind about declared objects is that any texture statements inside the #declare willoverride any applied to the object outside the #declare. Take, for example, the following segment

#declare Ack = 2#declare Moo = 0.6

#declare Blue = color rgb <0, 0, 1>#declare Green = color rgb <0, 1, 0>

#declare SomewhatBumpy = normal { bumps Moo }

#declare Spheres = union { sphere {

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (4 of 13) [9/12/2001 3:19:25 PM]

Page 53: POV Ray Tutorial

<-1, 0, 0>, Ack pigment { color Green } } sphere { <1, 0, 0>, Ack }}

object { Spheres pigment { color Blue } normal { SomewhatBumpy }}

Note that #declares can be used to improve readability (as with Green and Blue) and to degradereadability (as with Ack and Moo). In some cases, it really does make more sense to just use the number.

This will produce a smooth green sphere and a bumpy blue one. Note that the normal in the objectstatement won't apply to the green sphere, because the pigment carries an implied texture. This impliedtexture includes a normal statement which won't be overridden.

The methods for declaring all the various types of things that you can declare (almost anything, as notedabove) are covered in a great deal of depth in the POV-Ray documentation, so they won't be duplicatedhere.

#defaultThe #default directive is used to modify the default texture for all the objects in a scene. For example, ifyou want to remove all the ambient lighting from everything in a scene, you could go to every object andadd

finish { ambient 0}

But this gets tedious for large scenes. Instead, you could just put the statement

#default { finish { ambient 0 }}

This tells POV-Ray to automatically include "ambient 0" in every object. You can also specify a defaultpigment (normally solid, flat black) or a default normal (normally flat). As another example, if you

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (5 of 13) [9/12/2001 3:19:25 PM]

Page 54: POV Ray Tutorial

wanted every object in a scene to be heavily dented and red (unless you specified otherwise in the objectdeclaration), you could do

#default { pigment { color rgb <1, 0, 0> } normal { dents 1.0 }}

The #default directive is basically just a time saver. It saves you from having to type or block copy thesame thing over and over and over and . . . well, you get the idea.

FogThe fog statement allows you to add fog of any color and density to your scene. POV-Ray models fog bycalculating the distance to an intersection, and then mixing in the fog's color based on that distance(higher distance = more fog color). Computing fog is computationally cheap and can add a great deal ofrealism to a scene. The basic form for declaring fog is

fog { color color-spec distance dist}

color-spec is any solid color. Any filter component for the color will be ignored by POV-Ray. dist is afloat specifying the distance at which the color will be 63% the fog color. The equation for calculatingfog density is as below. depth is the distance to the intersection, and dist is the value specified above.

fog density = 1 - exp(-depth / dist)

The exp function raises e (2.718281828459...) to the power of its argument.

So when depth and dist are the same, you get

1 - exp(-1)1 - 0.36790.6321

which corresponds to 63% fog color. The other 37% of the color comes from the pigment of the object.Note that this function will never actually reach 100% fog color. However, at a depth of 3 * dist the colorwill be 95% fog. The value of the color being mixed with the fog at this point doesn't really matter. Thevalue you specify for the fog distance should depend on the extent of your scene.

To compare, here are two scenes, the first without fog, the second with some rather surreal bright bluefog thrown in.

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (6 of 13) [9/12/2001 3:19:25 PM]

Page 55: POV Ray Tutorial

#includeThe #include directive is used to include other scene files in the current one. The effect is exactly as ifyou had typed the contents of the file in at that location. The syntax is pretty simple,

#include "filename"

filename is the name of the file you want to include. The quotes are necessary. This is the best way to usethe standard POV-Ray libraries. For example, there's an include, colors.inc, which contains a great manycolor declarations. To get access to them you just need to put

#include "colors.inc"

at the top of your file. Note that when you include a file with declares in it, the names which are declaredare only accessible to things below the #include in your scene. The convention is to name files which areintended to be #included with the extension ".inc", but this is not required.

Another thing you can do is easily group objects together. If, for example, you have a file with a largenumber of objects in it, and you want to group and use these objects as one in another scene, you coulddo

union {#include "objects.inc"}

It is legal for include files to include other files. POV-Ray will generate an error, though, if you go morethan ten levels deep with nested includes. This shouldn't be a limitation. If it is, you need to rethink howyou're putting your scene together.

#max_intersectionsThe #max_intersections directive controls memory allocation for an internal data structure called"I-Stacks". These data structures are used to store information about object intersections while rendering

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (7 of 13) [9/12/2001 3:19:25 PM]

Page 56: POV Ray Tutorial

a scene. However, if you are rendering a particularly complex scene, these stacks can overflow, resultingin scene errors. If, in the POV-Ray status report (after the render) you see "I-Stack Overflows" listed withthe statistics, you need to increase the value of this parameter. The default value is 64. Really, you justneed to increase the value upward until all the "I-Stack Overflows" disappear. The POV-Ray authorsrecommend

#max_intersections 200

if you start to have problems. Of course, you may need to go even higher if this doesn't fix your problem.

#max_trace_levelThe #max_trace_level directive controls how patient POV-Ray will be when rendering reflective ortransmissive surfaces. The first ray sent out for each pixel is at trace level 0. If that intersects a reflectivesurface, another ray needs to be traced to determine what's being reflected. This new ray is at trace level1. If that ray intersects another reflective surface, a third ray (now at trace level 2) needs to traced, and soon. The same holds with transmissive surfaces. Whenever a ray strikes a surface with a nonzero filtervalue, another ray needs to be traced to determine what color is being transmitted. The trace level goesup from there. The default #max_trace_level is 5. This means that if any ray running at trace level 5intersects a reflective or transmissive surface, POV-Ray will give up and just return the color black.Thus, if you get reflective or transmissive surfaces which appear black when they shouldn't be, youprobably need to up the max trace level. This is done by specifying, for example

#max_trace_level 10

Note that there is no upper limit on the max trace level, but POV-Ray might crash if it runs out ofmemory while tracing reflective surfaces.

RotateRotate is a transformation which can be used to both change the orientation of a thing in space. Thisthing can be an object, a light, a camera, or a texture (or any component of a texture). The basic formatfor a rotation is

rotate <x angle, y angle, z angle>

The argument to rotate is a vector of rotation angles. Each of the components are floats which specify theangle (in degrees) to rotate around the corresponding axis. Any float value is valid for each of these,including zero.

Note that when you rotate an object, you always rotate it around the axis. So anything which is notcentered on the axis around which you are rotating will appear to orbit that axis. Note also that the

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (8 of 13) [9/12/2001 3:19:25 PM]

Page 57: POV Ray Tutorial

coordinate system in POV-Ray is left-handed. To determine which way is the positive direction aroundan axis, hold your left hand with the thumb sticking out in the positive direction of that axis. Thedirection your fingers curl when you close your hand is the direction of positive rotation.

Also, the order of the rotations for a rotate statement is around x-axis, then around y-axis, then aroundz-axis. This makes a difference. For proof if this, see the three scenes below. The first shows a conepointing in the +y direction. The second has the cone transformed by rotating first -90 degrees around thex-axis, then 90 degrees around the y-axis. The third has these two transformations reversed.

For more information about general transformations, see the transformations section.

ScaleThe scale transformation is used to change the size of objects. You can scale objects uniformly, ornonuniformly if you wish. You can also mirror-reverse objects. As with any other transformation, thiscan be used with any object, light, camera, or texture. The two general forms for a scale is

scale sclscale <x-scl, y-scl, z-scl>

The first form is for uniform scaling. It takes a float which specifies the factor by which to scale theobject. The object is then scaled by that factor in all dimensions. The second form is for nonuniformscaling of objects. The parameter here is a three-coordinate vector specifying the scale factor in the x, y,and z directions respectively. Values greater than one for any of these values (uniform or nonuniform)will stretch the object, values less than one will squish the object, and negative values will reverse theobject. Scaling on object by zero in any dimension is not legal. If you try, POV-Ray wil generate awarning and reset the offending component to 1.

All scaling is with respect to the corresponding axis (nonuniform) or the origin (uniform). Thus thefollowing object delcarations are the same.

sphere { <0, 2, 0>, 1 scale 2}

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (9 of 13) [9/12/2001 3:19:25 PM]

Page 58: POV Ray Tutorial

sphere { <0, 4, 0>, 2}

When you scale the first sphere, you not only double its radius, you also double the center's distance fromthe origin. This can generate problems when working with objects that are not at origin. If you have anobject somewhere and you scale it and it disappears, it's most likely because it wasn't at the origin whenit was scaled. That's just something to keep in mind.

Another thing to keep in mind is the use of the x, y, and z vectors in a scale statement. This will oftengenerate scale-by-zero warnings. Take, for example, the following object

sphere { <0, 0, 0>, 4 scale 5*x}

This will generate a warning, because the value of "x" is <1, 0, 0>. Hence, the value of 5*x is <5, 0, 0>.The zeros in that will annoy POV-Ray.

For more information about transformations in general, see the transformations section. Conveniently,this is the next section.

TransformationsThe term "transformation" refers to rotatations, translations, and scales. Transformations can be appliedto just about anything, including objects, lights, cameras, pigments, and normals. It doesn't make sense totransform finishes as the finish of an object doesn't depend on its absolute location in space (it does,however, depend on its location relative to other objects).

Any number of transformations may be applied to an object (from here on I'll use the term "object" torefer to any of those things I listed above). The transformations will be applied to the object in the orderthey are listed. Note that any position and orientation of an object can be achieved with a scale, arotation, and a translation (in that order). However, it's often easier to use somewhat more complextransformations to acheive certain effects. For example, the following two scenes look the same.However, the first was generated by specifying object locations explicitly, and the second by rotatingthem into those positions.

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (10 of 13) [9/12/2001 3:19:25 PM]

Page 59: POV Ray Tutorial

Both show cylinders at the corners of an equilateral triangle. However, the first one required somethought to position the cylinders, while the second one didn't (at least not as much). Also, in the secondscene it's more obvious from the source exactly what's going on in the scene with those cylinders.

The order of transformations does matter, particularly with translations. As an example, here's a simplescene. The first shows the object untransformed, the second shows it after a scale and a rotation, and thethird after a rotation and a scale.

Note the rather striking differences in the second two scenes.

Objects, Textures, and Transformations

When transforming an textured object, the behavior of the texture is fairly intuitive. Just remember thatan object is modifed in the order that things appear in its declaration. The following two objects will notlook the same. White_Marble is declared in "textures.inc".

sphere { <0, 4, 0>, 1 rotate 90*z pigment { White_Marble }}

sphere { <0, 4, 0> 1 pigment { White_Marble } rotate 90*z}

This is because, in the first sphere, the object is rotated, and then the pigment is applied to the object's

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (11 of 13) [9/12/2001 3:19:25 PM]

Page 60: POV Ray Tutorial

surface. In the second, first the object is covered with the pigment, and then the object (and pigment) arerotated. To make the first sphere look like the second, you could add a "rotate 90*z" transformation tothe pigment of the first sphere. This would transform the sphere, then transform the pigment the sameway, and then apply the pigment to the sphere's surface. The same rules hold for all the othertransformations.

For a perhaps more basic description of transformations, see the Tutorial.

TranslateTranslate is a transformation which modifies the position of an object. You can use it to put any objectanywhere in space. The basic form for translate is

translate <x-dist, y-dist, z-dist>

The argument is a three component vector specifying the distance to move the object in the x direction, ydirection, and z direction, respectively. The components in the vectors are floats, and any value (positive,negative, or zero) is legal. The order in which the translations from one vector are applied doesn't matter,so you don't have to worry about explicitly specifying it.

Version and #versionThe #version directive is used for backwards compatibility with POV-Ray 1.0. Currently, the validarguments for this directive are "1.0" and "2.0" (without the quotes). The default value is 2.0. Thisdefault can be changed with the +MV command-line parameter. Most of time you won't be using thisdirective, however, it can come in handy if you get some old POV-Ray code from somewhere. Alongwith the #version directive is the version variable. The value of this variable is either "1.0" or "2.0" and itcorresponds to the version expected at this point in the file. The #version directive must appear outside ofany and all other things (like object declarations, for example).

X, Y, and Zx, y, and z are built in vectors for convenience. Their values are <1, 0, 0>, <0, 1, 0>, and <0, 0, 1>,respectively. They're useful for specifying transformations, for example, the following pairs ofstatements are equivalent.

translate <5, 0, 0>translate 5*x

rotate <0, 80, 0>

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (12 of 13) [9/12/2001 3:19:25 PM]

Page 61: POV Ray Tutorial

rotate 80*y

translate <4, 6, 0>translate 4*x + 6*y

Reference Index Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Language Stuff

http://library.thinkquest.org/3285/language/language.html (13 of 13) [9/12/2001 3:19:25 PM]

Page 62: POV Ray Tutorial

The Online POV-Ray Tutorial

Pigment ReferenceTopics covered in this section

Agate●

Bozo●

Checker●

Color (Colour)●

Color (Colour) Map●

Frequency●

Gradient●

Granite●

Hexagon●

Image Map●

Lambda●

Leopard●

Mandel●

Marble●

Octaves●

Omega●

Onion●

Phase●

Pigment●

Quick Color (Colour)●

Radial●

Spotted●

Turbulence●

Wood●

Note: all the sample images in this scene were rendered with the following color map (unless otherwisespecified).

color_map { [0.00 color rgb <0.75, 0, 0>] [0.33 color rgb <0.75, 0.75, 0>] [0.50 color rgb <0, 0.75, 0>] [0.66 color rgb <0, 0, 0.75>]

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (1 of 16) [9/12/2001 3:21:07 PM]

Page 63: POV Ray Tutorial

[1.00 color rgb <0.75, 0, 0>]}

This color map has very high contrast so the details of each pigment can be easily seen. Also, all the pigmentswere rendered without any turbulence (except for agate, which always is turbulent).

AgateThe agate pigment is a very swirly, very turbulent pattern. It's similar to the marble pigment, except for its colorlook-up function and the fact that it is always very turbulent. The look-up function for the color map uses thecolors from 0.0 to 1.0 and back down to 0.0 like marble, but instead of indexing the colors linearly it uses a sinewave. This results in the ends of the color map having more weight than the center. In general, the pigment lookssomething like this

Another thing to note about agate is the fact that the turbulence keyword has no effect on this pigment. Agate isalways turbulent. The amount of turbulence can be controlled, to some extent, with the "agate_turb" keyword.This parameter takes a positive float value.

For more information on declaring pigments, see the pigment section.

BozoThe bozo pigment is a very cool and very useful pattern. It basically creates a series of "splotches" on the object.Its color map indexing function uses the colors from 0 to 1 without reversing. The pigment basically works byassigning random colors to integer points in space and interpolating the colors between those points. As a result,two points that are "close" tend to have colors that are fairly similar while points that are "distant" tend to havecolors that are random with respect to each other. The notion of "close" and "distant" depends on the scaling ofthe pigment. The bozo pigment uses the same coloring function as spotted, but spotted is unaffected byturbulence. Here's what a bozo texture might look like . . .

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (2 of 16) [9/12/2001 3:21:07 PM]

Page 64: POV Ray Tutorial

For more information on declaring pigments, see the pigment section.

CheckerThe checker pigment creates cubes of color in space. The checker pigment doesn't support color maps; youspecify the two colors that are checkered. This differs from the standard pigment declaration, so here's the generaltemplate for using checker.

pigment { checker color color-a color color-b}

color-a and color-b are any two colors. The pigment creates a space filling pattern of colored unit cubes with thegiven colors. For example, the pigment

pigment { checker color Red color Blue}

would come out looking something like this

One thing to notice about the checker pigment is that it is automatically offset a little bit in each direction toprevent problems with coincident surfaces. This may produce undesirable color patterns as seen on the front faceof the cube in the image.

Like most other pigments, checker responds to the turbulence modifier. The pigment can be scaled nonuniformlyto produce rectangular blocks of color as well.

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (3 of 16) [9/12/2001 3:21:07 PM]

Page 65: POV Ray Tutorial

ColorThe color pigment is used to assign monochromatic, flat colors to objects. It is also used in both the hexagon andchecker pigments. The general form for this pigment is as follows:

pigment { color color def}

where color def is a color defined in one of the following ways

color color name color rgb <color vec> color rgbf <color vec> color red rval green gval blue bval filter fval

In the first style, color name is the name of a declared color. A great number of (very cool) prefined color namescan be found in colors.inc. They can be accessed through the include directive.

In the second style, an rgb color vector is specified for the color. The vector has three components, all floatsbetween 0.0 and 1.0, where 0.0 represents no saturation of that color and 1.0 represents full saturation of thatcolor. Here are a few examples

color rgb <1, 1, 1> // white color rgb <0, 0, 0> // black color rgb <1, 0.7, 0.7> // pink color rgb <0, 0.6, 0.9> // greenish blue

The third color style is similar to the second style, except a filter value is specified to make the color partiallytransparent. color vec in this example is a four component vector, the first three components are the same asabove, and fourth float, also between 0.0 and 1.0, specifying the amount of transparency. 1.0 is a surface that isfully transparent, less than 1.0 makes colors translucent, and 0.0 makes them opaque. Note that a color that filterspasses through colors in proportion to each color component. For example

color rgbf <1, 1, 1, 1> // perfectly transparent color rgbf <1, 0, 0, 1> // like red cellophane color rgbf <0.8, 0.8, 0.8, 0.4> // like frosted glass

Note that a declaration like "color rgbf <0, 0, 0, 1>" will produce a filter that is perfectly black (and henceperfectly opaque).

Finally, the fourth method of specifying colors is a more verbose variation of color specification three. Eachkeyword (red, green, blue, and filter) is followed by a float (between 0 and 1) that specifies the correspondingcomponent of that color. Note that these keywords may appear in any order and are all optional (except for thefirst one. One must be specified or POV-Ray will whine at you). Any components that are not specified will beassumed to be 0. These keywords can also be used to modify existing colors. Any components which have notbeen specified can be specified with these keywords. For example, these two declarations are the same

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (4 of 16) [9/12/2001 3:21:07 PM]

Page 66: POV Ray Tutorial

color Red filter 0.5 color rgbf <1, 0, 0, 0.5>

For more examples of these kinds of color declarations see the standard POV-Ray file colors.inc.

Here's a sample image that was rendered with the pigment

pigment { color rgb <0.75, 0, 0>}

Note how the surface have no detail except for the sphere, which has a bit of shading. This is partially because ofthe flat pigment and partially because of the location of the light source.

Color MapColor maps are what give pigments life. The default color map is a blend of grays from black to white, andfrankly, this is dull. Color maps give you the power to specify blends of color over the range of a pigment. Thegeneral format for declaring color maps is like this

color_map { [cp0 color color spec 0] [cp1 color color spec 1] [cp2 color color spec 2]/* there can be up to 20 colors in the map */}

cp0 through cpn are floats in the range 0 to 1 that specify the location of a control point in the color map. Foreach control point, a color is specified. To get the color of a point in between control points, POV-Ray uses linearinterpolation. Color maps must contain between 2 and 20 control points, but the value of each control pointshould be greater than or equal to the previous one. Here are some example color maps

color_map { [0.0 color Red] // starts at red, then blends through [0.33 color Green] // green, [0.67 color Blue] // blue, [1.0 color Red] // and back to red}

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (5 of 16) [9/12/2001 3:21:07 PM]

Page 67: POV Ray Tutorial

color_map { // all colors from 0.0 to 0.5 are Yellow [0.0 color Yellow] [0.5 color Yellow] [0.5 color Blue] // then, at 0.5, there is a sharp change to blue [1.0 color Blue] // which is the color of the remainder of the map}

color_map { // same as above, but harder to understand [0.5 color Yellow] [0.5 color Blue]}

color_map { // filters blend too [0.0 color Red] [0.5 color White filter 1] [1.0 color Blue]}

Some things to keep in mind about color maps

If the first control point is greater than 0, all the colors between zero and that control point will be thatcolor

Similarly, if the last control point is less than 1.0, all the colors between that control point and 1.0 will bethat color

If two colors are specified to have the same control point, there will be a sudden change between colors atthat point. The color at that point will be the color that is specified latest

If two control points have colors with different filter values, the filter values will be interpolated too,producing colors with intermediate transparency.

There are a number of examples of color maps in the POV-Ray include file textures.inc.

FrequencyThe frequency modifier controls how many times the color map is used over the 0.0 to 1.0 range. The modifiertakes a float which defines how the color map is stretched. Values greater than 1 compress the map, values lessthan 1 stretch it. Negative values will reverse it and (potentially) stretch it. 0 is a bad number. For example, thestatement "frequency 2" will cause the color map to repeat twice over the range that would've repeated once.Here are two sample images. The first was rendered with the default "frequency 1", the second was rendered with"frequency 5", and the third was rendered with "frequency -1". All three images use the radial pigment pattern.

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (6 of 16) [9/12/2001 3:21:07 PM]

Page 68: POV Ray Tutorial

See pigment for information about the use of frequency.

GradientThe gradient pigment creats parallel planes of color. The orientation of those planes is controlled with gradient'sparameter. The said parameter is an 3 component vector which descibes the normal of the planes of color (theyall have the same normal as they are parallel). Note that the magnitude of the vector is unimportant, as long as itis nonzero. To control the width of the bands of color, use the frequency keyword. The gradient pigment is verysimilar to the marble pigment. The main difference is the color map look up functions. Gradient uses indexes thecolor map from 0 to 1 without reversing, while marble bounces back and forth from 0 to 1 and back to 0 again.This effect can be simulated with gradient with the proper color map and scaling. Another thing to note about thegradient pattern is that the color map reverses at 0. To get rid of this potentially undesirable boundary, you cantranslate the pigment along its normal vector until the boundary is off the object. Here are two sample gradientpatterns, the first is rendered with "gradient x" and the second is rendered with "gradient <1, 1, 1>"

The first image shows the color map reversal at the origin, while the second was translated to remove this"feature."

For more information about declaring pigments, see the pigment section.

GraniteThe granite pigment creates a sort of bozo-like pattern. Typically, you'll end up with pockets of color from oneend of the color map surrounded by rivers of colors from the other end. With the proper color map it can lookvery convincingly like real granite. The sample color map used here doesn't really do it justice. For much, much,much better examples of the use of this pigment (with layered textures), see the include file stones.inc.

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (7 of 16) [9/12/2001 3:21:07 PM]

Page 69: POV Ray Tutorial

Granite uses the color map from 0 to 1, 0 to 1, etc, without reversing. Granite responds to turbulence, although itdoesn't have any by default.

For more information on declaring pigments, see the pigment section.

HexagonThe hexagon pigment is similar to the checker pigment. For this pigment, three colors are specified, and they areused to create a hexagonal pattern on the objects. The hexagon pattern is projected onto the x-z plane, andproduces haxagonal "pillars" of color parallel to the y-axis. Rendered with the following pigment

pigment { hexagon color rgb <0.75, 0, 0> color rgb <0, 0, 0.75> color rgb <0, 0.75, 0> scale 0.5}

The pigment was scaled to give more detail about how the pigment works.

For more information about declaring pigments, see the pigment section.

Image MapImage mapping a very powerful technique for producing specific color patterns on the surface of an object. Itbasically works by reading an image file and then projecting that image onto the object. The default mappingmethod is to project the image onto the x-y plane in such a way that it fits into the square (0, 0), (1, 1). The pixelsof the original image are turned into infinitely long boxes that are parallel to the z-axis. Note that larger images

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (8 of 16) [9/12/2001 3:21:07 PM]

Page 70: POV Ray Tutorial

do not produce larger image maps, but rather image maps with better resolution. By default, the image map isrepeated infinitely in the x and y directions. This can be changed with the once keyword. If you don't like thenormal position of the image map, you can scale, rotate, and translate it to your heart's content. If you don't likethe default projection style mapping, you can change it (to some extent) with the map_type modifier. But onwardnow, to the syntax for image maps

image_map { type "filename" modifiers . . .}

type is one of gif, tga, iff, or dump. This is followed by the filename (in quotes) which specifies the image file tobe mapped.

Here we have an example of an image being mapped onto a box. The first image is the image that was mapped,and the second is the resulting scene.

The modifiers following the file type are optional. They include the aforementioned once and map_type as wellas a few others.

One of these others is the interpolate keyword. Interpolation performs smoothing on the image as it is mapped.By default, POV-Ray takes the location of the ray intersection and assigns a pixel value to it. When the imagemap is scaled up a great deal or is of poor resolution initally, this can result in image maps that appear blocky orotherwise generally ugly. When interpolation is turned on, POV-Ray averages the values of surrounding pixels todetermine intermediate values. This eliminates (for the most part) blockiness, but at the expense of tracing time.The interpolate keyword is followed by a number specifying the type of interpolation to be used. This numbercan be either 4 (for the Normalized Distance algorithm) or 2 (for the Bilinear algorithm). Normalized Distance isthe faster algorithm, while Bilinear does a better job of picking intermediate colors. Here's an example of usingthe interpolate keyword

pigment { image_map { gif "foobar.gif" interpolate 4 }}

The last modifier accepted by image maps is filter values. By default, image maps are all opaque. The filterkeyword can be used to change this. Filter can be used to modify specific colors, or to assign a filter value to theentire image map. Probably the best way to explain filter is through examples so here are a few

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (9 of 16) [9/12/2001 3:21:07 PM]

Page 71: POV Ray Tutorial

image_map { gif "zordo.gif" filter 0, 0.5 filter 2, 1.0 filter 7, 0.4}

image_map { gif "gurple.gif" filter all 0.8}

The first image map maps the image with the color specified by palette entry 0 (in the .GIF file) being 50%transparent. The color specified by palette entry 2 becomes 100% transparent. The color with palette entry 7becomes 40% transparent (which should not be surprising at this point). See the section on color for anexplanation of color filtering.

Image maps also respond to turbulence, which can make for some very interesting effects.

Image maps and color maps do not mix.

For more information about declaring pigments, see the pigment section.

LambdaLambda (besides being a greek letter) is a modifier for turbulence. The lambda parameter basically controls howrandom each step of turbulence is (see turbulence for a description). It takes a float parameter that must be greaterthan or equal to 1.0. Values of 1.0 produce very straight steps, while greater values produce steps with a greaterrandomness. The default lambda is 2. Note that specifying a lambda value only makes sense if you haveturbulence.

LeopardThe leopard pigment is similar to the bozo pigment, except for its regularness. The pigment is generated bybasically setting the center of each unit cube in the space to the color at one end of the color map, and points onthe edge of the cube to the color at the other end. The colors inside the cube are then blended between the two.Leopard uses the color map values from 0 to 1, 0 to 1 without reversing. Here's an example of a leopard pigment

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (10 of 16) [9/12/2001 3:21:07 PM]

Page 72: POV Ray Tutorial

The leopard pigment responds to turbulence, and it is said that very turbulent leopard pigments look like bozopigments to some extent.

For more information about declaring pigments, see the pigment section.

MandelThe mandel pigment creates a pattern that looks like the famous Mandelbrot set. Mandel one of the few pigmentswhich take a parameter; that parameter is the number of iterations to compute when generating the pigment. Thenumber of interations for each point to escape is used to color it according to the given color map. By default, theset is mapped onto the x-y plane in the standard range. As usual, the pigment can be scaled, rotated, andtranslated to fulfill your fondest Mandelbrot set dreams. Now we have an example of a mandel texture renderedwith "mandel 50"

For more information on declaring textures, see the pigment section.

MarbleThe marble pigment is quite similar to the gradient x pigment, except for its color map look up function. Wheregradient uses the colors from 0 to 1, 0 to 1 without reversing, the marble pigment blends from colors 0 to 1 in therange x=0 to x=0.5 and then back down to color 0 again in the range x=0.5 to x=1. Also, the marble pigmentdoesn't take a "normal" parameter; if you want the pattern to vary from the default y-z plane orientation, you'llneed to rotate the pigment. By default, marble has no turbulence and is consequently rather boring. A turbulencevalue of 0.8 or 0.9, in combination with a good color map, can create very realistic looking stone textures. Hereare two sample images of marble pigments, identical except for the turbulence. The first image has no turbulence,while the second has turbulence 0.8.

For more information on declaring pigments, see the pigment section.

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (11 of 16) [9/12/2001 3:21:08 PM]

Page 73: POV Ray Tutorial

OctavesThe octaves keyword is modifier for turbulence. It controls the number of steps taken by the turbulence functionwhen it is generating turbulence. The parameter is the number of steps that should be taken by the turbulencefunction. It can range from 1 to 10. The default value is 6. As the length of each step decreases exponentially, anoctaves value much higher than 6 won't change the scene much. It will change the rendering time, though, as themore steps there are to calculate, the longer POV-Ray will have to spend on each ray. Using a low number ofoctaves can produce a sort of wavy pattern on the surface. For a description of turbulence, see (naturally enough)turbulence. Note that specifying the number of octaves only makes sense if you have turbulence.

OmegaOmega is yet another turbulence modifier. It controls the size of each step in the turbulence function. Whengenerating turbulence, each step is omega times as long as the previous one. Normally omega values are between0.0 and 1.0. The default value is 0.5, which means that each step is half as long as the previous. For a more indepth description of turbulence, see the turbulence section (go figure). Note that specifying an omega only makessense if you have turbulence.

OnionThe onion pigment creates concentric spheres of color centered at the origin. It uses the color map entries from 0to 1, 0 to 1, without reversing. Here's a sample of the onion texture

Note that the sphere is entirely one color. This is because the pigment is centered at the enter of the sphere and soeach point one the sphere lines up with the same color in the color map.

For more information on declaring pigments, see the pigment section.

PhaseThe phase keyword is used to offset the color map It takes a float parameter between 0.0 and 1.0. The phaseadjustment is always applied before any frequency adjustments, regardless of their order in the pigment

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (12 of 16) [9/12/2001 3:21:08 PM]

Page 74: POV Ray Tutorial

declaration. Note that adjusting the phase of a gradient pattern is the same as translating the pigment andadjusting the phase of a radial pigment is the same as rotating the pigment around the y-axis. By modifying thephase of a pigment you can create interesting effects in animations. For more information on the usage of phase,see pigment, which just happens to be the next section.

PigmentThe pigment statement is how pigments (colors or patterns of colors) are assigned to objects. Pigments are whatgive the life to raytraced images. POV-Ray supports a very wide array of pigment types, with an effectivelyinfinite number of ways to al ter them to your needs. And if there still isn't something you want, you can alsoimage mapping and even material mapping (image mapping with entire textures instead of just colors). Anyway,the general format for specifying a pigment is like this . . .

pigment {// One of these is required pigment type /* OR */ color color /* OR */ image_map { /* image map specifications */ }// all the following are optional color_map { /* color map entries */ } frequency frequency lambda lambda val octaves number of octaves omega omega val phase phase quick_color color turbulence turbulence val or vec/* any transformations go here */}

Any number of transformations (rotations, translations, and scales) may follow the pigment declaration, but mustspecified after the last pigment modifier.

A pigment consists of three major parts, first the pigment type, then the color map, and finally the turbulence.The color map and the turbulence are optional. The first part, pigment type is one of the following: agate, bozo,checker, gradient, granite, hexagon, leopard, marble, mandel, onion, , or wood. See their individual sections formore specific information on each (as well as sample images).

The second type of modifier is the color map. The specification of a color map is covered in some detail above.The two color map modifiers are frequency, which stretches or compresses the color map, and phase, whichshifts the colors in the map.

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (13 of 16) [9/12/2001 3:21:08 PM]

Page 75: POV Ray Tutorial

The third part of the pigment is the turbulence specification. Turbulence is the "most optional" of the three parts.There are a number of pigments which will look fine without turbulence (such as bozo), and some which lookrather lame without turbulence (such as marble) and even some which don't even respond to turbulence (such asspotted). Turbulence is basically used to mix up a pigment a little (or a lot). This can add life to a pigment. It canalso make some pigments look weird. The modifiers lambda, octaves, and omega can be used to tweak theturbulence to achieve the exact effect you're looking for.

Quick ColorQuick colors are used only when debugging scenes. The method for specifying quick colors is the same as forspecifying normal colors. You can have a pigment and a quick color assigned to the same object. The only timePOV-Ray uses quick colors is when you set the rendering quality to +Q5 or below. At +Q6 and above the normalpigment declaration is used. When rendering a +Q5 and below, any objects which are not already solid colorswill be grayscaled. For example

sphere { gradient x color_map { [0.0 color Red] [1.0 color Yellow] } turbulence 0.8 quick_color Aquamarine}

will instruct POV-Ray to create a turbulent gradient pigment at +Q6 and above, and otherwise just color thesphere Aquamarine. You can use the quick_color modifier to distinguish two objects in a quick rendering. Notethat giving an object a solid color pigment will automatically set the quick color to the same color. You canoverride this by explicitly specifying a quick color, though.

RadialThe radial pigment takes the color map and wraps it clockwise around the y-axis, starting in the positive xdirection. There's not much more to say about it, so here's a sample image which probably explains it better.

There are some more samples over with the frequency section. For more information on declaring pigments, see

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (14 of 16) [9/12/2001 3:21:08 PM]

Page 76: POV Ray Tutorial

the pigment section.

SpottedThe spotted pigment is identical to the bozo pigment, except it doesn't respond to turbulence. See the bozosection for more information on it. The following image was rendered with the spotted pigment.

For more information on declaring pigments, see the pigment section.

TurbulenceTurbulence is used to mix up a pigment to some extent. The turbulence key word can take either a float or a threecomponent vector as a parameter. For example

turbulence 0.8 // stir up the pigment equally in all directions turbulence <0, 0.9, 0.3> // no turbulence in the x direction, a lot in // the y direction and a little in the z // direction turbulence x // major turbulence only in the x direction

All of the numbers, whether individual floats or vector components, should be between 0.0 and 1.0 inclusive.High numbers mean lots of turbulence, low numbers mean only a little turbulence. Here's an example of whatturbulence does. Both images use a marble pigment, but only the second was rendered with turbulence(turbulence 0.8, to be exact).

The way POV-Ray implements turbulence is quite interesting. In a normal pigment, POV-Ray simplesdetermines the color of the pixel at each point on the surface of the object and colors the object with that.Turbulence works by taking a number of semi-random steps and using the color at the destination point. Inessence, it constructs a pointer which says, "use that color over there." The "random" number generator used to

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (15 of 16) [9/12/2001 3:21:08 PM]

Page 77: POV Ray Tutorial

produce these steps is a function of original point. Hence, points that are near each other initially tend to end upwith similar colors, while points that are distant tend to end up with random colors (with respect to each other).The "random" number generator is also deterministic, so rendering a scene file with turbulence will always resultin the same image (good for creating animations).

Here's a more in depth description of the turbulence function which will make its modifiers (lambda, octaves, andomega) make a little more sense. Turbulence works by first selecting a direction and moving so far that way.Then it picks a new direction and moves not-quite-as-far in that direction. Then it picks yet another direction andmoves not-quite-not-quite-as-far in that direction. It uses a function called DNoise to generate these randomsteps. The overall magnitude of these steps is controlled by the parameter given to turbulence. Hence largeamounts of turbulence create very large steps. The total number of steps taken is controlled by the octavesparameter. The default number of octaves is 6. This is a reasonable number and will do fine for most textures.Decreasing the number or octaves (to, say, 2) can create interesting effects. Increasing it will have only amarginal effect. This is because the length of each step falls off exponentially. The rate at which the step lengthfalls off is determined by the omega value. Each subsequent step in the turbulence is omega times as long as theprevious one. The default omega value is 0.5. Omegas are typically less than 1.0. High values or omega (0.8, 0.9,whatever) tend to make the turbulence more random, while low values (say, 0.1, 0.2) tend to smooth the pigmentout a lot. The third modifier for turbulence is the lambda parameter. This controls the "randomness" of each step.Lambdas that are close to 1.0 cause each of the steps to be in approximately the same direction. Higher lambdasincrease the randomness of the direction of each step. The default value is 2.0. Lambda should be greater than orequal to 1.0.

WoodThe wood pigment creates concentric cylinders of color centered around the z-axis. To create pigments thatacutally look like wood, stick with earth tones, rotate the pigment around the x-axis a few degrees, and add asmall amount of turbulence. Here, looking very un-wood-like is a sample image.

For more information about declaring pigments, see the pigment section.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Pigment Reference

http://library.thinkquest.org/3285/language/pigment.html (16 of 16) [9/12/2001 3:21:08 PM]

Page 78: POV Ray Tutorial

#declare Pigm = pigment { agate color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig1.pov

http://library.thinkquest.org/3285/language/src/pig1.pov [9/12/2001 3:21:09 PM]

Page 79: POV Ray Tutorial

#declare Pigm = pigment { bozo color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig2.pov

http://library.thinkquest.org/3285/language/src/pig2.pov [9/12/2001 3:21:14 PM]

Page 80: POV Ray Tutorial

#declare Pigm = pigment { checker color rgb <1, 0.25, 0.25> color rgb <0.25, 0.25, 1>}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig13.pov

http://library.thinkquest.org/3285/language/src/pig13.pov [9/12/2001 3:21:15 PM]

Page 81: POV Ray Tutorial

#declare Pigm = pigment { color rgb <1, 0.25, 0.25>}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig12.pov

http://library.thinkquest.org/3285/language/src/pig12.pov [9/12/2001 3:21:17 PM]

Page 82: POV Ray Tutorial

#declare Pigm = pigment { radial color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig7.pov

http://library.thinkquest.org/3285/language/src/pig7.pov [9/12/2001 3:21:25 PM]

Page 83: POV Ray Tutorial

#declare Pigm = pigment { radial color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] } frequency 5}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig15.pov

http://library.thinkquest.org/3285/language/src/pig15.pov [9/12/2001 3:21:27 PM]

Page 84: POV Ray Tutorial

#declare Pigm = pigment { radial color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] } frequency -1}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig16.pov

http://library.thinkquest.org/3285/language/src/pig16.pov [9/12/2001 3:21:28 PM]

Page 85: POV Ray Tutorial

#declare Pigm = pigment { gradient x color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig10.pov

http://library.thinkquest.org/3285/language/src/pig10.pov [9/12/2001 3:21:30 PM]

Page 86: POV Ray Tutorial

#declare Pigm = pigment { gradient <1, 1, 1> color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] } translate <10, 10, 10>}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig11.pov

http://library.thinkquest.org/3285/language/src/pig11.pov [9/12/2001 3:21:31 PM]

Page 87: POV Ray Tutorial

The Online POV-Ray Tutorial

TextureThe topics in this section are texture declarations which don't fit into any other category.

Material Map●

Texture●

Tiles●

Material MapMaterial maps are basically image maps, except you're wrapping patterns of textures around an objectinstead of patterns of solid colors. This kind of thing is useful for creating inlaid floors, for example. Thebasic syntax for a material map is like this

texture { material_map { type "filename" /* modifiers */ texture { /* texture 0 */ } texture { /* texture 1 */ } /* as many textures as you need */ } /* any transformations */}

Here, type is one of gif, tga, iff, or dump. This specifies the type of image file being read. This is thenfollowed by filename, in quotes. After the file, you specify any mapping modifiers (like once or map_type).Interpolation is supported for material maps, but it interpolates between textures, not between colors, andso will probably not have the desired effect.

Anyway, for the indexed color type of image (gifs), the texture selected at a point is based on the paletteindex. For example, if a particular pixel is black, and the palette index of black is 4, then texture 4 will beused to color that point. Color 0 in the palette gets texture 0 in the list mapped onto it. Color 1 in the palettegets texture 1, and so on. If there are not enough textures in the list to assign a texture to a particularnumber, the indexing will wrap around back to the first texture. For example, if you list three textures, andhave a Color 3 in your material map, it will get mapped back to texture 0.

When material mapping rgb images, the value of the red byte for each pixel is used as the texture index.

The Online POV-Ray Tutorial: Texture

http://library.thinkquest.org/3285/language/texture.html (1 of 5) [9/12/2001 3:22:00 PM]

Page 88: POV Ray Tutorial

If you specify a material map, any and all texture declarations (pigment, finish, or normal) must appear intextures in the texture list. They cannot appear outside in the "main" texture declaration. For example, thefollowing is illegal.

texture { material_map { gif "inlaid.gif" texture { Text1 } texture { Text2 } texture { Text3 } texture { Text4 } } finish { ambient 0 }}

If you want to do something like this, you must manually add the "ambient 0" to each texture statement inthe list.

Here's an example of a material map. The map is the first image, the rendered scene is the second.

TextureThe texture statement is used to give an object a surface texture. Surface textures consist of a pigment, afinish, and a normal. Any of these can be left to the default. Usually finishes and normals are left until thefine-tuning stages of scene production, anyway. Any floating pigment, normal, or finish statement in anobject is assumed to be enclosed in a texture block. For example, POV-Ray considers the followingstatements to be identical. In fact, if you use the first form, POV-Ray assumes you mean the second.

sphere { <0, 0, 0>, 5 pigment { color Green }}

sphere { <0, 0, 0>, 5

The Online POV-Ray Tutorial: Texture

http://library.thinkquest.org/3285/language/texture.html (2 of 5) [9/12/2001 3:22:00 PM]

Page 89: POV Ray Tutorial

texture { pigment { color Green } }}

Most of the different texture components are covered in their own sections.

A very powerful technique in object texturing is that of layered textures. With layered textures, you coveran object with several overlapping textures. Presumably the upper textures have transparent parts to let thelower ones show through. This is down by specifying multiple textures for an object. It might looksomething like this.

object { Something_To_Put_Layered_Textures_On texture { /* the first texture listed goes on the bottom */ Bottom_Layer } texture { /* a middle layer which is draped over the first */ Middle_Layer } texture { /* and finally, a top layer */ Top_Layer }}

You may have as many textures in a layered texture declaration as you need.

Layered textures allow you to vary the built in textures styles in an almost infinite number of ways. For anumber of really awesome examples of layered textures, see the standard include file stones.inc. Here,layered textures are used to create some exceedingly realistic looking stone textures.

As an example, here's a layered texture being constructed from the bottom up. This texture was sort ofdesigned to look like a molten planet or a dying star, but it's up to your imagination. In the first image,there's just a base for the texture. Usually this isn't very complex as everything else will be on top of it, butyou can do whatever you want. Here it's just a simple bozo.

Next some violent orange bands were added on top (using agate).

The Online POV-Ray Tutorial: Texture

http://library.thinkquest.org/3285/language/texture.html (3 of 5) [9/12/2001 3:22:00 PM]

Page 90: POV Ray Tutorial

Finally, some random splotches of yellow were put on top (this was done with granite).

Although this particular texture may not be the best or most realistic texture, it's much more interesting thana standard one-layer texture.

TilesTiles are to textures what checker is to colors. The tiles texture uses two textures and creates alternating"blocks" of those textures. When used on a plane, this typically looks like squares of texture. With somecreative rotation, you can do a lot more, too. Anyway, the general form for a tiled texture is like this

texture { tiles { texture { Text1 } tile2 texture { Text2 } }}

The keyword tile2 is a separator and must occur between the two texture declarations. Any transformationsof the texture must appear either inside the individual textures (which are to be tiled) or outside the tilesblock altogether. A tiled texture may be used as one of the textures in another tiled texture to create adouble-tiled texture (but you'll have to scale the inner one down or it'll overlap exactly with the outer one).Anyway, here's an example of a tiled texture.

The Online POV-Ray Tutorial: Texture

http://library.thinkquest.org/3285/language/texture.html (4 of 5) [9/12/2001 3:22:00 PM]

Page 91: POV Ray Tutorial

Here's a tiled texture with one of those aforementioned creative rotations.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Texture

http://library.thinkquest.org/3285/language/texture.html (5 of 5) [9/12/2001 3:22:00 PM]

Page 92: POV Ray Tutorial

The Online POV-Ray Tutorial

ModifiersThe things in this file are used to modify the default behavior of certain objects. These modifiers includethe following.

Bounded By●

Clipped By●

Map Type●

No Shadow●

Once●

Open●

Sturm●

Bounded ByThe only effect of bounding is to speed the rendering of a scene. Specifying a bounding object foranother object tells POV-Ray the latter is entirely contained by the former. When rendering, POV-Rayfirst does any ray tests against the presumably simpler bounding object. If the ray does not intersect thebounding object, then POV-Ray assumes that it does not intersect the interior object either. POV-Raythen skips the potentially lengthy ray intersection tests with the interior object. If the ray does intersectthe bounding object, POV-Ray then performs tests to see if the ray also intersects the interior object.Bounding objects do not affect the way the scene looks. Any object (except light sources) can bebounded, although bounding will show the most speed improvement when used with complex CSG orpolynomial objects. Boxes and spheres make wonderful bounding objects as they are highly optimized,however, any object may be used to bound another.

Note that POV-Ray has a limited ability to do automatic bounding. Most finite objects can beautomatically bounded with a reasonable amount of efficiency. Unions can also be bounded fairlyefficently. Things that cannot be automatically bounded are infinite objects, differences, intersections, ormerges.

Here's an example of the use of bounded_by. Really_Complex_Chair is presumed to be definedsomewhere above this in the scene file.

object { Really_Complex_Chair bounded_by { box {

The Online POV-Ray Tutorial: Modifiers

http://library.thinkquest.org/3285/language/modifiers.html (1 of 6) [9/12/2001 3:22:26 PM]

Page 93: POV Ray Tutorial

<-4, 0, -4>, >4, 8, 4> } }}

Objects should never extend outside their bounds. Doing so will have undefined results. Sometimesthe object will render ok, sometimes parts that stick out will be trimmed away, sometimes things will justget weird. If you want to slice away part of an object, use clipped_by or CSG.

If you have an object which you clipped, and want to use the same object to bound that you used to clip,you can do something like this . . .

object { Some_Object_Or_Other clipped_by { sphere { <0, 2, 0>, 3 } } bounded_by { clipped_by }}

Clipped ByThe clipped_by statement allows you slice away parts of objects to reveal a hollow interior. It is similarto intersection except it leaves holes where parts of the object were clipped away. Any object (exceptlight sources) can be clipped, and any object (except for light sources again) can be used to clip. Forexample, here is a cube that is clipped with a sphere.

Only the portions of the cube that are on the inside of the sphere are retained. The notions of "inside" and"outside" in the clipping object can be switched with the inverse keyword. Note that you can specifymultiple objects to clip with in one clipped_by statement. The result will be that the object is clipped firstwith first object, then the result is clipped with the second, and the result of that is clipped with the third,etc. Here's an example of a cube with two clipping spheres.

The Online POV-Ray Tutorial: Modifiers

http://library.thinkquest.org/3285/language/modifiers.html (2 of 6) [9/12/2001 3:22:26 PM]

Page 94: POV Ray Tutorial

If you've bounded an object with a second object, and want to use that same second object to clip thefirst, you can do something like this (presumably This_Is_An_Object is declared elsewhere)

object { This_Is_An_Object bounded_by { cylinder { <0, 0, 0>, <0, 1, 0>, 0.5 } } clipped_by { bounded_by }}

Map TypeThe map_type keyword is only applicable to image maps, bump maps, and material maps. It is used tomodify how the image is projected onto the surface in the mapping. The parameter for map_type is aninteger which tells what kind of mapping to use. The default is "map_type 0". This is a planar mapping inwhich the image is projected along the z axis onto the x-y plane. The image is rescaled to fit into the unitsquare in the x-y plane. It also repeats infinitely in the x and y directions. Other mappings are as follows.

map_type 0

The planar mapping as described above.

map_type 1

A sperical mapping. The image is mapped Mercator-style around the origin. The right edge of theimage ends up in the +x direction and is mapped clockwise around the y-axis. The top and bottomedges of the image are compressed down to points on the y-axis. The image shows a great deal ofdistortion around the poles of the mapping (the y-axis by default). Each pixel in the image istransformed into a three dimensional wedge shape which radiates from the origin.

map_type 2

A cylindrical mapping. The image is mapped around the y-axis like wrapping paper. As with thespherical mapping, the right edge of the image ends up in the +x direction, and the image ismapped around the y-axis in a clockwise sense. The image is still rescaled in the y-direction to beone unit tall and repeats infinitely up the y-axis. Each pixel in the image is transformed into a

The Online POV-Ray Tutorial: Modifiers

http://library.thinkquest.org/3285/language/modifiers.html (3 of 6) [9/12/2001 3:22:26 PM]

Page 95: POV Ray Tutorial

pie-slice shape which radiates from the y-axis.

map_type 5

A toroidal mapping. This type of mapping is the most difficult to describe. The image will fitaround an untransformed torus (i.e. one that was created with the torus primitive and then leftalone). Experiment with it.

Map types 3 and 4 are reserved for future use.

The following images show map types 0, 1, 2, and 5, respectively. Each map type is projected onto itscorresponding shape. Note that for types 1, 2, and 5, the pigment was rotated to give a better view ofwhat exactly was going on.

For example, if you wanted to make a globe, you might try something like this

sphere { <0, 0, 0>, 4 pigment { image_map { gif "earth.gif" map_type 1 } }}

The Online POV-Ray Tutorial: Modifiers

http://library.thinkquest.org/3285/language/modifiers.html (4 of 6) [9/12/2001 3:22:26 PM]

Page 96: POV Ray Tutorial

No ShadowThe no_shadow keyword is applicable to any object (not light sources or cameras). When included in anobject, that object will not cast a shadow on anything else. This is primarily useful for special effects,primarily those which simulate objects which "produce" light. Laser beams are a good example. Theno_shadow keyword takes no parameter, it's either there, or it's not (in which case the object will cast ashadow like normal).

The following images show the effect of no_shadow. The first image is normal, the second has a spherewith the no_shadow keyword.

OnceThe once keyword is only applicable to image maps, bump maps, and material maps. By default, theimage which is mapped is repeated infinitely in the x and y directions (this varies with the map type).Adding the "once" keyword to a mapping specification will remove all the duplications of the imageexcept the one in the (0, 0), (1, 1) unit square. With image maps, everywhere else becomes transparent;with bump maps, everywhere else becomes flat; with material maps, everywhere else becomes texture 0.The once keyword takes no parameter.

If, for example, you wanted to create a single image stamped into a mirror you might try

box { <-1, -1, -1>, <2, 2, 2> pigment { color rgb <1, 1, 1> } finish { reflection 1 ambient 0 diffuse 0 } normal { bump_map { gif "stamp.gif" once

The Online POV-Ray Tutorial: Modifiers

http://library.thinkquest.org/3285/language/modifiers.html (5 of 6) [9/12/2001 3:22:26 PM]

Page 97: POV Ray Tutorial

} }}

OpenTHe open keyword controls the existence of endcaps on cylinders and cones. It is not legal anywhereelse. This keyword takes no parameter. If it is specified, then cones and cylinders will be rendered ashollow tubes. Otherwise they will have the circular ends in place (default). Here are two sample scenes,the first without open and the second with.

SturmSturm is only applicable to blobs and polynomial objects (including tori). These objects requireextremely accurate calculations to render. Normally they will look ok with POV-Ray's defaultroot-solver. However, in certain cases they will render incorrectly. In these cases, you can specify thekeyword "sturm" inside the object's declaration to tell POV-Ray to use its more accurate (but slower)Sturmian Root Solver. Another possible fix is to rotate, translate, or scale the object by a very smallamount.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Modifiers

http://library.thinkquest.org/3285/language/modifiers.html (6 of 6) [9/12/2001 3:22:26 PM]

Page 98: POV Ray Tutorial

The Online POV-Ray Tutorial

CSG ReferenceCSG (Constructive Solid Geometry) is used to combine simple objects to form potentially very complexones. CSG allows you to merge objects into one and carve away parts of objects with other objects. Anyobject (just about) can appear in a CSG object, including other CSG objects. There's no limit on thenumber of objects that can appear in a CSG object, but POV-Ray will complain a little if you don't haveat least two objects in a CSG object.

The following topics are covered in this section.

Difference●

Intersection●

Inverse●

Merge●

Union●

This small collect of objects will do nicely in assisting if our exaplanation of the wonders of CSG.

DifferenceA difference is used to take an object and carve shapes out of it. Specifying a difference is no differentfrom specifying any other CSG object (see union) The first object specified is the object you're carvingfrom, and all subsequent objects are used to carve away sections from the first object. Somewhat morespecifically, any parts of the first object that are "inside" any of the other objects are trimmed away.Difference is the only CSG object in which the order of the objects is important. The concept of the"inside" and "outside" of an object can be altered with the inverse keyword. Here's what it looks linewhen group the cylinder and the box together in a difference statement.

The Online POV-Ray Tutorial: CSG Reference

http://library.thinkquest.org/3285/language/csg.html (1 of 6) [9/12/2001 3:22:40 PM]

Page 99: POV Ray Tutorial

First off, note that this is a different viewing angle from the initial sample scene. This is to make it moreobvious what the difference did. Note that the scene is a cube with some interesting sections taken out ofit. This is because the box object was the first one listed in the difference (see the source). Also noticehow the different parts of the now scarred cube are different colors. When you do a difference operation,the surface is colored based on which object acutally "created" that surface. So the hole through thecenter of the box is green because it was made with the green cylinder. If you wanted the entire surfaceto be all one color, you could either change each individual texture to the same, or you could remove allthe textures on the individual objects, and just put one inside the difference.

See union for more detailed information on declaring CSG objects.

IntersectionThe intersection of two or more objects is composed of all the points that are inside all the objects. Theorder of the objects listed in the declaration is not important. You can think of intersection as (sort of) theopposite of a difference. Instead of carving away points that are inside the objects (like difference),intersection throws out regions that are outside of subsequent objects. POV-Ray's concept of "inside" and"outside" can be changed by adding the keyword inverse to an object. But anyway, here's what results ifwe group our unsuspecting test objects together in an intersection.

The result is a cylinder with sort of "squared off" ends. That volume corresponds to the space which iscontained inside both of those objects. You can see which object was defining each boundary by thecolor of the result. Anywhere that is green is on the boundary of the cylinder and anything that is red ison the boundary of the box. Admittedly, this particular thing isn't too useful, but intersection, along withits close relative, difference, is probably the most powerful CSG directive for creating new andinteresting objects.

The Online POV-Ray Tutorial: CSG Reference

http://library.thinkquest.org/3285/language/csg.html (2 of 6) [9/12/2001 3:22:40 PM]

Page 100: POV Ray Tutorial

See union for more detailed information on declaring CSG objects.

InverseThe inverse keyword can be added to any finite, infinite, or CSG object. It basically reverses the regionsthat POV-Ray considers to be the inside and outside of the object. This only really matters in CSGdifferences and intersections. It can also be used in clipping objects. For an example of the use ofinverse, check out these two images.

See the difference (no pun intended)? If you did, then there's something wrong. The only differencebetween between these two scenes is in the source. They render to the same image. One (the first) uses adifference, while the other (the second) uses an intersection. The reason they look the same is the secondand third object in the second scene were inverted (don't just trust me, see for yourself). Remember howdifference and intersection work. Difference carves away insides, and intersection carves away outsides.But by flipping the insides and outsides in the intersection, it, too, is effectively carving away outsides. Infact, difference is implemented in POV-Ray as an intersection with the second through nth objectsinverted.

Here's an image which should make inverse more understandable. In this intersection, the box is inverted,so only regions outside the box and inside the cylinder remain.

The Online POV-Ray Tutorial: CSG Reference

http://library.thinkquest.org/3285/language/csg.html (3 of 6) [9/12/2001 3:22:40 PM]

Page 101: POV Ray Tutorial

MergeMerge is very similar to union. It basically serves the same purpose; it joins a group of objects togetherinto one for whatever purpose. Merge, however, differs from union in that any surfaces which are insidethe object are removed. This doesn't matter in opaque objects, as internal surfaces aren't visible anyway.However, it is very important in objects that have transparency. In unions, internal surfaces of transparentobjects will be visible, and this can cause unwanted artifacts. Using merge to join these objects will solvethese problems, though. Here's our sample scene again, substantially modified, but hopefully stillrecognizable. Actually, the objects are the same, except for their pigments. A finish was added to makethe objects look like glass. The first image shows the objects unioned, the second shows them merged.

Note how in the first image, the outline of the cylinder is clearly visible inside the box. In the second, thisobject is gone. The combined objects are now acutally a single, continuous unit.

One very important thing to keep in mind when creating merge objects is that coincident surfaces(surfaces which touch exactly at more than just a point or a line) will cause very strange errors in yourobject. Sections of the object will be randomly invisible, and things will be generally very twisted. Forexample, doing the following is bad.

merge { cylinder { <0, 0, 0>, <0, 3, 0>, 3 } cone { <0, 3, 0>, 3, <0, 6, 0>, 0 } texture { SomeTexture }}

Note how the top of the cylinder and the bottom of the cone are the same. This is bad. Note that this willnot always render incorrectly. Sometimes it'll come out ok, and sometimes it won't. C programmers willunderstand when we say that "the results will be undefined."

merge { cylinder {

The Online POV-Ray Tutorial: CSG Reference

http://library.thinkquest.org/3285/language/csg.html (4 of 6) [9/12/2001 3:22:40 PM]

Page 102: POV Ray Tutorial

<0, 0, 0>, <0, 3, 0>, 3 } cone { <0, 2.99, 0>, 3, <0, 6, 0>, 0 } texture { SomeTexture }}

Now the two objects overlap a bit. This is just enough to fix the problem, and won't impact theappearance of the object appreciably.

See union for more detailed information on declaring CSG objects.

UnionUnion is used to combine groups of objects together into one logical object. This object can then betextured and transformed as a whole, so you don't have to deal with a bunch of little objects. The basicform for a union (or any CSG) is as follows

union { object { obj 1 } object { obj 2 } /* you can have as many objects as you wish */ object { obj n } /* here go any textures, rotations, translations, and scales. */}

Of course, if you want a difference, intersection, or merge, you should change the "union" above to theappropriate identifier.

Any object, whether finite, infinite, or CSG, can be used in a union. There are restrictions on objects inthe other types of CSG, though. Any object used in an intersection, merge, or difference must have aclearly defined inside. Objects like triangles don't have insides, and so can only be used in unions, not theothers. You can use clipping to simulate these operations on flat objects, though.

Unions are wonderful for creating coherent objects. For example, you can create an object with a greatmany components and group them all together into a union. After that, you can transform them bytransforming the union instead of having to transform all the individual objects. You can also easilytexture the objects as one. One thing to remember when texturing CSG objects, though, is that a texturefor a specific object in a CSG will override any texture specified for the CSG object itself.

Here is the sample scene with the objects joined together in a union.

The Online POV-Ray Tutorial: CSG Reference

http://library.thinkquest.org/3285/language/csg.html (5 of 6) [9/12/2001 3:22:40 PM]

Page 103: POV Ray Tutorial

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: CSG Reference

http://library.thinkquest.org/3285/language/csg.html (6 of 6) [9/12/2001 3:22:40 PM]

Page 104: POV Ray Tutorial

#include "colors.inc"

box { <-1, -1, -1>, <1, 1, 1> pigment { color Red }}

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 pigment { color Green }}

plane { y, -3 pigment { checker color White color Black }}

plane { -z, -3 pigment { checker color White color Black }}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <-2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg.pov

http://library.thinkquest.org/3285/language/src/csg.pov [9/12/2001 3:23:11 PM]

Page 105: POV Ray Tutorial

#include "colors.inc"

difference {

box { <-1, -1, -1>, <1, 1, 1> pigment { color Red } }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 pigment { color Green } }

}

plane { y, -3 pigment { checker color White color Black }}

plane { -z, -3 pigment { checker color White color Black }}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg1.pov

http://library.thinkquest.org/3285/language/src/csg1.pov [9/12/2001 3:23:13 PM]

Page 106: POV Ray Tutorial

#include "colors.inc"

intersection {

box { <-1, -1, -1>, <1, 1, 1> pigment { color Red } }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 pigment { color Green } }

}

plane { y, -3 pigment { checker color White color Black }}

plane { -z, -3 pigment { checker color White color Black }}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <-2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg2.pov

http://library.thinkquest.org/3285/language/src/csg2.pov [9/12/2001 3:23:19 PM]

Page 107: POV Ray Tutorial

#include "colors.inc"

intersection {

box { <-1, -1, -1>, <1, 1, 1> pigment { color Red } }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 inverse pigment { color Green } }

}

plane { y, -3 pigment { checker color White color Black }}

plane { -z, -3 pigment { checker color White color Black }}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg3.pov

http://library.thinkquest.org/3285/language/src/csg3.pov [9/12/2001 3:23:22 PM]

Page 108: POV Ray Tutorial

#include "colors.inc"

intersection {

box { <-1, -1, -1>, <1, 1, 1> inverse pigment { color Red } }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 pigment { color Green } }

}

plane { y, -3 pigment { checker color White color Black }}

plane { -z, -3 pigment { checker color White color Black }}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <-2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg4.pov

http://library.thinkquest.org/3285/language/src/csg4.pov [9/12/2001 3:23:24 PM]

Page 109: POV Ray Tutorial

#include "colors.inc"

union {

box { <-1, -1, -1>, <1, 1, 1> }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 }

pigment { color rgbf <1.0, 0.8, 0.8, 0.8> } finish { refraction 1 ior 1.5 }}

plane { y, -3 pigment { checker color White color Black scale 3 }}

plane { -z, -3 pigment { checker color White color Black scale 3}}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <-2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg5.pov

http://library.thinkquest.org/3285/language/src/csg5.pov [9/12/2001 3:23:26 PM]

Page 110: POV Ray Tutorial

#include "colors.inc"

merge {

box { <-1, -1, -1>, <1, 1, 1> }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 }

pigment { color rgbf <1.0, 0.8, 0.8, 0.8> } finish { refraction 1 ior 1.5 }}

plane { y, -3 pigment { checker color White color Black scale 3 }}

plane { -z, -3 pigment { checker color White color Black scale 3}}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <-2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg6.pov

http://library.thinkquest.org/3285/language/src/csg6.pov [9/12/2001 3:23:27 PM]

Page 111: POV Ray Tutorial

The Online POV-Ray Tutorial

Finite Object ReferenceThe following topics are covered in this section

Bicubic Patch●

Blob●

Box●

Cone●

Cylinder●

Height Field●

Object●

Smooth Triangle●

Sphere●

Torus●

Triangle●

Bicubic PatchThis primitive creates Bezier style bicubic patch (sorry about the flurry of large words). A bicubic patchis a smooth surface defined by sixteen points, four of which specify the corners and are necessarily onthe surface, and twelve others which are probably not on the surface, but are rather used to stretch it intothe proper shape. Bicubic patches are really meant to be created by people. They're more the kind ofthing that would be generated by a modeller of some sort. If you like pain you can create them yourself,though. POV-Ray renders bicubic patches as meshes of triangles. Here's the syntax for a bicubic patch:

bicubic_patch { type type flatness flatness u_steps u_steps v_steps v_steps <c1>, <c2>, <c3>, <c4>, <c5>, <c6>, <c7>, <c8>, <c9>, <c10>, <c11>, <c12>, <c13>, <c14>, <c15>, <c16>}

The four parameters (type, flatness, u_steps, and v_steps) may appear in any order, but must appear

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (1 of 13) [9/12/2001 3:24:08 PM]

Page 112: POV Ray Tutorial

before the control points are specified. type specfies how POV-Ray should store the patch in memory. Iftype is 0 then POV-Ray just stores the control points in memory. This is quite memory efficient, but alsovery slow. If type is 1, then POV-Ray will preprocess the patch and store the resulting object(s) inmemory. This will cause the object to render much faster, but at the expense of memory.

The u_steps and v_steps keywords specify the maximum number of subpatches to divide the patch into.u_steps and v_steps are floats and shouldn't have any fractional part. The maximum number ofsubpatches can be calculated with the expression

max = 2 ^ u_steps * 2 ^ v_steps

As a result, it's a bad idea to make u_steps or v_steps very large. The POV-Ray authors recommend that"u_steps 3" and "v_steps 3" will cause most patches to render well. They also suggest 5 as a maximumvalue for either parameter.

The flatness keyword is used to determine if a subpatch needs to be divided into smaller ones. flatness isa float which should be between 0 and 1 inclusive. The lower this value is, the more subdivisionsPOV-Ray will make (up to the u_steps or v_steps). If this value is 0, POV-Ray will always divide thepatch into the maximum number of subpatches. Note that the lower this value is, the slower the patchwill render.

As bicubic patches are made of triangles, they don't have a clearly defined inside, and so can't be used inCSG (except for union) or inside a clipped_by statement.

Although it's not particularly useful, here's an example of a bicubic patch.

If you want to learn more about bicubic patches (how they are generated, how they work, how to createthem, and all the mathematics behind them) a book that we recommend is

Fundamentals of Interactive Computer GraphicsJ. D. Foley and A. Van DamAddison-Wesley1983ISBN 0-201-14468-9

It covers a great deal of material with a good amount of depth, despite the "fundamentals" in the title.Note that when dealing with bicubic patches this book assumes a familiarity with matrices.

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (2 of 13) [9/12/2001 3:24:08 PM]

Page 113: POV Ray Tutorial

BlobBlobs are quite peculiar. The basically consist of a bunch of spheres which attract or repel each other toform a surface. They aren't really meant to be precise objects, but rather objects that give a sort of"organic" feel to a scene. Their syntax is as follows:

blob { threshold threshold component strength1, radius1, <center1> component strength2, radius2, <center2> component strength3, radius3, <center3> component strength4, radius4, <center4>/* you can have as many components as you have memory and time */}

Blobs basically work by creating fields around each of the components by adding the strength valuesfrom each components according to a specified function. Wherever this value is equal to the threshold,the surface is drawn.

As described above, threshold tells where in space to draw the surface. It is a float which should begreater than zero.

The strength of each component tells how strong the field around this component is. This can be positiveor negative. A positive strength will cause the surface to stretch towards this component; a negativestrength will repel the surface away from this component. The larger the value, the greater the effect thisparticular component will have.

The radius of each component describes its field of effect. The blob equations are set up so that the fieldstrength of each component is equal to strength at the center of the component and falls off to zero at adistance of radius from the center of that component.

Each <center> vector gives the <x, y, z> of the center point of that component. As blobs are difficult tovisualize, here are a few examples.

blob { threshold 0.25 component 1.5, 0.5, <0, 0, 0> component 1, 0.5, <-0.5, 0.5, 0> component 1, 0.5, <0.5, 0.5, 0> pigment { color Red }}

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (3 of 13) [9/12/2001 3:24:08 PM]

Page 114: POV Ray Tutorial

blob { threshold 0.25 component 1.5, 0.5, <0, 0, 0> component 1, 0.5, <-0.5, 0.5, 0> component -1, 0.5, <0.5, 0.5, 0> pigment { color Red }}

Blobs can be used in CSG, the inside of a blob is anywhere the field strength is greater than thethreshold. Conversely, the outside is anywhere that field strength is less than the threshold. Note thatcomponents in different blob objects will not affect each other.

If a blob renders improperly, the keyword sturm may be added into the declaration. This will causePOV-Ray to use a more accurate (but slower) root solver.

BoxThe box primitive creates a rectangular prism (fancy term for a box) with faces parallel to the coordinateplanes. Its syntax is a follows:

box { <corner-1>, <corner-2>}

where <corner-1> and <corner-2> are vectors specifying the <x, y, z> of opposite corners of the box.The POV-Ray documentation states that all the elements of <corner-1> should be less than thecorresponding elements of <corner-2>, but I have never had problems with this. Here's an example of a

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (4 of 13) [9/12/2001 3:24:08 PM]

Page 115: POV Ray Tutorial

box:

box { <-1, -1, -1>, <1, 1, 1> pigment { color Green }}

This creates a green cube two units on a side centered at the origin. Here are some sample boxes, both ofwhich just happen to be cubes (not all boxes have to be cubes, though).

Boxes are highly optimized objects and thus make wonderful bounding volumes.

ConeThe cone primitive creates a creates a cone with the given characteristics. It is similar to the cylinder, buttwo radii are specified instead of just one. Its syntax:

cone { <center-1>, radius-1, <center-2>, radius-2 [open]}

<center-1> and <center-1> are <x, y, z> vectors for the centers of the two ends of the cone. radius-1and radius-2 specify the radius of the cone at <center-1> and <center-1> respectively. Both radius-1and radius-2 can be positive, negative, or zero. If one radius is zero, the objects looks like a standardcone shape. If both radii are the same sign, the object looks like a cone with the tip cut off. If the radii areopposite signs, the object looks like two cones with their tips touching. An example cone:

cone { <0, 0, 0>, 3, <0, 3, 0>, 0 pigment { color Blue }}

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (5 of 13) [9/12/2001 3:24:08 PM]

Page 116: POV Ray Tutorial

This will create a cone that is three units tall and six units in diameter at the base.

The following scene contains some other examples of cones.

The keyword open may be included in the object definition to make POV-Ray render the cone withoutendcaps.

CylinderThe cylinder primitive creates a circular cylinder with the given characteristics. The syntax of theprimitive is the following:

cylinder { <center-1>, <center-2>, radius [open]}

<center-1> and <center-2> are vectors specifying the <x, y, z> of the centers of the ends of the cylinder.radius specifies the radius of the cylinder. Note that the sides of the cylinder will always beperpendicular to the ends. An example cylinder declaration:

cylinder { <0, 0, 0>, <0, 1, 0>, 0.5 pigment { color Yellow }}

This will create a circular cylinder that has the same height as diameter.

The following example scene contains three cylinders.

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (6 of 13) [9/12/2001 3:24:08 PM]

Page 117: POV Ray Tutorial

Including the keyword open will cause POV-Ray to render the cylinder without endcaps (as a tube).

DiscThe disc primitive creates an infinitely thin circular disc with an optional hole in the center. The syntaxfor a disc:

disc { <center>, <normal>, radius [, hole radius]}

<center> is an <x, y, z> vector specifying the center of the disc. <normal> is a vector perpendicular tothe plane of the disc. radius is a float which gives the radius of the disc. Optionally, the float hole radiusmay be specified which will create a circular hole of that radius in the center of the disc. If present, holeradius should be smaller than radius (otherwise, what's the point?). Here's an example use of a disc:

disc { <0, 0, 0>, <0, 1, -1>, 2, 1.5 pigment { color Green }}sphere { <0, 0, 0>, 1 pigment { color Green }}

This will create a sort of monochromatic version of Saturn. Here's how that would look.

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (7 of 13) [9/12/2001 3:24:08 PM]

Page 118: POV Ray Tutorial

Note that discs are two dimensional objects and so have no inside or outside. Consequently, they can't beused in CSG (except in union) or inside a clipped_by.

Height FieldHeight fields are an easy way to create mountains in your scenes. They basically work by reading animage file and then turning that image into a mesh of triangles. The height of each point in the mesh isdetermined by the value of the corresponding pixel in the image. The general form for specifying aheight field is

height_field { type "filename" [smooth] [water_level height] /* transformations */}

type specifies the type of the file being read, and is one of gif, pot, or tga. This is then followed by thename of the source image (in quotes). With just these declarations, you'll get a height field which fits intothe unit box with vertices at <0, 0, 0> an <1, 1, 1>. The image is mapped onto the x-z plane with thevalue of the pixel determining the y value of the field. The lower-left corner of the image ends up at <0,0, 0> and the upper-right ends up at <1, 0, 1>. The lowest possible value of the height field ends up aty=0, while the highest gets y=1. The image is always rescaled to fit into that unit box. Thus, largerimages do not produce larger height fields, but rather ones with better resolution.

Here's an example of a height field. The first image is the source for the height field (black=0,white=255). The second is the rendered height field.

For gifs, the height of a given pixel is based on its palette index. The color with palette entry 0 gets thelowest height in the height field, while the color with palette entry 255 gets the hightest height in thefield. Thus with gifs, you can get 256 distinct height levels in the height field. Pot files work the same,except they support upto 32,000 (or so) colors. As with resolution, this does not produce taller heightfields, but rather ones with better vertical resolution. According to the POV-Ray authors, the PC programFractint can produce pot files.

Height mapping is done slightly differently with tga files. With tgas a sixteen bit number (so you get

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (8 of 13) [9/12/2001 3:24:08 PM]

Page 119: POV Ray Tutorial

65,536 height levels) is stored for each pixel using that pixel's red and green bytes. The most significantbyte is stored in the red, the least significant in the green. Generating these kinds of height fields is prettymuch beyond the scope of most paint programs, but it's pretty rare that you'll actually need 65,536distinct height levels anyway. Fractal mountains tend to look fine with 256 divisions, unless you want toget a super-close-up view.

Normally, POV-Ray generates height fields out of normal, flat triangles. This gives the height field arough, jagged look. While this may be exactly the effect you're looking for with mountains, sometimes itis undesirable. You can include the optional keyword "smooth" in the height field. This will causePOV-Ray to use smooth triangles instead of flat ones for mesh. POV-Ray will automatically calculatesurface normals to make the height field into a smooth, rolling surface, however, smooth height fieldsrequire much more memory to deal with than do normal height fields.

Another keyword that you can include is "water_level". This keyword is used to cut off the bottom partof a height field. This is useful for mountains which you plan to partially submerge in water. Parts of theheight field which are below the "water_level" will not be turned into triangles, making for a speedierrender. The water_level keyword takes a float parameter between 0.0 and 1.0 which specifies where toslice. 0.0 corresponds to the lowest level in the field, 1.0 to the heighest. 0.5 would cut off the bottomhalf of the field. This slicing is applied before any transformations are applied, so you should never needa value greater than 1. Here, for example, is the same height field as above with "water_level 0.5" addedin.

ObjectThe object primitive is not typically used to create single objects. It is primarily used only to createobjects that have been declared with a declare directive. In fact, an object primitive is implied around anyprimitive that creates an object. For example,

sphere { <1, 1, 1>, 1.732 pigment { color Red }}

Is the same as

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (9 of 13) [9/12/2001 3:24:08 PM]

Page 120: POV Ray Tutorial

object { sphere { <1, 1, 1>, 1.732 pigment { color Red } }}

The object primitive is more commonly used in this sort of fashion

#declare BlueSphere = sphere { <0, 0, 0>, 1 pigment { color Blue }}

object { BlueSphere}

object { BlueSphere scale 2 translate <0, 5, 5>}

Of course, this is a very simple example. Any type of object, whether finite, infinite, or CSG, can appearin an object statement.

Smooth TriangleSmooth triangles are triangular patches with normal vectors specified for each of the vertices. Thesevectors are used to bend the triangle into a curved shape. Smooth triangles aren't really designed to beused extensively by people. They're more the type of thing a modeller would produce to approximate asmooth surface. Here's the syntax anyway:

smooth_triangle { <vertex-1>, <normal-1> <vertex-2>, <normal-2> <vertex-3>, <normal-3>}

The three vertices specify the corners of the triangle. The corresponding normal vector is then used inshading the surface. Note that the normal vectors don't acutally cause the triangle to be deformed, theyjust alter the way POV-Ray shades it. This can be used to great effect when approximating smoothsurfaces, as it would require a much larger number of flat triangles to acheive the same results. To create

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (10 of 13) [9/12/2001 3:24:08 PM]

Page 121: POV Ray Tutorial

a smooth smooth_triangle mesh, the normals for shared vertices in any triangles should be the same.

Smooth triangles are perfectly two-dimensional so they have no inside or outside. They therefore cannotbe used in CSG (other than in union) or inside a clipped_by statement.

SphereThe sphere primitive creates a sphere of a given radius and center. The syntax is the following:

sphere { <center>, radius}

where <center> is a vector specifying <x, y, z> of the center of the sphere and radius is a floatspecifying the sphere's radius. For example,

sphere { <10, 10, 10>, 5 pigment { color Blue }}

will create a blue sphere of radius 5 that is centered at <10, 10, 10>. This primitive can only createspheres, but you can use nonuniform scaling to create ellipsoidal objects.

Anyway, here are some sample spheres.

Also, spheres are highly optimized objects in POV-Ray, and thus make spectacular bounding volumes.

TorusThe torus primitive will create a torus (doughnut shape) at the origin. A torus is a quartic shape; thisprimitive is basically an easier way of creating this cool and useful shape. The torus syntax is as follows:

torus {

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (11 of 13) [9/12/2001 3:24:08 PM]

Page 122: POV Ray Tutorial

major radius, minor radius}

The major radius and minor radius are defined as shown below

This primitive always creates a torus with a major axis in the x-z plane. If you want one with a differentorientation, you'll need to rotate it. The advantage to using this form over the quartic definition is thatthis form is known by POV-Ray to be finite, thus POV-Ray can optimize its rendering.

TriangleTriangles are the familiar three cornered polygons we all learned about in school. They are similar tosmooth triangles, only they don't have normal information for the vertices. Here's the syntax for thetriangle:

triangle { <corner-1>, <corner-2>, <corner-3>}

where each <corner> is an <x, y, z> vector specifying the locations of the three corners. Triangles aremoderately useful to human beings, but they're much more useful to modelling programs.

The object in the following scene is composed entirely of triangles. If you're interested, the object isknown as an icosahedron.

As with the other two dimensional objects, triangles have no inside or outside and so can't be used inCSG, with the exception of union, and nor can they be used inside a clipped_by.

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (12 of 13) [9/12/2001 3:24:09 PM]

Page 123: POV Ray Tutorial

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Finite Objects

http://library.thinkquest.org/3285/language/fobject.html (13 of 13) [9/12/2001 3:24:09 PM]

Page 124: POV Ray Tutorial

bicubic_patch { type 1 u_steps 3 v_steps 3 <0, 0, 0>, <1, 0, 0>, <2, 0, 0>, <3, 0, 0>, <0, 0, 1>, <1, 6, 1>, <2, -6, 1>, <3, 0, 1>, <0, 0, 2>, <1, -6, 2>, <2, 6, 2>, <3, 0, 2>, <0, 0, 3>, <1, 0, 3>, <2, 0, 3>, <3, 0, 3>

pigment { color rgb <1, 0.4, 0.4> }}

light_source { <-1.5, 5, 1.5> color rgb <1, 1, 1> }

camera { location <2, 3, -3> look_at <1.5, 0, 1.5>}

http://library.thinkquest.org/3285/language/src/fobj3.pov

http://library.thinkquest.org/3285/language/src/fobj3.pov [9/12/2001 3:24:10 PM]

Page 125: POV Ray Tutorial

box { <-3, -1, -1>, <-1, 1, 1> pigment { color rgb <1, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 1, 0> } rotate 45*y rotate -35.264*x translate <2, 0, 0>}

light_source { <10, 50, -80> color rgb <1, 1, 1> }

camera { location <0, 1.5, -6> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj8.pov

http://library.thinkquest.org/3285/language/src/fobj8.pov [9/12/2001 3:24:12 PM]

Page 126: POV Ray Tutorial

cone { <0, 0, 0>, 0.5, <0, 1, 0>, 0 pigment { color rgb <0, 0.7, 0> }}

cone { <-1, 0, 0>, 0.25, <-1, 0.5, 0>, 0.125 pigment { color rgb <0.7, 0.7, 0> }}

cone { <1, 0, 0>, 0.25, <1, 1, 0>, 0.5 pigment { color rgb <0, 0.7, 0.7> }}

light_source { <20, 10, -50> color rgb <1, 1, 1> }

camera { location <0, 0.5, -2.5> look_at <0, 0.5, 0>}

http://library.thinkquest.org/3285/language/src/fobj4.pov

http://library.thinkquest.org/3285/language/src/fobj4.pov [9/12/2001 3:24:13 PM]

Page 127: POV Ray Tutorial

cylinder { <-1, 0, 0>, <1, 0, 0>, 0.125 pigment { color rgb <1, 0, 0> }}

cylinder { <0, -1, 0>, <0, 1, 0>, 0.125 pigment { color rgb <0, 1, 0> }}

cylinder { <0, 0, -1>, <0, 0, 1>, 0.125 pigment { color rgb <0, 0, 1> }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0.5, 0.25, -3> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj5.pov

http://library.thinkquest.org/3285/language/src/fobj5.pov [9/12/2001 3:24:14 PM]

Page 128: POV Ray Tutorial

disc { <0, 0, 0>, <0, 1, -1>, 2, 1.5 pigment { color rgb <0, 1, 0> }}

sphere { <0, 0, 0>, 1 pigment { color rgb <0, 1, 0> }}

light_source { <20, 10, -50> color rgb <1, 1, 1> }

camera { location <0, 0, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj6.pov

http://library.thinkquest.org/3285/language/src/fobj6.pov [9/12/2001 3:24:15 PM]

Page 129: POV Ray Tutorial

height_field { gif "fract001.gif" pigment { color rgb <1, 1, 1> } translate <-0.5, -0.5, -0.5>}

disc { <0, -0.75, 0>, y, 2 pigment { checker color rgb <0.1, 1, 0.1> color rgb <0.4, 1, 0.4> scale 1/4 }}

light_source { <-1, 2, 0> color rgb <1, 1, 1> }

camera { location <-1, 0.5, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj1.pov

http://library.thinkquest.org/3285/language/src/fobj1.pov [9/12/2001 3:24:16 PM]

Page 130: POV Ray Tutorial

height_field { gif "fract001.gif" water_level 0.5 pigment { color rgb <1, 1, 1> } translate <-0.5, -0.5, -0.5>}

disc { <0, -0.75, 0>, y, 2 pigment { checker color rgb <0.1, 1, 0.1> color rgb <0.4, 1, 0.4> scale 1/4 }}

light_source { <-1, 2, 0> color rgb <1, 1, 1> }

camera { location <-1, 0.5, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj2.pov

http://library.thinkquest.org/3285/language/src/fobj2.pov [9/12/2001 3:24:17 PM]

Page 131: POV Ray Tutorial

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 1, 0> }}

sphere { <1, 1, 0>, 0.25 pigment { color rgb <0.2, 1, 0.2> }}

sphere { <0.5, -.5, -1>, 0.3 pigment { color rgb <1, 0.6, 0> }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0, 0, -3> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj7.pov

http://library.thinkquest.org/3285/language/src/fobj7.pov [9/12/2001 3:24:19 PM]

Page 132: POV Ray Tutorial

union { triangle { <0.0000, 0.0000, 1.0000>, <0.8660, 0.0000, 0.5000>, <0.2676, 0.8236,0.5000> } triangle { <0.0000, 0.0000, 1.0000>, <0.2676, 0.8236, 0.5000>, <-0.7006, 0.5090,0.5000> } triangle { <0.0000, 0.0000, 1.0000>, <-0.7006, 0.5090, 0.5000>, <-0.7006,-0.5090, 0.5000> } triangle { <0.0000, 0.0000, 1.0000>, <-0.7006, -0.5090, 0.5000>, <0.2676,-0.8236, 0.5000> } triangle { <0.0000, 0.0000, 1.0000>, <0.2676, -0.8236, 0.5000>, <0.8660, 0.0000,0.5000> } triangle { <0.8660, 0.0000, 0.5000>, <0.2676, 0.8236, 0.5000>, <0.7006, 0.5090,-0.5000> } triangle { <0.2676, 0.8236, 0.5000>, <-0.7006, 0.5090, 0.5000>, <-0.2676, 0.8236,-0.5000> } triangle { <-0.7006, 0.5090, 0.5000>, <-0.7006, -0.5090, 0.5000>, <-0.8660,0.0000, -0.5000> } triangle { <-0.7006, -0.5090, 0.5000>, <0.2676, -0.8236, 0.5000>, <-0.2676,-0.8236, -0.5000> } triangle { <0.2676, -0.8236, 0.5000>, <0.8660, 0.0000, 0.5000>, <0.7006, -0.5090,-0.5000> } triangle { <0.7006, 0.5090, -0.5000>, <-0.2676, 0.8236, -0.5000>, <0.2676,0.8236, 0.5000> } triangle { <-0.2676, 0.8236, -0.5000>, <-0.8660, 0.0000, -0.5000>, <-0.7006,0.5090, 0.5000> } triangle { <-0.8660, 0.0000, -0.5000>, <-0.2676, -0.8236, -0.5000>, <-0.7006,-0.5090, 0.5000> } triangle { <-0.2676, -0.8236, -0.5000>, <0.7006, -0.5090, -0.5000>, <0.2676,-0.8236, 0.5000> } triangle { <0.7006, -0.5090, -0.5000>, <0.7006, 0.5090, -0.5000>, <0.8660,0.0000, 0.5000> } triangle { <0.0000, 0.0000, -1.0000>, <0.7006, 0.5090, -0.5000>, <-0.2676,0.8236, -0.5000> } triangle { <0.0000, 0.0000, -1.0000>, <-0.2676, 0.8236, -0.5000>, <-0.8660,0.0000, -0.5000> } triangle { <0.0000, 0.0000, -1.0000>, <-0.8660, 0.0000, -0.5000>, <-0.2676,-0.8236, -0.5000> } triangle { <0.0000, 0.0000, -1.0000>, <-0.2676, -0.8236, -0.5000>, <0.7006,-0.5090, -0.5000> } triangle { <0.0000, 0.0000, -1.0000>, <0.7006, -0.5090, -0.5000>, <0.7006,0.5090, -0.5000> } pigment { color rgb <0, 1, 0> }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0.75, 0.75, -2.5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fobj9.pov

http://library.thinkquest.org/3285/language/src/fobj9.pov [9/12/2001 3:24:22 PM]

Page 133: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Language ReferenceWelcome to the POV-Ray Language Reference. This document contains information on the syntax,usage and purpose of every POV-Ray keyword and feature. Select a topic from below:

General POV-Ray Language and Scene Wide Modifiers

POV-Ray directives, transformations and other miscellaneous features.

Finite Objects

Finite POV-Ray primitives (those containing well-defined bounds).

Infinite Objects

Infinite POV-Ray primitives (those including a component which may potentially extend toinfinity)

CSG (Constructive Solid Geometry)

CSG object manipulations (union, merge, difference, etc.)

Object Modifiers

Directives used to modify the default behaviour of certain objects.

Pigment

Object surface color/pattern modifiers.

Finish

POV-Ray directives that modify the way light interacts with object surfaces.

Normal

POV-Ray directives that can quickly simulate common 3D attributes such as bumps.

Texture

Special surface color/patterns modifiers.

Camera

POV-Ray camera modifiers.

Lights

POV-Ray light source types and attributes.

Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial: POV-Ray Language Reference

http://library.thinkquest.org/3285/language/index.html (1 of 2) [9/12/2001 3:24:29 PM]

Page 134: POV Ray Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: POV-Ray Language Reference

http://library.thinkquest.org/3285/language/index.html (2 of 2) [9/12/2001 3:24:29 PM]

Page 135: POV Ray Tutorial

The Online POV-Ray Tutorial

Infinite Object ReferenceThe following topic are covered in this section

Cubic●

Plane●

Poly●

Quadric●

Quartic●

CubicA cubic is a third order poly. This means that the sum of the exponents of the variables in each term is less than or equalto three. The following are examples of equations (some cubic, some not).

x - y^3 + 3 cubic x^3 + 3 x^2 y + 3 x y^2 + y^3 cubic x^2 y^2 - 6 not cubic, in first term 2 + 2 > 3 y z - z x^2 - x y^2 - y z^3 cubic 3 cubic (but rather pointless)

Note also that the exponents in each terms are non-negative integers. For a better definition of polynomials see poly orjust about any algebra text. The syntax for a cubic is as follows:

cubic { <a0, a1, a2, . . . a19>}

a0 through a19 are all floats. They are the coefficients for the general cubic equation in three variables:

a0 x^3 + a1 x^2 y + a2 x^2 z + a3 x^2 + a4 x y^2 + a5 x y z +a6 x y + a7 x z^2 + a8 x z + a9 x + a10 y^3 + a11 y^2 z +a12 y^2 + a13 y z^2 + a14 y z + a15 y + a16 z^3 + a17 z^2 +a18 z + a19 = 0

The second equation above would be defined by

cubic { <1, 3, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>}

Cubics are useful shapes as they can be used to smoothly join two curves together. See the section on tips and tricks formore information on this technique.

Calculations for cubics (as well as any type of poly) must be very accurate or the surface will appear strangely deformed.If you have a cubic that dessn't seem to be rendering correctly, the keyword sturm may be added to the definition to tellPOV to use its more accurate (but unfortunately slower) Sturmian root solver. Also, sometimes the problem can be fixed

The Online POV-Ray Tutorial: Infinite Objects

http://library.thinkquest.org/3285/language/iobject.html (1 of 5) [9/12/2001 3:24:34 PM]

Page 136: POV Ray Tutorial

by rotating, scaling, or translating the object by some small amount.

Cubics (like all polys) can be used in CSG as they have a defined inside and outside. The inside is defined to be allpoints where the equation is less than zero. The outside is all points where the equation is greater than zero. Points wherethe equation equals zero are on the surface. Note that cubics are considered infinite objects by POV, so they will not beoptimized with automatic bounds.

PlaneThe plane primitive creates an infinite, flat plane of any orientation and any location. The syntax of plane is as follows:

plane { <normal>, offset}

<normal> is an <x, y, z> vector that describes the plane by giving a normal to its surface. By default, the plane goesthrough the origin. This is changed with the offset value. It is a float that translates the plane along its normal vector. Itmay be positive, negative, or zero, and can be used to position the plane anywhere in space. Here are some examples ofplanes:

plane { y, 3}

This plane is parallel to the x-z coordinate plane. It extents infinitely in both the x and z directions.

plane { <1, 1, 1>, 0}

This plane is diagonal and goes through the origin.

Planes are acutally a very simple (first order) poly. The primitive can also be represented by

plane { <a, b, c>, d}

which would represent the equation

a x + b y + c z = d

This is important because it defines the "inside" and "outside" of a plane for use in CSG. By this definition, the normalvector always points to the "outside" of the plane.

PolyThe poly primitive can be used to define up to seventh order polynomials in three variables. Note that there are alreadyprimitives to define second, third, and fourth order polynomials (quadric, cubic, and quartic respectively). There is no

The Online POV-Ray Tutorial: Infinite Objects

http://library.thinkquest.org/3285/language/iobject.html (2 of 5) [9/12/2001 3:24:34 PM]

Page 137: POV Ray Tutorial

difference between defining one of these with the poly primitive or with its specialized primitive.

Very quickly, a polynomial is an expression that consists of

But anyway, the general syntax for poly is like this:

poly { order, <a0, a1, . . . an>}

order is a float which defines the order of the polynomial. order should be an integer between 2 and 7 inclusive. a0through an are the coefficients for the generic polynomial equation of order order. The number of coefficients in theequation m is defined by the equation

m = (order + 1) * (order + 2) * (order + 3) / 6

Note that n = m - 1. This relationship can make defining seventh order polynomials by hand a real pain (they have 120coefficients).

The other concern when defining polys is the order of the coefficients. This is not well covered in the POV-Raydocumentation, but after some experimentation the pattern was determined. The following pseudocode segment willprint out the terms in order:

for x : order -> 0 for y : order - x -> 0 for z : order - x - y -> 0 print "x^", x, " y^", y, " z^", z

As an example of this, the generic fifth order equation (all 56 terms) is

a0 x^5 + a1 x^4 y + a2 x^4 z + a3 x^4 + a4 x^3 y^2 + a5 x^3 y z +a6 x^3 y + a7 x^3 z^2 + a8 x^3 z + a9 x^3 + a10 x^2 y^3 + a11 x^2 y^2 z +a12 x^2 y^2 + a13 x^2 y z^2 + a14 x^2 y z + a15 x^2 y + a16 x^2 z^3 +a17 x^2 z^2 + a18 x^2 z + a19 x^2 + a20 x y^4 + a21 x y^3 z + a22 x y^3 +a23 x y^2 z^2 + a24 x y^2 z + a25 x y^2 + a26 x y z^3 + a27 x y z^2 +a28 x y z + a29 x y + a30 x z^4 + a31 x z^3 + a32 x z^2 + a33 x z +a34 x + a35 y^5 + a36 y^4 z + a37 y^4 + a38 y^3 z^2 + a39 y^3 z +a40 y^3 + a41 y^2 z^3 + a42 y^2 z^2 + a43 y^2 z + a44 y^2 + a45 y z^4 +a46 y z^3 + a47 y z^2 + a48 y z + a49 y + a50 z^5 + a51 z^4 + a52 z^3 +a53 z^2 + a54 z + a55 = 0

Ugh. This is definitely not something that one would want to type by hand. The cumbersomeness (cumbersomity?) ofhigh order polys is the main limitation on their usefulness. POV comes with a number of predefined poly shapes; theycan be found in shapesq.inc. The POV-Ray authors also recommend

The CRC Handbook of Mathematical Curves and SurfacesDavid von SeggernCRC Press1990

as a good resource for finding cool surface equations.

Another concern with high order polys is the extreme accuracy required to render them accurately. If you have a polythat seems to rendering incorrectly, you can include the keyword sturm in the object definition. This will tell POV to useits more accurate (but somewhat slower) Sturmian root solver.

All polys can be used in CSG and clipped_by constructs. The inside of the poly is defined to be all points with values

The Online POV-Ray Tutorial: Infinite Objects

http://library.thinkquest.org/3285/language/iobject.html (3 of 5) [9/12/2001 3:24:34 PM]

Page 138: POV Ray Tutorial

(when plugged into the equation) is less than zero. Conversely, the outside is all points with values greater than zero. Allpoints with values of zero are on the surface of the object. Note also that POV considers all polys of any order to beinfinite objects (regardless of whether or not they actually are) and so it does not automatically bound them.

QuadricA quadric is a second order poly. It can be used to create simple shapes like cylinders, cones, spheres, and hyperboloids.Note that many of these shapes already have primitives associated with them. It is usually better to use the sphereprimitive to create a sphere than to use a quadric statement, because POV has special optimizations for spheres thatwould not take effect with the quadric definition. Note also that quadrics and quartics are different (quartics are fourthorder polys).

The syntax for a quadric is as follows:

quadric { <a, b, c>, <d, e, f>, <g, h, i>, j}

a through j are all floats and correspond to the following second order poly equation:

ax^2 + by^2 + cz^2 +dxy + exz + fyz +gx + hy + iz + j = 0

Some examples of quadrics:

quadric { // an infinite cone opening in the x direction <1, -1, -1>, <0, 0, 0>, <0, 0, 0>, 0}

quadric { // a sphere of radius 3 centered at <3, 3, 3> <1, 1, 1>, <0, 0, 0>, <-6, -6, -6>, 18}

quadric { // a rotated cone <1, 0, 1>, <-2, 0, 0>, <0, 0, 0>, 0}

Well, you get the idea. There are actually quite a large number of useful shapes that can be generated with quadrics. This

The Online POV-Ray Tutorial: Infinite Objects

http://library.thinkquest.org/3285/language/iobject.html (4 of 5) [9/12/2001 3:24:34 PM]

Page 139: POV Ray Tutorial

is nice because quadrics are easy to define and are fairly efficient to render.

As with all polys, accuracy is a factor in rendering quadrics. Although quadric surfaces will rarely cause problems, if youhave one that's rendering incorrectly, you can throw in the keyword sturm to tell POV to use its slow but accurateSturmian root solver.

Quadrics have a clearly defined inside and outside, and so can be used in CSG. They are considered to be infinite and soare not automatically bounded.

QuarticQuartics are fourth order poly objects. Note the two letter (but very important) difference between quartic and quadric. Acommon and useful example of a quartic shape is the torus (or doughnut) shape. For concerns of efficiency and ease ofuse, you should probably use the torus primitive to declare a torus. The POV-Ray documentation contains a discussionof the quartic primitive, so it won't be repeated here. The syntax for a quartic is as follows:

quartic { <a0, a1, . . . a34>}

Each of a0 through a34 is a float. The correspondence of these numbers to terms in the generic quartic equation iscovered with the discussion of poly.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Infinite Objects

http://library.thinkquest.org/3285/language/iobject.html (5 of 5) [9/12/2001 3:24:34 PM]

Page 140: POV Ray Tutorial

The Online POV-Ray Tutorial

Tips and TricksWe've provided a list of useful tips and tricks to help you in learning and using POV-Ray. We came upwith most of these as a side-effect of frequent POV-Ray use on our part (when we really should havebeen doing other things, like homework), so they're worth looking at.

Quick index:

Developing POV-Ray Scenes1.

Being Artistic2.

Developing POV-Ray Scenes

Develop a good coding style. (A coding style is the way you format the source code in the file --where you place the tabs and such). If you ever go back and work on a scene you made a monthago, this can be invaluable. We personally like the one we've used in the examples in this tutorial,but you should feel free to develop one you like... just be consistent!

Be prepared to spend some time. Not even the fastest computers will be fast enough for youonce you really get going. Ray-tracing is a slow process. Make yourself a cup of coffee, or go on amonth's vacation (if it's a really complex scene), or, better yet, multitask! (Sorry, DOS users,you're stuck with waiting).

Low-quality images generate faster; use them.You can save yourself some time whendeveloping a scene by generating low-quality output (see the +Q switch and the +A switchdocumentation in the Command Line Reference. Generate high quality output for the final scene.

Make small changes, and render frequently. Although this seems like it will take more time,you will have actually saved yourself time that would have otherwise been spent debugging sceneswhere many changes have been made. If you rotate the camera, add three more objects, andchange the lighting all in one go, the chances of you getting lost are a lot greater than if you rendera quick image in between each step.

Experiment. This tutorial can't teach you everything. Experimenting with objects, textures, andeverything else about POV-Ray is the best way to learn. It certainly can't hurt anything. And hey,if you make anything interesting, submit it to the Texture Library or the Object Library for othersto see!

Don't start out with a modeller. Only start using extra tools once you have a firm understandingof POV-Ray and have had plenty of experience just using the text editor -- otherwise, you won'tlearn some of the most important things and you'll be very stuck down the road.

Zoom way back if you've lost an object. The best way to find "missing" objects (objects that youput in the source code but that aren't appearing on-screen) is to pull the camera far back. You maybe able to find the objects. Another possibility is that the object has no texture. POV-Ray willusually give you a warning in this case, but sometimes it'll just go ahead and color the object

The Online POV-Ray Tutorial: Tips and Tricks

http://library.thinkquest.org/3285/tips.html (1 of 3) [9/12/2001 3:24:50 PM]

Page 141: POV Ray Tutorial

black.

Be aware of the defaults. Sometimes default values for things can mess up a scene. For example,putting "reflection 1.0" in an object's finish statement will not make that object a perfect reflector.You also need to add "ambient 0.0" and "diffuse 0.0". You can use the default directive to changethe default behavior of an object.

Bound complex objects. POV-Ray is only able to do so much with automatic bounds. Theautomatic bounding algorithm won't even touch really complex objects (like intersections orpolynomial objects). You can really speed up rendering by specifying a bounding object for these,if applicable. Of course, if you have an infinite cone (for example), it'll be difficult to find anobject which contains it. By far the best objects for bounding are boxes and spheres. Seebounded_by.

Being Artistic

Surrealism is easy. Because of the way ray-tracers work, scenes tend to come out looking a littlesurrealistic. Try maximizing this effect. Use it to your advantage.

Try adding some fog. Just a little bit of fog can make your scene look a lot morethree-dimensional, and it's not very computationally expensive. Try it.

Use your light sources wisely. Lighting can make and break a scene -- especially if you'reworking with glass or mirror-like objects. Bad lighting can make your image seem flat andtwo-dimensional, too dark, too bright, or just plain boring. Experiment, and find just the rightconfiguration for each scene you create. Remember, if your light source color is <2,2,2>, it will betwice as bright (this trick can save you a lot of time).

Avoid infinite ground planes. Planes which stretch or appear to stretch off to infinity will giveyour scene an empty feeling. Unless you can find a way to populate this space with something,your scene will feel unbalanced. Of course, we've broken this rule many times throughout theTutorial... but only when we're not trying to be artistic. Really.

How something appears is more important than how it is. A scene needs to look right. Ifsomething is mathematically correct but doesn't look like it, that doesn't help you much. This is art-- the ends justify the means!

Concentrate on what can be seen. This is related to the above tip. Don't agonize about perfectingthings the viewer is never going to be able to see. As stated above, things only need to look right.

Use a sky sphere. In scenes where you're going to have a visible "sky", a sky sphere is veryeffective. This is a sphere of a very large radius (the edge is maybe 1000 times further than anyobject in the scene), which you can texture to give a sky-like appearance. To keep things fromcasting a shadow on the sky sphere, use only ambient lighting on the sphere; turn off all the diffuselighting. If you just want a sky that's a single color, you can just use the background directive.

Top of Document Main Page

The Online POV-Ray Tutorial: Tips and Tricks

http://library.thinkquest.org/3285/tips.html (2 of 3) [9/12/2001 3:24:50 PM]

Page 142: POV Ray Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Tips and Tricks

http://library.thinkquest.org/3285/tips.html (3 of 3) [9/12/2001 3:24:50 PM]

Page 143: POV Ray Tutorial

The Online POV-Ray Tutorial

Command Line Parameter ReferenceThis section covers the various command-line parameters which POV-Ray will accept. POV-Ray checkscommand line parameters in a non-case-sensitive fashion. This means, for example, that +a is the sameas +A.

Some options are toggles, some are specifiers. With the toggles, specifying a "+" before the letter turnsthe option on, while specifying a "-" before it will turn it off. Examples of toggles are A, J, and MB. Withspecifiers, a value for a parameter is specified. Here, either "+" or "-" can be used before the letter. Theargument for the specifier follows the parameter without a space. "-Ifoo.pov" for example.

Any command line parameter which is not preceded by a "+" or a "-" is assumed to be the name of acommand file from which further options will be read.

Valid command line parameters are listed below.

A

Controls anti-aliasing (edge smoothing) of the image

B

Controls the size of the output buffer

C

Used to continue a incomplete render of an image

D

Controls display of the image during rendering

E or ER

Sets the ending row for partial renders

EC

Sets the ending column for partial renders

F

Sets to format of the output image

H

Specifies the height of the image (in pixels)

I

Specifies the name of the scene file being rendered

J

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (1 of 11) [9/12/2001 3:27:16 PM]

Page 144: POV Ray Tutorial

Controls jitter during anti-aliasing

K

Specifies a value for the clock variable

L

Specify a path to search for files in

MB

Controls POV-Ray's use of automatic bounding

MS

Controls the size of POV-Ray's internal symbol table

MV

Used to modify the default value of the version parameter

O

Specifies a filename to render the scene to

P

Controls whether POV-Ray waits for a keypress after rendering

Q

Controls the rendering quality

R

Controls the number of extra rays used for anti-aliasing

S or SR

Sets the starting row for partial renders

SC

Sets the starting column for partial renders

V

Controls the display of verbose statistics while rendering

W

Specifies the width of the output image (in pixels)

X

Controls whether or not POV-Ray can be interrupted once started (only available in certainversions)

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (2 of 11) [9/12/2001 3:27:16 PM]

Page 145: POV Ray Tutorial

A: anti-aliasingThe "A" parameter is a toggle that controls anti-aliasing of the rendered image. "+A" turns onanti-aliasing, "-A" turns it off. The default is "-A". Anti-aliasing works by determining how different twoadjacent pixels are, and if they are too different, POV-Ray shoots extra rays into the scene (itsupersamples the pixel) and colors the pixel with the averaged value. Note that because anti-aliasingrequires extra rays to be traced, it drastically increases the amount of time to render the scene. It's notuncommon for anti-aliasing to double or triple the rendering time of a scene. Thus, it's a good idea toonly use this option for final images, or right before you go to bed for the night.

The following scenes and zoom-ins should should make anti-aliasing more clear. The first has noanti-aliasing, the second was rendered with "+A -J".

The "distance" between two colors is determined by summing the absolute values of the differences ofeach color component (phew!). For example, if you have two colors <0.2, 0.6, 0.8> and <0.3, 0.3, 0.9>,the difference will be 0.5 (0.1 + 0.3 + 0.1). If the distance between two colors is greater than thethreshold (0.3 by default), then the pixels will be anti-aliased. This threshold can be changed byspecifying a float with the "+A". For example, "+A1.5" will only anti-alias if the distance between twocolors is greater than 1.5. The maximum threshold is 3.0, which effectively turns off anti-aliasing. Settingthe threshold to 0.0 will make POV-Ray anti-alias every pixel.

The number of rays used to supersample a pixel can be controlled with the R parameter. You canintroduce a random jitter into the supersampling rays with the J parameter.

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (3 of 11) [9/12/2001 3:27:16 PM]

Page 146: POV Ray Tutorial

B: buffer sizeThe value of this parameter controls how many pixels POV-Ray should calculate between disk writes.By default, POV-Ray will write to the disk after every line is calculated. The POV-Ray authorsrecommend +B30 as a good value for speeding up small renders. Note that "-B" cannot be used to turnoff the output buffer.

C: continue interrupted renderThis is a toggle which can be used to get POV-Ray to continue work on a partially completed render.This is useful for when you have a trace which is taking a particularly long time to render, and you needto do something else with the computer for a while. You can interrupt the trace (see the X parameter), dowhat you need to do, and then restart with "+C". The default value of this toggle is "-C" (start anew).

D: display imageThe D parameter controls whether or not POV-Ray displays the image as it renders it. The parameter forD is system dependent, and display-while-render is not supported across all platforms. There should besystem specific documentation with POV-Ray that details this parameter for your particular system.

E: ending rowThe E and ER parameters are used to tell POV-Ray to stop tracing after a certain row. E and ER arefunctionally equivalent. If their parameter is an integer, it specifies the row number on which to stop. If itis a float, it specifies a fraction of the image to render. This is useful for debugging a scene when you areonly interested in a part of it. For example, if your image is 256 pixels high (see the H parameter),"+E192" and "+E0.75" will have the same effect. This is useful in concert with some or all of S, SC, andEC to render a rectangular portion of an image.

EC: ending columnThe EC parameter is used set the ending column for a partial image render. If the value for the parameteris an integer, POV-Ray interprets it to be the absolute number of the stopping column. If the value is anumber betweem 0.0 and 1.0, POV-Ray interprets it to be a fraction the image width. For example, ifyour image is 256 pixels wide, "-EC160" and "-EC0.625" have the same effect. This parameter can beused in concert with E, S, and SC to specify a rectangular region of the image to render.

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (4 of 11) [9/12/2001 3:27:16 PM]

Page 147: POV Ray Tutorial

F: output file typeThe F parameter is used to control the file output format. Three file output types are supported,Truevision Targas, Dumps, and raw data output. These can be specified using the "+FT", "+FD", and"+FR". Of these, the Targas are probably the most useful and widely supported. You can disable fileoutput by specifying "-F". It's a good idea to have F or D enabled (or both), otherwise you'll just spend alot of time doing nothing.

H: image heightThe H parameter is used to specify the height of the output image in pixels. If not specified, it willdefault to 100. This parameter can take any value between 1 and 32,767 (inclusive). For example,specifying "-H768" will render an image that is 768 pixels high. To avoid weird distortion effects, it's agood idea to have the ratio of H and W be the same as the ratio of the up and right vectors in the camera.

I: input fileThe I parameter is used to specify the file from which POV-Ray will read the scene description. Byconvention, input files have the extension ".pov", but this is not required. If no I parameter is specified,POV-Ray will try to read from "object.pov". If you wanted to render the file "shmoo.pov", you wouldspecify "-Ishmoo.pov". As this parameter is not a toggle, both "+" and "-" work equally well inspecifying it.

J: jitterThe J toggle controls the use of jitter when anti-aliasing an image. When "+J" is specified (this is thedefault when +A is given), POV-Ray will randomly perturb the extra rays it uses to do the anti-aliasing.This serves to break up edges and prevent annoying moire patterns along anti-aliased edges. J can alsotake a parameter between 0.0 and 1.0 which controls how much jittering will be done. The default is 1.0.Values greater than 1.0 aren't recommended because they cause supersampling rays to be jittered outsidethe pixel.

The first image below was anti-aliased without jittering, the second, with. Although it's difficult to tellthe difference, you'll notice that the zoom-in on the second image is a bit different from the zoom-in ofthe first.

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (5 of 11) [9/12/2001 3:27:16 PM]

Page 148: POV Ray Tutorial

To set the jitter to something lower, you could try "+J0.5". "-J" will turn off pixel jittering.

K: clockThe K parameter is used to specify a value for the clock variable. This is useful for creating simpleanimations, but won't help too much with more complex stuff. It takes any floating point number as aparameter. If not specified, the value of the clock variable will be zero. For example, to set the value ofthe clock variable to "3.14159", you would give the parameter "+K3.14159".

L: library pathsThe L parameter is used to specify search paths for the various features of POV-Ray. When searching foran external file, POV-Ray will first look in the current directory, and then any directories given with theL parameter. You can use this to specify up to ten different search directories. These search directoriesare used for including files, or for images used in height fields, image maps, bump maps, and materialmaps. For example, you had your include files in the subdirectory "include" and your image maps in asubdirectory "images", you could tell POV-Ray to search those two directories when appropriate bygiving the parameters "-Linclude -Limages".

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (6 of 11) [9/12/2001 3:27:16 PM]

Page 149: POV Ray Tutorial

MB: control automatic boundingThis parameter is used to control POV-Ray's use of things called bounding slabs. When a scene reaches apredetermined complexity (defined by the number of objects in the scene), POV-Ray will divide them upand group them with these bounding slabs. These are very efficient bounding objects, and can speed arender greatly. However, for scenes which aren't very complex, the overhead involved in computing theslabs outweights any benefits. The value of the MB parameter is used to set the object threshold for theuse of bounding slabs. By default it is 25, and this is a good limit. If you wanted to turn the threshold upto 50, you would issue the parameter "+MB50". "-MB" will turn off the use of bounding slabs.

MS: control symbol table sizeThis parameter is used to control the size of POV-Ray's internal symbol table. Space in this table isallocated for everything that is declared in a scene file. Note that the standard include files tend to have agreat number of declared identifiers, and this can cause the symbol table to fill up more quickly than youwould expect. The default symbol table will hold 1000 symbols. If you get a "Too many symbols" errormessage, you need to either decrease the number of declares in your scene, or increase the size of thesymbol table (the latter being the easier of the two). To increase the size of the symbol table to 2000symbols, give the parameter "-MS2000". "+MS2000" will work just as well.

MV: set versionThe MV parameter is used to tell POV-Ray what version scene files it's reading. Two values can bespecified for this parameter, 1.0 and 2.0. The default is 2.0, which is the syntax covered in this tutorial.However, if you want to render a scene which uses v1.0 syntax, you can use this parameter to getPOV-Ray to recognize it. Note that there have been some changes to the language which will not befixed with this parameter. Inside the scene file you can change the version with the #version directive.

O: set output filenameThe O parameter is used to tell POV-Ray what file to output to when file output is enabled. If notspecified, it will default to "-Odata.tga". If the file you specify already exists, it will be overwritten. If,for example, you wanted to send the output to "shmoo.tga", you would give the parameter"-Oshmoo.tga". "+Oshmoo.tga" will work just as well.

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (7 of 11) [9/12/2001 3:27:16 PM]

Page 150: POV Ray Tutorial

P: wait for keypressThe P parameter is a toggle which tells POV-Ray whether or not to wait for a keypress after it's donerendering. The default value is "-P" (don't wait for keypress). "+P" is useful for pausing when you'redisplaying an image.

Q: set rendering qualityThe Q parameter is used to tell POV-Ray what quality you want to render the image at. The default valueis 9 (highest) quality. Rendering lower quality images is useful for debugging a scene. Lower qualitysettings will disable mroe and more features, resulting a quicker and quicker and render. This parametercan take a value from 0 (low quality, quick render) to 9 (high quality, not-as-quick render). Thefollowing list summarizes the effects of the different quality settings.

+Q0, +Q1

Use quick colors (or gray scale) to color objects. Ambient light only. No shadows, no shading, noreflections, no transmission, no refraction, and area lights are rendered as point lights.

+Q2, +Q3

Enables diffuse lighting and shading of objects.

+Q4

Enables shadow calculations.

+Q5

Enables area lights.

+Q6, +Q7

Stops using quick colors, and instead colors objects based on their assigned textures.

+Q8, +Q9

Enables reflection and transparency calculations (including refraction).

The following images are of the same scene, rendered at quality settings 1, 3, 5, 7, and 9, respectively.

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (8 of 11) [9/12/2001 3:27:16 PM]

Page 151: POV Ray Tutorial

R: number of supersampling raysThe R parameter is used to control how many rays POV-Ray will supersample with when it isanti-aliasing. The default value is 3, which means that POV-Ray will use a 3x3 grid of rays. Giving theparameter "+R5" will tell POV-Ray to use a 5x5 grid. Normally, the default value is sufficient to make ascene look nice. You shouldn't need to use high values of R. Note that since the number of extra raysincreases with the square of this number, setting it much beyond 5 or 6 is a bad idea unless you're goingon vacation for a week.

The following two images show the difference between "+R3" (default) and "+R5", respectively, whenanti-aliasing. Although the two zoomed-in images don't look to different, the second normal size imagehas softer, better looking edges. These softer edges are even more apparent when the image is still in24-bit color (as opposed to the 8-bits supported by .GIFs).

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (9 of 11) [9/12/2001 3:27:16 PM]

Page 152: POV Ray Tutorial

S: starting rowThe S or SR parameter is used to specify a starting row for a partial image render. If the value given forthis parameter is an integer, POV-Ray assumes you're giving a line number, and will start rendering atthe specified row. If the value is instead between 0.0 and 1.0, POV-Ray interprets it as a fraction of theimage height. For example, if your image is 256 pixels high, then the arguments "-S64" and "-S0.25" willhave the same effect. Note that "+S" will work just as well in both these cases. This parameter is usefulin conjunction with E, SC, and EC for specifying a rectangular portion of the image to render.

SC: starting columnThe SC parameter is used to specify the starting column for partial image renders. If the value given forthis parameter is an integer, it is assumed to be the absolute column number on which to begin. If it is anumber betweem 0.0 and 1.0, it is interpreted to be a fraction of the total image width. For example, ifyour image is 256 pixels wide, then "-SC32" and "-SC0.125" are the same. This parameter is useful touse with S, E, and EC to render a rectangular portion of an image.

V: verboseThe V parameter allows you to control the verbose reporting of statistics while rendering. This is onlyuseful when you aren't displaying the image. "+V" gives a report of how much of the image has rendered,while "-V" turns that reporing off. The default value is "-V".

W: image widthThe W parameter is used to specify the width of the rendered image. If you don't specify a width, it willdefault to 100 pixels. The image width can be anywhere from 1 to 32,767 pixels. As an example, to setthe width of the image to 1024 pixels, you would give "-W1024". "+W1024" will work just as well. Toavoid weird image distortion, it's a good idea to make the ratio between the W and H values the same asthe ratio between the right and up vectors in the camera.

X: allow interruptIn certain versions (the DOS version, for example) the "+X" option will allow you to halt the renderingby hitting a key. "-X" will make it so that the only way to stop the trace is to reboot the computer. "-X" isuseful for when you're starting a long trace and you don't want anyone to accidently stop it. If you do

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (10 of 11) [9/12/2001 3:27:17 PM]

Page 153: POV Ray Tutorial

stop an trace (when in +X mode), you can restart it later with the C option.

Reference Index Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Command Line Parameters

http://library.thinkquest.org/3285/language/cmdln.html (11 of 11) [9/12/2001 3:27:17 PM]

Page 154: POV Ray Tutorial

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*10}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0.5685, 0.7095, 0.7785> } rotate <0, 45, 0> rotate <55, 0, 0>}

light_source { <-1, 4, -1> color rgb <1, 1, 1> }

camera { location <1, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/cmdln2.pov

http://library.thinkquest.org/3285/language/src/cmdln2.pov [9/12/2001 3:27:18 PM]

Page 155: POV Ray Tutorial

The Online POV-Ray Tutorial

CameraThe following topics are covered in this section.

Camera●

Direction●

Location●

Look At●

Right●

Sky●

Up●

The following predominantly blue scene will be used to demonstrate the effects of the various cameramodifiers.

CameraThe camera defines what you exactly you see when you render an image. The camera is probably thesinlge most important element of a scene. Without a camera, there is no image (although it may just beall black without a few other things). There can only be one camera per scene. The POV-Ray camera is avery simple type of camera. It is not a "lens" camera, and consequently everything in the scene is alwaysin focus. All you usually need to worry about with a camera is where it is and where it's pointing. Thedefault settings usually take care of the rest. The general form for declaring a camera is something likethis

camera { location <loc> sky <sky vector> up <up vector> right <right vector>

The Online POV-Ray Tutorial: Camera

http://library.thinkquest.org/3285/language/camera.html (1 of 6) [9/12/2001 3:28:11 PM]

Page 156: POV Ray Tutorial

direction <direction vector> look_at <target>/* translations, rotations, and scales */}

When declaring a camera, components that appear should do so in this order. This is because some latercomponents modify previous ones, and putting them in the wrong order may result in your camera notdoing exactly what you expect. Actually, the only really important ordering is that "look_at" shouldappear after "direction" if they are both present.

Location is pretty self evident; it tells POV-Ray where in space to locate the camera. It takes an <x, y, z>vector of the location.

Sky is used to tell the camera which way is up. Modifying this value can be used to roll the cameraaround its central axis.

Up, right, and direction are used to modify the field of view and aspect ratio of the image.

Direction and look_at are used to point the camera at a specific point in the scene. Direction is moretypically used with up and right to define field of view then to position the camera, though.

Most of the time, you'll only need to use "location" and "look_at" to define your camera. The otherspecifiers can be used for fine tuning a scene and producing special effects.

After the camera is declared, it can be transformed like any other object. Any transformation applied toobject modify the location of the camera and (potentially) the direction it's pointing.

DirectionThe direction vector is primarily used in conjunction with up and right to define the field of view. It canalso be used to implement a telephoto lens or, less commonly, to orient the camera (but this is morecommonly done with look_at. The default value of direction is <0, 0, 1>. Increasing the magnitude of thedirection vector "stretches" the viewing pyramid and creates a telephoto sort of effect. Decreasing themagnitude of the direction vector "compresses" the viewing pyramid and gives the effect of a wide-anglecamera. Here are some sample images with different direction vectors. The first uses "direction <0, 0,0.5>", the second "direction <0, 0, 1>", the third "direction <0, 0, 2>", and the fourth "direction <0, 0,4>".

The Online POV-Ray Tutorial: Camera

http://library.thinkquest.org/3285/language/camera.html (2 of 6) [9/12/2001 3:28:11 PM]

Page 157: POV Ray Tutorial

The direction vector should always be perpendicular to the up and right vectors.

For more information on declaring cameras, see the camera section.

LocationThe location keyword tells POV-Ray where to position the camera. This parameter must always bespecified. It takes an <x, y, z> vector which tells the location of the camera. Note that if you havespecified an look_at point, moving the location will also rotate the camera (maybe), while if you insteadspecify a direction, changing the location will not modify the rotation of the camera.

For more information on declaring cameras, see the camera section.

Look AtThe look_at parameter controls the orientation of the camera. It is by far the easiest way to get thecamera to point at the thing you want it to point at. You can also specify a camera direction with thedirection vector, but this becomes tedious when you're not looking directly along an axis. Also, when youspecify a look_at point, you can move the camera around and modify the parameters to your heart'sdelight, and the POV-Ray will rotate the camera around so it still points at the same place. Note that iflook_at is specified with direction, the look_at specifier should appear after the location specifier. This isbecause the direction vector resets the direction that camera points. Anyway, here's our sample scenewith various look_at points.

One thing to keep in mind when using look_at is that the location and look_at points should never be set

The Online POV-Ray Tutorial: Camera

http://library.thinkquest.org/3285/language/camera.html (3 of 6) [9/12/2001 3:28:11 PM]

Page 158: POV Ray Tutorial

so that the camera is looking directly down (parallel to the y-axis). If you want an "overhead" view,either offset the camera some small amount in the x or z direction, or rotate the entire scene so it justappears like you're looking straight down (but are actually looking along, say, the z-axis).

For more information on declaring cameras, see the camera section.

RightThe right vector controls the width of the view. It is used in conjunction with the up vector to define theaspect ratio of the image. Aspect ratios are covered in more depth in the up section. The angular width ofthe viewing pyramid can be found with the following equation. The vertical bars mean the magnitude(length) of the named vector.

width = 2 * atan(|right| / |direction|)

This diagram may help make the relationship of the right and direction vectors more clear. This is adiagram of the viewing pyramid as it would look from above.

Increasing the magnitude of the right vector will make the viewing pyramid wider, and consequentlymake the image appear "squished" in the left-right direction. Conversely, decreasing the magnitude of theright vector will make the viewing pyramid thinner, and make the image appear "stretched" in theleft-right direction. Making the value of the right vector negative will reverse the image left to right. Aright vector with a magnitude of zero is bad.

The first image below was rendered with "right <4/3, 0, 0>", the second with "right <1, 0, 0>", and thethird also with "right <1, 0, 0>" but rendered at 120x120 instead of 160x120.

The Online POV-Ray Tutorial: Camera

http://library.thinkquest.org/3285/language/camera.html (4 of 6) [9/12/2001 3:28:11 PM]

Page 159: POV Ray Tutorial

For more information on declaring cameras, see the camera section.

SkyThe vector tells the camera which way is up. This is not to be confused with the up vector which definesthe aspect ratio. The default sky vector is <0, 1, 0>. By modifiying this value, you can roll the cameraaround its central axis. The sky vector, if specified, must appear before the look_at point is specified.This vector has no effect if look_at is not specified. The first image below is rendered with "sky <2, 1,0>", and the second with "sky <0, -1, 0>".

For more information on declaring cameras, see the camera section.

UpThe up vector is used to define the height of the viewing pyramid and, in conjunction with the rightvector, the aspect ratio of the image. The combination of the up and direction vectors defines the angularheight of the viewing pyramid. This can be found with the following equation. The vertical bars mean totake the magnitude (length) of the named vector.

height = 2 * atan(|up| / |direction|)

This diagram may clarify the relationship between the up and direction vectors. This is a diagram of theviewing pyramid as it would look from the side.

The Online POV-Ray Tutorial: Camera

http://library.thinkquest.org/3285/language/camera.html (5 of 6) [9/12/2001 3:28:11 PM]

Page 160: POV Ray Tutorial

The default value of the up vector is "up <0, 1, 0>". This, together with the value "right <4/3, 0, 0>" (alsodefault) defines the aspect ratio of the rendered image to be (4/3) / (1) = 4/3. This is the standard aspectratio for most computer screens. Resolutions like 800x600, 640x480, and 1024x768 all have 4/3 aspectratios. 320x200 also has a 4/3 aspect ratio, even though it would seem like it should be 8/5. This isbecause this resolution does not use square pixels. To prevent your image from looking distorted, it's agood idea to make the camera's aspect ratio the same as the image's aspect ratio.

Modifying the value of the up vector independently of the right and direction has the same stretch/squisheffect as with the right vector, only this stretch/squish is in the vertical direction.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Camera

http://library.thinkquest.org/3285/language/camera.html (6 of 6) [9/12/2001 3:28:11 PM]

Page 161: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera.pov

http://library.thinkquest.org/3285/language/src/camera.pov [9/12/2001 3:28:17 PM]

Page 162: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> direction <0, 0, 0.5> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera1.pov

http://library.thinkquest.org/3285/language/src/camera1.pov [9/12/2001 3:28:28 PM]

Page 163: POV Ray Tutorial

camera { location <0, 2, -10> direction <0, 0, 2> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

http://library.thinkquest.org/3285/language/src/camera2.pov

http://library.thinkquest.org/3285/language/src/camera2.pov [9/12/2001 3:28:29 PM]

Page 164: POV Ray Tutorial

camera { location <0, 2, -10> direction <0, 0, 4> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

http://library.thinkquest.org/3285/language/src/camera3.pov

http://library.thinkquest.org/3285/language/src/camera3.pov [9/12/2001 3:28:31 PM]

Page 165: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> look_at <0, -4, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera4.pov

http://library.thinkquest.org/3285/language/src/camera4.pov [9/12/2001 3:28:32 PM]

Page 166: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> look_at <-4, 0, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera5.pov

http://library.thinkquest.org/3285/language/src/camera5.pov [9/12/2001 3:28:39 PM]

Page 167: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> look_at <4, 4, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera6.pov

http://library.thinkquest.org/3285/language/src/camera6.pov [9/12/2001 3:28:41 PM]

Page 168: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> right <1, 0, 0> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera7.pov

http://library.thinkquest.org/3285/language/src/camera7.pov [9/12/2001 3:28:45 PM]

Page 169: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> sky <2, 1, 0> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera9.pov

http://library.thinkquest.org/3285/language/src/camera9.pov [9/12/2001 3:29:16 PM]

Page 170: POV Ray Tutorial

#declare Cam = camera { location <0, 2, -10> sky <0, -1, 0> look_at <0, 2, 0>}

disc { <0, 0, 0>, y, 5 pigment { checker color rgb <0.3, 0.3, 1> color rgb <0, 0, 0.7> }}

union { cylinder { <0, 0, 0>, <0, 4, 0>, 0.5 } cylinder { <-2, 0, -2>, <-2, 2, -2>, 0.5 } cylinder { <2, 0, -2>, <2, 2, -2>, 0.5 } cylinder { <-2, 0, 2>, <-2, 2, 2>, 0.5 } cylinder { <2, 0, 2>, <2, 2 2>, 0.5 } pigment { color rgb <0, 0, 1> }}

light_source { <20, 50, -50> color rgb <1, 1, 1> }

camera { Cam }

http://library.thinkquest.org/3285/language/src/camera10.pov

http://library.thinkquest.org/3285/language/src/camera10.pov [9/12/2001 3:29:24 PM]

Page 171: POV Ray Tutorial

The Online POV-Ray Tutorial

Normal ReferenceThe following topics are covered in this section.

Bump Map●

Bumps●

Dents●

Normal●

Ripples●

Waves●

Wrinkles●

The following scene is used for examples of the different normal modifiers. Right now it contains aFeatureless Red Sphere. Some phong was added to make the effects of the normal modifiers moreapparent.

The "bumps 0" statement was added just to keep POV from complaining. It doesn't actually have anyeffect in this scene.

Bump MapBump maps are sort of a cross between an image map and a height field. They allow you to map a set ofnormals around an object. The intensity of the pixel value at each point in the input file for the bump mapdetermines the "height" of the corresponding point. This can be changed with the "use_index" keyword(see below). Here's the general syntax for a bump map.

normal { bump_map { type "filename" [bump_size size]

The Online POV-Ray Tutorial: Normal Reference

http://library.thinkquest.org/3285/language/normal.html (1 of 6) [9/12/2001 3:30:25 PM]

Page 172: POV Ray Tutorial

[interpolate mode] [use_color] [use_index] [once] [map_type map mode] }}

Any specifiers in square brackets ([]) are optional.

type specifies the type of the file that is the source for the bump map. It should be gif, iff, tga, or dump.This is followed by the full name of the file (filename), in double quotes. This image will mapped ontothe object. The image will be mapped onto the x-y plane and rescaled to fit into the range (0, 0), (1, 1).To chnage this default mapping mode, you can make use of the map_type keyword. Larger images donot produce larger bump maps, but rather bumps maps with better resolution. By default, the bump mapis repeated infinitely in the x and y directions; this can be altered with the once keyword.

The bump_size parameter is used to control the apparent depth of the bumps generated by the bump map.This can be any number you want, as long as you don't want 0. 0 is bad. Large numbers give you bigdepths, small numbers give you little wrinkles. Negative numbers make the highs into lows and the lowsinto highs.

Normally (ha!), the relative height of each point on the mapped surface is determined by the intensity(gray scale value) of the corresponding pixel. This creates a surface which looks like it has the imageembossed into it. If you would rather have the bump map height based on the palette index of thecorresponding color (as with height fields) you can include the optional keyword "use_index". The"use_color" keyword may be included to specifically state that a bump map uses the default behavior. Itwill not usually have any effect.

Interpolation is good for smoothing out jagged or low resolution bump maps. By default, POV-Ray takeseach surface intersection and assigns it a pixel value in the bump map. With low resolution bump maps,the surface will look blocky. Interpolation smooths the bump map by averaging surrounding pixel values.The parameter for interpolation tells POV-Ray what kind of interpolation to use. This can be either 2(Bilinear) or 4 (Normalized Distance). As is usual with such things, you can either get speed or quality.Bilinear interpolation is better, but Normalized Distance is faster. By default, no interpolation is used.

BumpsThe bumps normal creates a random bumpy pattern on the object. In fact, it uses a similar pattern to thebozo pigment. The result is really pretty cool. The bumps normal takes a float parameter from 0.0 (Flat)to 1.0 (Mountainous) that describes the depth of the bumps. The following image was rendered with"bumps 1.0".

The Online POV-Ray Tutorial: Normal Reference

http://library.thinkquest.org/3285/language/normal.html (2 of 6) [9/12/2001 3:30:25 PM]

Page 173: POV Ray Tutorial

By default the bumps are pretty large (about 0.5 to 1.0 units across), so the normal was scaled down tomake it fit. Note that this only changes the spacing of the bumps, it does not modify their apparent depth.

For more information on declaring normals, see the normal section.

DentsThe dents normal basically makes the object look like someone attacked it with a sledgehammer. Thesurface appears to have dents (naturally enough) beaten into it. Dents takes a float parameter from 0.0(Brand New) to 1.0 (Survived a Hail Storm) which specifies the depth of the dents. Here's what happensif we take the Featureless Red Sphere and beat it up a bit with "dents 1.0".

The normal was scaled to get it to fit nicely onto the sphere. Note that scaling only changes the spacingof the dents, it does not modify their depths.

For more information on declaring normals, see the normal section.

NormalThe normal component of a texture allows you to create effects on the surface of an object. Since muchof the way we perceive objects is based on how they reflect light, it is possible to trick the eye intothinking a surface is bumpy by just modify the surface normal vectors. This is what the "normal"modifier does. Say you wanted to create a lake with ripples moding across the surface. Trying to modelsuch a thing mathematically (whether with height fields or csg) would be excrutiatingly painful. SoPOV-Ray gives you the ability to modify the way light reflects off of the surface. Although not 100%

The Online POV-Ray Tutorial: Normal Reference

http://library.thinkquest.org/3285/language/normal.html (3 of 6) [9/12/2001 3:30:25 PM]

Page 174: POV Ray Tutorial

realistic, it's "close enough" for most purposes. You should note, though, that specifying a normalmodifier for an object does not actually change the location of the surface, it just makes it look different.But anyway, here's how to specify a normal modifier for an object (really it's quite simple).

normal { type depth /* OR */ bump_map { /* bump map specifiers */ } /* modifiers go here */ /* any rotations, scales, and translations go here */}

Normals have three parts, the type, the modifiers, and then transformations. A normal can only have onetype, and that is one of bumps, dents, ripples, waves, or wrinkles. They each take a depth parameterbetween 0.0 (Flat) and 1.0 (Violent). Each type is covered with an examples in its own section.

One modifier that is supported for normals is turbulence. Turbulence is covered in depth in the pigmentsection and will not be covered again here. Turbulence can really create some wacky normals. As anexample, here's a standard ripples normal and another with "turbulence 0.7". Note the ripples have beentranslated to put their center on the top of the sphere.

Only certain normal modifiers respond to the keywords "frequency" and "phase". These are the ripplesand waves. The frequency keyword controls the density of the ripples or waves, while phase controlstheir location. Incrementing phase from 0.0 to 1.0 will bring the normal back to where it started from.

Transformations that are applied to normals only modify the locations of the normal components, they donot change the depths of the normals. You can create some pretty wacky effects (in animations) bytranslating bumps or dents perpendicular to the surface of the object.

Normals are fun to play with, and easy to specify. They should be added last, in the "fine tuning" sectionof scene production. They can turn an object that looks great into an object that looks absolutelyspectacular.

The Online POV-Ray Tutorial: Normal Reference

http://library.thinkquest.org/3285/language/normal.html (4 of 6) [9/12/2001 3:30:25 PM]

Page 175: POV Ray Tutorial

RipplesThe ripples normal creates evenly space, smooth ripples which originate from 10 random locations insidethe box with corners <0, 0, 0>, <1, 1, 1>. All the waves have the same frequency, so the ripple effect issmooth at a significant distance from the center. Ripples takes the standard 0.0 to 1.0 parameter.Compare the look of ripples to that of waves. Here's how ripples look, scaled a bit and translated so theywill appear on the surface of the previously Featureless Red Sphere.

The appearance of these ripples can be modified to some extent with the frequency and phase modifiers.

For more information on declaring normals, see the normal section.

WavesWaves are similar to ripples, except instead of creating smooth, even ripples, it creates more rough andtumble waves. Theoretically these look more like deep ocean waves. The waves normal takes thestandard 0.0 (Becalmed) to 1.0 (Tsunami) parameter. Here's what "waves 1.0" looks like (scaled to someextent to get it to look good).

The appearance of the waves can be modified to some extent with the frequency and phase modifiers.

For more information on declaring normals, see the normal section.

The Online POV-Ray Tutorial: Normal Reference

http://library.thinkquest.org/3285/language/normal.html (5 of 6) [9/12/2001 3:30:25 PM]

Page 176: POV Ray Tutorial

WrinklesWrinkles is one of the neatest surface normals, but it is also one of the slowest to compute. This normalspecifier basically makes the object look like it had been wadded up and then stretched back out again. Itbasically works repeatedly denting the surface with smaller and smaller dents. Here's how a wrinkled byotherwise Featureless Red Sphere might look.

For more information on declaring normals, see the normal section.

Reference Index Top of Document Beginning of the Tutorial

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Normal Reference

http://library.thinkquest.org/3285/language/normal.html (6 of 6) [9/12/2001 3:30:25 PM]

Page 177: POV Ray Tutorial

#declare Norm = normal { bumps 0 /* no normal in this one */}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm.pov

http://library.thinkquest.org/3285/language/src/norm.pov [9/12/2001 3:30:26 PM]

Page 178: POV Ray Tutorial

#declare Norm = normal { bumps 1.0 scale 1/4}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm1.pov

http://library.thinkquest.org/3285/language/src/norm1.pov [9/12/2001 3:30:36 PM]

Page 179: POV Ray Tutorial

#declare Norm = normal { dents 1.0 scale 1/4}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm2.pov

http://library.thinkquest.org/3285/language/src/norm2.pov [9/12/2001 3:30:37 PM]

Page 180: POV Ray Tutorial

#declare Norm = normal { ripples 1.0 scale 1/4 translate <0, 1, 0>}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm4.pov

http://library.thinkquest.org/3285/language/src/norm4.pov [9/12/2001 3:30:41 PM]

Page 181: POV Ray Tutorial

#declare Norm = normal { ripples 1.0 turbulence 0.7 scale 1/4 translate <0, 1, 0>}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm3.pov

http://library.thinkquest.org/3285/language/src/norm3.pov [9/12/2001 3:30:46 PM]

Page 182: POV Ray Tutorial

#declare Norm = normal { waves 1.0 scale 1/4 translate <0, 1, 0>}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm5.pov

http://library.thinkquest.org/3285/language/src/norm5.pov [9/12/2001 3:30:47 PM]

Page 183: POV Ray Tutorial

#declare Norm = normal { wrinkles 1.0 scale 1/4}

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> } finish { phong 0.8 } normal { Norm }}

plane { y, -2 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> } rotate y*30}

light_source { <200, 200, -200> color rgb <1, 1, 1> }

camera { location <0, 4, -1> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/norm6.pov

http://library.thinkquest.org/3285/language/src/norm6.pov [9/12/2001 3:30:49 PM]

Page 184: POV Ray Tutorial

The Online POV-Ray Tutorial

AboutThe Online POV-Ray Tutorial ThinkQuest Team, creators of the Online POV-Ray Tutorial, is:

Owen Aftreth, from Some High School, Anchorage, Alaska. (E-mail) (Home Page) (Picture)●

Grant Emery, from Thomas Jefferson High School for Science and Technology, Alexandria, Va.(E-mail) (Home Page) (Picture)

William Morgan, from Thomas Jefferson High School for Science and Technology, Alexandria,VA (E-mail) (Home Page) (Picture)

Or, you can contact the team as a whole.

Please read about the Tutorial's design.

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: About

http://library.thinkquest.org/3285/about.html [9/12/2001 3:30:51 PM]

Page 185: POV Ray Tutorial

http://library.thinkquest.org/3285/images/owen.gif

http://library.thinkquest.org/3285/images/owen.gif [9/12/2001 3:30:55 PM]

Page 186: POV Ray Tutorial

http://library.thinkquest.org/3285/images/grant.gif

http://library.thinkquest.org/3285/images/grant.gif [9/12/2001 3:31:36 PM]

Page 187: POV Ray Tutorial

http://library.thinkquest.org/3285/images/william.jpg

http://library.thinkquest.org/3285/images/william.jpg [9/12/2001 3:31:45 PM]

Page 188: POV Ray Tutorial

disc { <0, 0, 0>, y,7 pigment { checker color rgb <1, 1, 0> color rgb <1, 0.3, 0> quick_color rgb <1, 1, 0> }}

sphere { <-1.5, 1.5, 0>, 1 pigment { color rgbf <0.8, 0.8, 0.8, 0.8> quick_color rgb <0, 1, 0> } finish { refraction 1 ior 1.5 phong 0.8 }}

box { <-1, -1, -1>, <1, 1, 1> pigment { marble color_map { [0.0 color rgb <0, 0, 0>] [1.0 color rgb <1, 1, 1>] } turbulence 1 quick_color rgb <0, 1, 1> } finish { reflection 0.25 } rotate <0, 45, 0> rotate <-35.264, 0, 0> translate <1.5, 1.5, 0>}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0, 2, -5> look_at <0, 2, 0>}

http://library.thinkquest.org/3285/language/src/cmdln1.pov

http://library.thinkquest.org/3285/language/src/cmdln1.pov [9/12/2001 3:31:47 PM]

Page 189: POV Ray Tutorial

The Online POV-Ray Tutorial

Texture LibraryThis is a list of POV-Ray textures that you can include in any scenes you create yourself. Some areprovided with the POV-Ray package, and some have been contributed by other users of the Tutorial. Ifyou have a texture of your own that you would like to contribute to the library, please do so!

Author & User-Contributed textures:

model:●

T_DRFantasy: green-pink-violet veins, uses pigment_map->POV3.0 is highly recommended●

Agate: Sort of a "Moss Agate" clear with green veining●

Dying Star: A fiery maelstrom of reds and oranges.●

Top of Document Main Page

The Online POV-Ray Tutorial: Texture Library

http://library.thinkquest.org/3285/gather/texture_lib.html [9/12/2001 3:31:50 PM]

Page 190: POV Ray Tutorial

The Online POV-Ray Tutorial

Texture Library - User ContributionThe texture title is required may be anything you wish; it would help if it were in some waymeaningful for the texture you are contributing. The short description, while not required,would be helpful and, if entered, should be a terse description of the texture itself, perhapsdescribing a style or material that the texture resembles. (Doesn't resemble?) If your textureneeds further explanation, please describe it in whatever detail you feel is necessary withinthe source itself, preferably as a POV-Ray comment. Thanks!

Note: we check submissions frequently for "appropriateness". Please only upload POV-Raysource to this library. Anything deemed inappropriate will be removed from the library.

User-Contribution Form for POV-Ray Textures

Texture Title: Short Description:

Texture Source:

It's probably most efficient to just cut-and-paste the source into this window, but feel free to just type itin if you want.

Main Page

The Online POV-Ray Tutorial: Texture Library - User Contribution

http://library.thinkquest.org/3285/Contribute_Texture.html [9/12/2001 3:31:51 PM]

Page 191: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Texture: model

Texture Library Main Page

The Online POV-Ray Tutorial: Texture -

http://library.thinkquest.org/3285/gather/textures/model.html [9/12/2001 3:31:55 PM]

Page 192: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Texture: T_DRFantasygreen-pink-violet veins, uses pigment_map->POV3.0 is highly recommended

/* T_DRFantasy: Uses pigment_map{}: POV-Ray version 3.0 is recommended I don´t know any material that looks like this. If you like the texture or if you have any suggestions for the name of it, please e-mail me: [email protected] ... always interested in other textures!!!*/ #declare T_DRFantasy =texture { pigment { bozo pigment_map { [ 0.0 marble color_map { [0.0 color rgb <0.0, 0.0, 0.0>] [1.0 color rgb <0.2, 0.0, 0.5>] } frequency 2.0 turbulence 1.0 ] [ 0.3 marble color_map { [0.0 color rgb <0.0, 0.0, 0.0>] [1.0 color rgb <0.0, 0.3, 0.2>] } frequency 2.0 turbulence 1.0 ] [ 1.0 marble color_map { [0.0 color rgb <0.0, 0.0, 0.0>] [1.0 color rgb <0.6, 0.1, 0.15>] } frequency 2.0 turbulence 1.0

The Online POV-Ray Tutorial: Texture -

http://library.thinkquest.org/3285/gather/textures/TDRFantasy.html (1 of 2) [9/12/2001 3:32:06 PM]

Page 193: POV Ray Tutorial

] } turbulence 0.5 rotate <20, 59, 100> scale 0.1 } finish { ambient 0.05 diffuse 0.6 reflection 0.05 specular 0.4 roughness 0.4 metallic }}

Texture Library Main Page

The Online POV-Ray Tutorial: Texture -

http://library.thinkquest.org/3285/gather/textures/TDRFantasy.html (2 of 2) [9/12/2001 3:32:06 PM]

Page 194: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Texture: AgateSort of a "Moss Agate" clear with green veining

#declare Agate_Map =color_map { [0.0, 0.8 color rgbft <0.1, 0.6, 0.1,0,1> color rgbft <0.0, 0.3, 0.0,.2,.25>] [0.8, 1.0 color rgbft <0.1, 0.6, 0.1,.4,.75> color rgbft <0.0, 0.2, 0.0,.6,0>]}

#declare Agate =pigment { marble turbulence 1.8 color_map { Agate_Map }}

Texture Library Main Page

The Online POV-Ray Tutorial: Texture -

http://library.thinkquest.org/3285/gather/textures/Agate.html [9/12/2001 3:32:16 PM]

Page 195: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Texture: Dying StarA fiery maelstrom of reds and oranges

#declare DyingStar = texture { pigment { bozo color_map { [0.0 color rgb <0.3, 0, 0>] [1.0 color rgb <0.6, 0.2, 0>] } turbulence 0.3 scale 1/2 } } texture { pigment { agate color_map { [0.0 color rgbf <1, 1, 1, 1>] [0.5 color rgbf <1, 1, 1, 1>] [0.5 color rgbf <0.5, 0, 0, 1>] [0.75 color rgb <0.5, 0, 0>] [1.0 color rgb <1, 0.5, 0>] } turbulence 1.0 scale 1.5 } } texture { pigment { granite color_map { [0.0 color rgb <1, 1, 0>] [0.2 color rgbf <1, 1, 1, 1>] [1.0 color rgbf <1, 1, 1, 1>] } } }

The Online POV-Ray Tutorial: Texture -

http://library.thinkquest.org/3285/gather/textures/DyingStar.html (1 of 2) [9/12/2001 3:32:19 PM]

Page 196: POV Ray Tutorial

Texture Library Main Page

The Online POV-Ray Tutorial: Texture -

http://library.thinkquest.org/3285/gather/textures/DyingStar.html (2 of 2) [9/12/2001 3:32:19 PM]

Page 197: POV Ray Tutorial

The Online POV-Ray Tutorial

Object LibraryThis is a list of POV-Ray objects that you can include in any scenes you create yourself. Some of themare provided in POV-Ray sample scenes, some are objects we have provided, and some are objectscontributed by other users of the Tutorial. (Which is from where all the really good stuff is going tocome!) If you have an object of your own that you would like to contribute to the library, please do so!

Author & User-Contributed objects:

triangular pyramid:●

Chain: This is an include file that creates a "Chain" object at the origin, stretching along the +zaxis. You specify the texture, link length, link thickness, and number of links you want in yourchain, and it does the rest!

mesilla:●

Eye: Source for the eyeball seen in the title image●

Top of Document Main Page

The Online POV-Ray Tutorial: Object Library

http://library.thinkquest.org/3285/gather/object_lib.html [9/12/2001 3:32:29 PM]

Page 198: POV Ray Tutorial

The Online POV-Ray Tutorial

Object Library - User ContributionThe object title is required may be anything you wish; it would help if it were in some waymeaningful for the object you are contributing. The short description, while not required,would be helpful and, if entered, should be a terse description of the object itself; if yourobject needs further explanation, please describe it in whatever detail you feel is necessarywithin the object source itself, preferably as a POV-Ray comment. Within your code, youneed not define a camera or light sources for your object. If your object is either a union,intersection, or difference, however, you will need to enter the entire declaration, beginningwith "#declare objectname = ..." Thanks!

Note: we check submissions frequently for their "appropriateness". Please only uploadPOV-Ray source to the library. Anything deemed inappropriate will be removed from thelibrary.

User-Contribution Form for POV-Ray Objects

Object Title: Short Description:

Object Source:

It's probably most efficient to cut-and-paste the source into this window, but you can just type here ifyou want.

Main Page

The Online POV-Ray Tutorial: Object Library - User Contribution

http://library.thinkquest.org/3285/Contribute_Object.html [9/12/2001 3:32:30 PM]

Page 199: POV Ray Tutorial

ThinkQuest Library of Entries

NewsSee the ThinkQuest Junior 2001 Winners!

ThinkQuest Participant

Raza

Wed, 12-Sep-2001, 05:57:48 AM EST

Competitions

My ThinkQuest

Communities

Calendar

Library of Entries

Featured Entries

Browse or Search

Advanced Search

Winners

IC 2000 Winners

ScienceQuest Sites

Policies

Initiatives

Help/Contact

Resources

Press Room

About ThinkQuest

About This WebSite

Home

The ThinkQuest Library of Entries

The ThinkQuest Library of Entries is the collection ofeducational web sites designed by participants in theThinkQuest Contests. Teachers and learners canexplore a multitude of topics. These sites have beenorganized to help you find what you need with aneasy to use Index of Categories or search by keywordbelow.

Featured Sites!This month's featuredentries are: SummerFun Sites!Check them out!

Search The Library

Exact Match Any Match

ThinkQuest ThinkQuest Junior Tomorrow's Teachers

Privacy Policy | Disclaimer | Terms of Use

© 1995-2001, ThinkQuest Inc.

all rights reserved

ThinkQuest Library of Entries

http://www.thinkquest.org/library/ [9/12/2001 3:32:47 PM]

Page 200: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Object: triangular pyramid

Object Library Main Page

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/triangularpyramid.html [9/12/2001 3:32:50 PM]

Page 201: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Object: ChainThis is an include file that creates a "Chain" object at the origin, stretching along the +z axis. You specify the texture, linklength, link thickness, and number of links you want in your chain, and it does the rest!

// Chain Object Include File// David J.V. Brown// Questions/comments: [email protected]// April 25, 1997

/*INSTRUCTIONS: In your .pov scene file, declare the following: ChainTex = [texture]; texture for the links of the chain. MajR = [FLOAT]; major radius of torus, corresponds to length ofindividual link. MinR = [FLOAT]; minor radius of torus, corresponds to thickness of alink. NLinks = [INT]; number of links you want the chain to contain.

After those are declared, add this line: #include "chain.inc"

An object called Chain will be declared starting at the origin with thefirst link in the xz plane and extending NLinks along +z. You can then addinstances of the object and translate/rotate it however you like.*/

// Main Declaration Section

#declare Origin = &lt;0,0,0&gt;

// Objects

#declare WholeR = MajR + (2 * MinR) + 0.05/* HalfBoxP1 = bottom near left point of box used to cut torus in half HalfBoxP2 = top far right point of box used to cut torius in half -- 0.05 is added length to ensure that cutting box extends past torus --*/#declare HalfBoxP1 = Origin - (x*WholeR) - (y*MinR + 0.05)#declare HalfBoxP2 = Origin + (x*WholeR) + (y*MinR + 0.05) + (z*WholeR)

#declare Ring = torus { MajR, MinR texture {ChainTex} }

// Object used to cut torus in half before adding extenders to create a link.

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/Chain.html (1 of 3) [9/12/2001 3:32:58 PM]

Page 202: POV Ray Tutorial

#declare HalfBox = box { HalfBoxP1, HalfBoxP2 texture {ChainTex} }

/* Extender: the cylinder used to make the chain links oblong. Created at origin and extends along the +z axis, to be translated later. ExtTrans: the +/- x translation factor to line the extender up with the HalfRing.*/

#declare ExtTrans = x * MajR#declare Extender = cylinder {Origin, MajR*z, MinR texture {ChainTex} }

/* HalfRing: the original torus cut in half. HalfTrans: the +z translation to put the flipped HalfRing on to close the Link. Flip: flips the 1st HalfRing over about the x axis to line it up right. Note: Flip first, THEN translate, or it'll all get screwed up!*/#declare Flip = x*180#declare HalfTrans = z*MajR-0.01#declare HalfRing = difference { object { Ring } object { HalfBox } }

// Definition of one completed chain link:#declare Link = merge { object {HalfRing} object {Extender translate ExtTrans+(-0.01*z)} object {Extender translate -ExtTrans+(-0.01*z)} object {HalfRing rotate Flip translate HalfTrans} }

/* Now create a procedure to generate a chain of NLinks length. The chain will extend in the +z direction.*/

#declare Chain = Link // Initialize the Chain

#declare NLinks = NLinks - 1 // Correct for initializaton link

#declare Count = 1#while (Count &lt;= NLinks) #declare LinkTrans = z * ((3*MajR) - (MinR*2)) * Count

#declare LinkRot = z * Count * 90

#declare Chain = union {

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/Chain.html (2 of 3) [9/12/2001 3:32:58 PM]

Page 203: POV Ray Tutorial

object{Chain} object {Link rotate LinkRot translate LinkTrans } }

#declare Count = Count + 1#end

Object Library Main Page

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/Chain.html (3 of 3) [9/12/2001 3:32:58 PM]

Page 204: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Object: mesilla

/* X: -23, 23 Y: 0, 45.4 Z: -18, 16 (los tiradores sobresalen un poco mas)*/

#declare Tabla = difference { superellipsoid {&lt;.05, .05&gt;} plane {y, 0.8} translate -0.8*y scale &lt;23, 6, 16&gt;}

#declare Tirador = union { sphere {&lt;0, 2.25, 0&gt;, 1.25} cone {&lt;0, 0, 0&gt;, 1.25, &lt;0, 2.25, 0&gt;, 0} rotate -90*x scale .8}

#declare Cajon = difference { superellipsoid {&lt;.05, .05&gt;} plane {y, 0.8} translate -0.8*y scale &lt;20, 6, 6&gt; rotate -90*x}

#declare Cajon = union { object {Cajon} object {Tirador translate &lt;-12, 0, -1.2&gt;} object {Tirador translate &lt;12, 0, -1.2&gt;}}

#declare Pata = cone {&lt;0, 0, 0&gt;, 1.25, &lt;0, -13, 0&gt;, .35}

#declare Mesilla = union {

box {&lt;-22, -15, -15&gt;, &lt;22, 15, -13.8&gt; texture {T_Wood10 scale 10 rotate 89*y} }

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/mesilla.html (1 of 2) [9/12/2001 3:33:01 PM]

Page 205: POV Ray Tutorial

box {&lt;-22, -15, 13.8&gt;, &lt;22, 15, 15&gt; texture {T_Wood10 scale 10 rotate 89*y} } box {&lt;-22, -15, -13.8&gt;, &lt;22, 15, 13.8&gt; texture {T_Wood10 scale 10 translate &lt;0, 20, 0&gt;} }

object {Tabla translate &lt;0, 15, 0&gt; texture {T_Wood10 scale 10 rotate 89*y} } object {Tabla rotate 180*z translate &lt;0, -15, 0&gt; texture {T_Wood10 scale 10 rotate 89*y} }

object {Cajon translate &lt;0, 7, -15&gt; texture {T_Wood10 scale 10 rotate 89*y translate &lt;0, 14, 0&gt;} } object {Cajon translate &lt;0, -7, -15&gt; texture {T_Wood10 scale 10 rotate 89*y translate &lt;0, -20, 0&gt;} }

object {Tirador translate &lt;-12, 7, -16.2&gt; texture {T_Wood10} } object {Tirador translate &lt;-12, 7, -16.2&gt; texture {T_Wood10} }

object {Pata translate &lt;-18, -16.2, -11&gt; texture {T_Wood10 scale 6 rotate 89*y} } object {Pata translate &lt;-18, -16.2, 11&gt; texture {T_Wood10 scale 6 rotate 89*y} } object {Pata translate &lt;18, -16.2, -11&gt; texture {T_Wood10 scale 6 rotate 89*y} } object {Pata translate &lt;18, -16.2, 11&gt; texture {T_Wood10 scale 6 rotate 89*y} }

translate &lt;0, 29.2, 0&gt;}

Object Library Main Page

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/mesilla.html (2 of 2) [9/12/2001 3:33:01 PM]

Page 206: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Object: EyeSource for the eyeball seen in the title image

#declare Eyeball = sphere { <0, 0, 0>, 1 texture { pigment { granite color_map { [0.0 color LightBlue] [0.5 color SteelBlue] [1.0 color LightBlue] } scale 1/3 turbulence 0.2 rotate <90, 0, 0> } } texture { pigment { wood color_map { [0.0 color Black] [0.225 color Black] [0.225 color Clear] [0.45 color Clear] [0.45 color White] [1.0 color White] } scale 2 } }}

Object Library Main Page

The Online POV-Ray Tutorial: Object -

http://library.thinkquest.org/3285/gather/objects/Eye.html [9/12/2001 3:33:03 PM]

Page 207: POV Ray Tutorial

The Online POV-Ray Tutorial

Color ToolTo find the color you need, enter the values in the text field (from 0.0 to 1.0) or slide the scrollbars. Thevalues in the text fields correspond to the components in a POV-Ray color vector.

For example, if you have found a color you like with a red component of 0.5, a green component of 0.75,and a blue component of 0.0, the resulting POV-Ray color vector would be <0.5, 0.75, 0>.

Note that the more colors your terminal can display, the more accurate the Color Tool will be. If yourterminal cannot display many colors, you may not get an accurate reading. If the square on the left staysblack, you need a better display.

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Color Tool

http://library.thinkquest.org/3285/color_tool.html [9/12/2001 3:33:11 PM]

Page 208: POV Ray Tutorial

The Online POV-Ray Tutorial

Example ScenesHere we have some example scenes and their source, so you can see how different things were done. Allscenes here were rendered by the authors. Beware, some of the images are rather large.

The title image for the Tutorial. Rendered by Grant Emery. (Source)

A landscape inspired by The Martian Chronicles (Ray Bradbury). Rendered by William Morgan.(Source)

"The Last Outpost" by Grant Emery. (Source)

The Online POV-Ray Tutorial: Example Scenes

http://library.thinkquest.org/3285/scenes_lib.html (1 of 2) [9/12/2001 3:33:43 PM]

Page 209: POV Ray Tutorial

"On Display" by Grant Emery. (Source)

"Columns" by Grant Emery. (Source)

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Example Scenes

http://library.thinkquest.org/3285/scenes_lib.html (2 of 2) [9/12/2001 3:33:43 PM]

Page 210: POV Ray Tutorial

http://library.thinkquest.org/3285/scenes/title.jpg

http://library.thinkquest.org/3285/scenes/title.jpg [9/12/2001 3:34:46 PM]

Page 211: POV Ray Tutorial

#include "colors.inc"#include "textures.inc"#include "stones.inc"

/* the letters */

height_field { gif "c:\temp\titleimg.gif" water_level 0.01 texture { Stone13 finish { phong 0.2 } scale 1/4 } translate <-0.5, 0, -0.5> scale <358/191, 1/6, 1> rotate <-90, 0, 0> scale 1.2 rotate <7.5, 0, 2.5>}

/* the floor */

disc { <0, -1.5, 0>, y, 4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> scale 1/2 }}

#declare Eyeball = sphere { <0, 0, 0>, 1 texture { pigment { granite color_map { [0/2 color LightBlue] [1/2 color SteelBlue] [2/2 color LightBlue] } scale 1/3 turbulence 0.2 rotate <90, 0, 0> } } texture { pigment { wood color_map { [0.0 color Black] [0.225 color Black] [0.225 color Clear] [0.45 color Clear] [0.45 color White] [1.0 color White] } scale 2 } }}

http://library.thinkquest.org/3285/scenes/title.pov

http://library.thinkquest.org/3285/scenes/title.pov (1 of 3) [9/12/2001 3:34:47 PM]

Page 212: POV Ray Tutorial

object { Eyeball scale 1/3 rotate <45, -45, 0> translate <-0.7, -0.7, 0>}

/* the reflective box in the upper right */

box { <-0.25, -0.25, -0.25>, <0.25, 0.25, 0.25> texture { Silver2 } rotate <0, 45, 0> rotate <-55, 0, 0> translate <0.9, 0.7, 0>}

/* sky sphere with sunrise texture */

sphere { <0, 0, 0>, 10000 texture { pigment { radial color_map { [0.0 color rgb <1, 1, 1>] [0.5 color rgb <0.3, 0.6, 1>] [1.0 color rgb <1, 1, 1>] } frequency 12 rotate <90, 0, 0> } finish { diffuse 0 ambient 0.9 } } texture { pigment { wood color_map { [0.0 color rgb <1, 1, 1>] [0.1 color rgb <1, 1, 1>] [0.25 color rgbf <1, 1, 1, 1>] [1.0 color rgbf <1, 1, 1, 1>] } scale 20000 } finish { diffuse 0 ambient 0.9 } }}

light_source { <50, 150, -500> color rgb <1.5, 1.5, 1.5> }

camera { location <0, 0, -2> look_at <0, 0.01, -0.5>

http://library.thinkquest.org/3285/scenes/title.pov

http://library.thinkquest.org/3285/scenes/title.pov (2 of 3) [9/12/2001 3:34:47 PM]

Page 213: POV Ray Tutorial

}

http://library.thinkquest.org/3285/scenes/title.pov

http://library.thinkquest.org/3285/scenes/title.pov (3 of 3) [9/12/2001 3:34:47 PM]

Page 214: POV Ray Tutorial

http://library.thinkquest.org/3285/scenes/mars3.jpg

http://library.thinkquest.org/3285/scenes/mars3.jpg [9/12/2001 3:35:21 PM]

Page 215: POV Ray Tutorial

#include "ruins.inc"

#declare landsize = 200#declare landheight = 100

#declare lightpos = <-250, 100, 50>#declare moonpos = <-450, 200, 800>#declare ruinspos = <0, -42,-75>#declare camerapos = <10, -12, -130>

#declare Brown = color rgb <.247, .165, .165>#declare MarsRed = color rgb <.31, .185 .185>#declare White = color rgb <1, 1, 1>#declare Black = color rgb <0, 0, 0>#declare Gray = color rgb <.5, .5, .5>

#declare MountainT =texture { pigment { bozo turbulence .25 color_map { [0, 1 color Brown color MarsRed ] } } normal { bumps 1 } finish { crand .05 }}

#declare PlainsT =texture { MountainT normal { bumps 1 } normal { dents 1 } scale 1/5}

#declare SkyT =texture { pigment { granite turbulence 1 color_map { [0, .01 color White color White] [.01, .5 color Black color Black] [.5, .501 color Gray color Gray] [.501, 1.01 color Black color Black] } } finish { ambient 1 }}

#declare MoonT = texture { pigment { color rgb <.3, .32, .3> } normal { dents .5 } normal { bumps .5 }}

camera {

http://library.thinkquest.org/3285/scenes/mars.pov

http://library.thinkquest.org/3285/scenes/mars.pov (1 of 3) [9/12/2001 3:35:22 PM]

Page 216: POV Ray Tutorial

location camerapos look_at camerapos * <0, 1, 0>}

/*fog { color rgb <.05, .05, .05> distance 1000}*/

light_source { lightpos color White }light_source { lightpos + <1, 0, 0> color White }light_source { lightpos - <1, 0, 0> color White }light_source { lightpos + <0, 1, 0> color White spotlight point_at moonpos - <20, 0, 0> radius 5 falloff 10 tightness 10}/*light_source { lightpos - <0, 1, 0> color White spotlight point_at moonpos - <20, 0, 0> radius 5 falloff 10 tightness 10}*/

// mountain rangeheight_field { pot "marsmnt.pot" smooth water_level .08 scale <landsize, landheight, landsize> translate <-landsize/2, -landheight/2, -landsize/2> texture { MountainT scale 10 }}

// skysphere { <0, 0, 0>, 1000 texture { SkyT scale 250 } no_shadow}

// plainsdisc { <0, 0, 0>, <0, 1, 0>, 180 texture { PlainsT scale 10 } translate <0, -42, 0>}

// moonsphere { moonpos, 100 texture { MoonT scale 10 } no_shadow}

http://library.thinkquest.org/3285/scenes/mars.pov

http://library.thinkquest.org/3285/scenes/mars.pov (2 of 3) [9/12/2001 3:35:22 PM]

Page 217: POV Ray Tutorial

// ruinsobject { Ruins scale .25 translate ruinspos}

//light_source { camerapos + <0, 1, 0> color White }//light_source { camerapos - <0, 1, 0> color White }

http://library.thinkquest.org/3285/scenes/mars.pov

http://library.thinkquest.org/3285/scenes/mars.pov (3 of 3) [9/12/2001 3:35:22 PM]

Page 218: POV Ray Tutorial

http://library.thinkquest.org/3285/scenes/outpost.jpg

http://library.thinkquest.org/3285/scenes/outpost.jpg [9/12/2001 3:38:46 PM]

Page 219: POV Ray Tutorial

#declare mnt_size = 75#declare sea_level = mnt_size / 4#declare island_cen = <39, 0, 36>#declare island_size = 25#declare island_top = island_cen + (sea_level + island_size/2 + 2) * y#declare dish_cen = island_top + 10 * y

#declare mnt_txtr_1 = texture { pigment { gradient y color_map { [0.0 color rgbf <1, 1, 1, 1>] [0.3 color rgbf <1, 1, 1, 1>] [0.35 color rgbf <1, 1, 1, 0>] } turbulence 0.1 scale <0.25, 2, 0.25> }}

#declare mnt_txtr_2 = texture { pigment { bozo color_map { [0.0 color rgb <0.0, 0.6, 0.4>] [1.0 color rgb <0.0, 0.8, 0.6>] } scale 0.01 }}

#declare sky_col = color rgb <159/255, 127/255, 55/255>

#declare sky_tex = texture { pigment { bozo color_map { [0.0 color sky_col] [0.75 color rgb <0, 0, 0>] [1.0 color rgb <0, 0, 0>] } } finish { ambient 0.8 }}

height_field { gif "fract002.gif"// water_level 0.25 texture { mnt_txtr_2 } texture { mnt_txtr_1 } rotate <0, -90, 0> translate <1, 0, 0> scale <100, mnt_size, 100>}

plane { // water y, sea_level pigment { color rgb <0.5, 0.5, 0.5> /*rgb <0.196078, 0.6, 0.8>*/ } normal { ripples 0.5 translate island_cen

http://library.thinkquest.org/3285/scenes/outpost.pov

http://library.thinkquest.org/3285/scenes/outpost.pov (1 of 5) [9/12/2001 3:38:48 PM]

Page 220: POV Ray Tutorial

} finish { reflection 1.0 } clipped_by { box { <0, 0, 0>, <100, 100, 100> } } bounded_by { clipped_by }}

/*#include "claw.pov"

object { claw_set scale 5 translate island_cen + island_top * y pigment { color rgb <0, 0.4, 0.7> } finish { specular 0.5 }} */

#include "fl_islan.pov"

object { fl_island scale island_size translate island_top texture { mnt_txtr_2 }}

cylinder { island_top, dish_cen, 0.5 pigment { color rgb <0.7, 0.7, 0.7> } finish { specular 0.5 }}

#include "dish.pov"

object { dish rotate <0, 180, -30> translate dish_cen pigment { color rgb <1, 1, 1> }}

#declare build_base_txt = texture { pigment { color rgb <0, 0, 0> } finish { specular 0.8 }}

#declare win_txt = texture { pigment { color rgb <1, 1, 1> } finish { reflection 0.5 }}

#declare building = cylinder { <0, 0, 0>, <0, 1, 0>, 0.5 texture { material_map { gif "winmap.gif" map_type 2 texture { build_base_txt } texture { win_txt } }

http://library.thinkquest.org/3285/scenes/outpost.pov

http://library.thinkquest.org/3285/scenes/outpost.pov (2 of 5) [9/12/2001 3:38:48 PM]

Page 221: POV Ray Tutorial

}}

union { object { building scale <6, 4, 6> } sphere { <0, 0, 0>, 0.5 texture { build_base_txt } scale <6, 2, 6> translate <0, 4, 0> } translate island_top}

union { intersection { object { building scale <6, 4, 6> } plane { y, 2 } } sphere { <0, 0, 0>, 0.5 scale <6, 2, 6> translate <0, 2, 0> texture { build_base_txt } } translate <3, 0, 0> rotate 60*y translate island_top}

union { intersection { object { building scale <6, 4, 6> } plane { y, 1 texture { build_base_txt } } } sphere { <0, 0, 0>, 0.5 scale <6, 2, 6> translate <0, 1, 0> texture { build_base_txt } } translate <3, 0, 0> rotate 120*y translate island_top}

http://library.thinkquest.org/3285/scenes/outpost.pov

http://library.thinkquest.org/3285/scenes/outpost.pov (3 of 5) [9/12/2001 3:38:48 PM]

Page 222: POV Ray Tutorial

/* the flag and flagpole */

#declare flag = object { cubic { <-0.500000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,0.000000, 0.500000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,1.000000, 0.000000> } clipped_by { box { <-1, -0.75, -1>, <1, 0.75, 1> } }}

union { cylinder { <0, 0, 0>, <0, 6.2, 0>, 0.1 pigment { color rgb <0.9, 0.91, 0.98> } finish { specular 0.8 } } sphere { <0, 6.2, 0>, 0.2 pigment { color rgb <0.8, 0.498, 0.196> } finish { specular 0.8 } } object { flag pigment { hexagon color d_col color d_col_2 color d_col_2 rotate <90, 0, 0> scale 0.5 } translate <1, 5.25, 0> } rotate <0, 10, 0> translate <8, 0, 0> rotate <0, 50, 0> translate island_top}

cone { // sky -- obsolete if fog is used, but looks cool anyway <3500, 0, 5500>, 0 <0, 0, 0>, 2500 open texture { sky_tex scale 200 } no_shadow}

/*fog { color rgb <0.5, 0.5, 0.5> distance 60} */

light_source { <-3000, 2500, -500> color rgb <1, 1, 1> }

camera { location <15, 45, -5>

http://library.thinkquest.org/3285/scenes/outpost.pov

http://library.thinkquest.org/3285/scenes/outpost.pov (4 of 5) [9/12/2001 3:38:48 PM]

Page 223: POV Ray Tutorial

// look_at <65, 30, 50> look_at <40, 35, 50>}

http://library.thinkquest.org/3285/scenes/outpost.pov

http://library.thinkquest.org/3285/scenes/outpost.pov (5 of 5) [9/12/2001 3:38:48 PM]

Page 224: POV Ray Tutorial

http://library.thinkquest.org/3285/scenes/froo.jpg

http://library.thinkquest.org/3285/scenes/froo.jpg [9/12/2001 3:40:00 PM]

Page 225: POV Ray Tutorial

#include "colors.inc"#include "textures.inc"#include "stones.inc"

#default { finish { ambient 0.3 } }

#declare groove = union { sphere { <0, 3 + 5/22, 0>, 5/22 } cylinder { <0, 3 + 5/22, 0>, <0, 9 - 5/22, 0>, 5/22 } sphere { <0, 9 - 5/22, 0>, 5/22 }}

#declare groove_bunch = union { object { groove translate <-2.5, 0, -2.5> } object { groove translate <-2.5 + 5/6, 0, -2.5> } object { groove translate <-2.5 + 2 * 5/6, 0, -2.5> } object { groove translate <-2.5 + 3 * 5/6, 0, -2.5> } object { groove translate <-2.5 + 4 * 5/6, 0, -2.5> } object { groove translate <-2.5 + 5 * 5/6, 0, -2.5> }}

#declare pedestal_end_4 = difference { box { <-3.5, 0, -3.5>, <3.5, 2, 3.5> } cylinder { <-4, 2, -3.5>, <4, 2, -3.5>, 1 } plane { x - z, 0 } plane { -x - z, 0 } texture { Rosewood scale 2 rotate <0, 90, 0> }}

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (1 of 11) [9/12/2001 3:40:04 PM]

Page 226: POV Ray Tutorial

#declare pedestal_end = union { object { pedestal_end_4 } object { pedestal_end_4 rotate <0, 90, 0> } object { pedestal_end_4 rotate <0, 180, 0> } object { pedestal_end_4 rotate <0, 270, 0> } bounded_by { box { <-3.5, 0, -3.5>, <3.5, 2, 3.5> } }}

#declare pedestal = union { difference { object { pedestal_end rotate <180, 0, 0> translate <0, 12, 0> } box { <-2.5, 11, -2.5>, <2.5, 13, 2.5> } } difference { box { <-2.5, 2, -2.5>, <2.5, 10, 2.5> } object { groove_bunch } object { groove_bunch rotate <0, 90, 0> } object { groove_bunch rotate <0, 180, 0> } object { groove_bunch rotate <0, 270, 0> } texture { Rosewood rotate <90, 0, 0> scale 2 } } object { pedestal_end } bounded_by { box { <-3.5, 0, -3.5>, <3.5, 14, 3.5>

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (2 of 11) [9/12/2001 3:40:04 PM]

Page 227: POV Ray Tutorial

} }}

#declare case = union { difference { box { <-2.5, 0, -2.5>, <2.5, 5, 2.5> } box { <-2.4, -1, -2.4>, <2.4, 4.9, 2.4> } } difference { box { <-2.5, 0, -2.5>, <2.5, 5, 2.5> } box { <-3, -1, -2.4>, <3, 4.9, 2.4> } box { <-2.4, -1, -3>, <2.4, 4.9, 3> } box { <-2.4, -1, -2.4>, <2.4, 6, 2.4> } pigment { color rgb <0, 0, 0.25> } }}

union { object { pedestal } object { case pigment { color rgbf <1, 1, 1, 1> } finish { reflection 0.1 refraction 1 ior 1.5 // Glass } translate <0, 12, 0> } box { <-2.4, 11, -2.4>, <2.4, 12, 2.4> pigment { gradient y color_map { [0.00 color rgb <0.75, 0, 0>] [0.33 color rgb <0.75, 0.75, 0>] [0.50 color rgb <0, 0.75, 0>] [0.66 color rgb <0, 0, 0.75>] [1.00 color rgb <0.75, 0, 0>] } scale 3 turbulence 1.0 translate <3, 4, 2> // random location }/* image_map { gif "pedestal.gif"

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (3 of 11) [9/12/2001 3:40:04 PM]

Page 228: POV Ray Tutorial

interpolate 2 } rotate <90, 0, 0> translate <-0.5, 0, -0.5> scale 5 } */ finish { brilliance 0.3 } } translate <-2, 0, -2>}

/*#include "tjsym.pov"

object { tjsym scale 3.5/30 translate <-2, 14.5, -2> pigment { color Gray80 }} */

/*#include "dodeca.pov"

object { dodeca scale 3.5/2 rotate <0, 0, 90> translate <-2, 14.5, -2> texture { Stone13 }} */

#include "icosa.pov"

object { icosa scale 3.5/2// rotate <90, 0, 0> translate <-2, 14.5, -2> texture { Stone9 }}

plane { // the floor y, 0 texture { material_map { gif "matmap.gif" texture { // White Marble pigment { White_Marble } finish { reflection 0.1 } } texture { // Black Marble pigment { marble turbulence 1 color_map { [0.0, 0.8 color red 0.1 green 0.1 blue 0.1 color red 0.5 green 0.5 blue 0.5] [0.8, 1.01 color red 0.5 green 0.5 blue 0.5

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (4 of 11) [9/12/2001 3:40:04 PM]

Page 229: POV Ray Tutorial

color red 0.8 green 0.8 blue 0.8] } rotate <0, 90, 0> } finish { reflection 0.1 } } texture { // Gold pigment { color BrightGold } finish { ambient 0.2 diffuse 0.7 reflection 0.5 brilliance 6 phong 0.5 phong_size 80 metallic } } } scale 10 rotate <90, 0, 0> }}

#declare wall_texture = texture { pigment { image_map { gif "wp_flor7.gif" interpolate 2 } scale 10 }}

#declare wall = union { plane { -z, 0 texture { wall_texture } } intersection { plane { -z, 1 } plane { y, 1 } } quadric { <0, 1, 1>, <0, 0, 0>, <0, 0, 0>, -1 translate <0, 1, 0> }}

object { wall pigment { color White } translate <0, 0, 30>}

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (5 of 11) [9/12/2001 3:40:04 PM]

Page 230: POV Ray Tutorial

object { wall pigment { color White } rotate <0, -90, 0> translate <-30, 0, 0>}

#declare shelf_support = difference { union { box { <-0.25, 0, 0>, <0.25, -1, -4> } box { <-0.25, 0, 0>, <0.25, -4, -1> } box { <-0.25, -1, -1>, <0.25, -2, -2> }/* intersection { cubic { <0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.222222,-1.000000, 0.000000, 0.000000> rotate <90, 0, 0> translate <-4, -1, 0> inverse } plane { x, 0.25 } plane { -x, 0.25 } plane { y, -1 } plane { z, -1 } } */ cylinder { <-0.25, -1, -3>, <0.25, -1, -3>, 1 } cylinder { <-0.25, -3, -1>, <0.25, -3, -1>, 1 } } cylinder { <-0.5, 2, 2>, <0.5, 2, 2>, 1 } bounded_by { box { <-0.25, 0, 0>, <0.25, -4, -4> } }}

#declare shelf_top = intersection { union { box { <-2.5, 0, 0>, <2.5, 1.5, -5> } cylinder { <-2.5, 0.75, -5>, <2.5, 0.75, -5>, 0.75

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (6 of 11) [9/12/2001 3:40:04 PM]

Page 231: POV Ray Tutorial

} cylinder { <-2.5, 0.75, 0>, <-2.5, 0.75, -5>, 0.75 } cylinder { <2.5, 0.75, 0>, <2.5, 0.75, -5>, 0.75 } sphere { <2.5, 0.75, -5>, 0.75 } sphere { <-2.5, 0.75, -5>, 0.75 } } plane { y, 0.5 } bounded_by { box { <-3.25, 0, 0>, <3.25, 0.5, -5.75> } }}

#declare shelf = union { object { shelf_top texture { Rosewood scale 2 } } object { shelf_support translate <1.5, 0, 0> texture { Rosewood } } object { shelf_support translate <-1.5, 0, 0> texture { Rosewood } }}

object { shelf translate <-10, 8, 30>}

object { shelf translate <8, 8, 30>}

#declare frame_4 = intersection { cylinder { <-5, -10, 0>, <-5, 10, 0>, 0.5 } plane { x + y, 0 } plane { -(-x + y), 0 }}

#declare picture = union { object {

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (7 of 11) [9/12/2001 3:40:04 PM]

Page 232: POV Ray Tutorial

frame_4 } object { frame_4 rotate <0, 0, 90> } object { frame_4 rotate <0, 0, 180> } object { frame_4 rotate <0, 0, 270> } box { <-5, -5, 0>, <5, 5, -0.01> pigment { image_map {// gif "aliens.gif" tga "d:froo.tga" interpolate 2 } scale 10 translate <-5, -5, 0> } finish { ambient 0.5 } } scale <3/2, 1, 1> texture { Silver_Texture }}

object { picture rotate <0, -90, 0> scale 4/5 translate <-30, 10, 10>}

union { sphere { // the pot for the plant <0, 0, 0>, 2 clipped_by { box { <-2, -0.75, -2>, <2, 0.75, 2> } } texture { Copper_Texture normal { wrinkles 0.5 } } } plane { y, 0.5 pigment { color DarkBrown } clipped_by { sphere { <0, 0, 0>, 2 } } } translate <-10, 9.25, 27.5>}

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (8 of 11) [9/12/2001 3:40:04 PM]

Page 233: POV Ray Tutorial

#include "narftree.pov"

object { narftree scale 0.02 translate <-10, 8.5, 27.5>}

#include "narfcrys.pov"

object { narfcrys scale 0.3 rotate <0, 30, 0> translate <8, 8.5, 26.5>}

#declare lamp_fixture = union { cylinder { <0, -1, -2.5>, <0, 1, -2.5>, 0.75 open pigment { color Black } finish { Shiny } } cylinder { <0, -1, -2.5>, <0, -1.5, -2.5>, 0.75 open texture { Gold_Texture } } cylinder { <0, 1, -2.5>, <0, 1.5, -2.5>, 0.75 open texture { Gold_Texture } } union { cylinder { <0, 0, -2.5>, <0, 0, 0>, 0.25 clipped_by { cylinder { <0, -1, -2.5>, <0, 1, -2.5>, 0.75 inverse } } } cylinder { <0, 0, -0.5>, <0, 0, 0>, 0.3 } cylinder { <0, 0, -0.1>, <0, 0, 0>, 0.75 } pigment { color Black } finish { Shiny } }}

object { lamp_fixture translate <8, 20, 30>}

light_source { <8, 20, 27.5> color rgb <2, 2, 2> spotlight point_at <8, 10, 27.5> radius 22 falloff 26.56505

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (9 of 11) [9/12/2001 3:40:04 PM]

Page 234: POV Ray Tutorial

}

object { lamp_fixture translate <-10, 20, 30>}

light_source { <-10, 20, 27.5> color rgb <2, 2, 2> spotlight point_at <-10, 10, 27.5> radius 22 falloff 26.56505}

object { lamp_fixture rotate <0, -90, 0> translate <-30, 20, 10>}

light_source { <-27.5, 20, 10> color rgb <1.5, 1.5, 1.5> spotlight point_at <-27.5, 10, 10> radius 22 falloff 26.56505}

// four spotlights centered at <-2, 30, -2>

light_source { <6, 30, 6> color Gray60 spotlight point_at <-2, 12, -2> radius 13 falloff 22}

light_source { <-10, 30, -10> color Gray60 spotlight point_at <-2, 12, -2> radius 13 falloff 22}

light_source { <6, 30, -10> color Gray60 spotlight point_at <-2, 12, -2> radius 13 falloff 22}

light_source { <-10, 30, 6> color Gray60 spotlight point_at <-2, 12, -2> radius 13 falloff 22

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (10 of 11) [9/12/2001 3:40:04 PM]

Page 235: POV Ray Tutorial

}

//light_source { <40, 40, -20> color rgb <1, 1, 1> } // all-illuminating

camera {// location <15, 15, -15>// look_at <0, 8, 0> location <10, 19, -18> look_at <0, 11, 0>// location <-10, 11, 20>// look_at <-10, 11, 30>// location <8, 15, 27.5>// look_at <7.9, 20, 27.5>}

http://library.thinkquest.org/3285/scenes/froo.pov

http://library.thinkquest.org/3285/scenes/froo.pov (11 of 11) [9/12/2001 3:40:04 PM]

Page 236: POV Ray Tutorial

http://library.thinkquest.org/3285/scenes/rcolumn2.jpg

http://library.thinkquest.org/3285/scenes/rcolumn2.jpg [9/12/2001 3:41:04 PM]

Page 237: POV Ray Tutorial

#include "colors.inc"#include "textures.inc"#include "stones.inc"

#declare Fluting = union { // use with difference to flute the column sphere { <0, 1, 0>,0.0625 } cylinder { <0, 1, 0>,<0, -1, 0>,0.0625 } sphere { <0, -1, 0>,0.0625 }}

#declare Column = difference { // the column union { difference { // top of the column cylinder { <0, 2.5, 0>, <0, 2.75, 0>,0.625 } torus { 0.625, 0.125 translate <0, 2.5, 0> } } cylinder { // main cylinder of the column <0, 0.25, 0>, <0, 2.5, 0>,0.5 } difference { cylinder { <0, 0, 0>, <0, 0.25, 0>,0.625 } torus { 0.625, 0.125 translate <0, 0.25, 0> } } } union { // the vertical spaces in the main cylinder object { Fluting translate <0, 1.5, -0.5> } object { Fluting translate <0, 1.5, -0.5> rotate y * -30 } object { Fluting translate <0, 1.5, -0.5> rotate y * -60 } object { Fluting

http://library.thinkquest.org/3285/scenes/rcolumns2.pov

http://library.thinkquest.org/3285/scenes/rcolumns2.pov (1 of 4) [9/12/2001 3:41:06 PM]

Page 238: POV Ray Tutorial

translate <0, 1.5, -0.5> rotate y * -90 } object { Fluting translate <0, 1.5, -0.5> rotate y * -120 } object { Fluting translate <0, 1.5, -0.5> rotate y * -150 } object { Fluting translate <0, 1.5, -0.5> rotate y * -180 } object { Fluting translate <0, 1.5, -0.5> rotate y * -210 } object { Fluting translate <0, 1.5, -0.5> rotate y * -240 } object { Fluting translate <0, 1.5, -0.5> rotate y * -270 } object { Fluting translate <0, 1.5, -0.5> rotate y * -300 } object { Fluting translate <0, 1.5, -0.5> rotate y * -330 } } bounded_by { cylinder { <0, 0, 0>, <0, 2.75, 0>,0.625 } } }

object { Column texture { White_Marble finish { phong 1.0 phong_size 90 } }}

sphere {

http://library.thinkquest.org/3285/scenes/rcolumns2.pov

http://library.thinkquest.org/3285/scenes/rcolumns2.pov (2 of 4) [9/12/2001 3:41:06 PM]

Page 239: POV Ray Tutorial

<0, 3.5, 0>,0.5 texture { Stone21 } finish { reflection 0.3 }}

object { Column translate <-2, 0, 0> texture { White_Marble finish { phong 1.0 phong_size 90 } }}

box { <-0.25, -0.25, -0.25>, <0.25, 0.25, 0.25> rotate <45, 0, 35.2> translate <-2, 3.5, 0> texture { Stone9 }}

object { Column translate <2, 0, 0> texture { White_Marble finish { phong 1.0 phong_size 90 } }}

/*intersection { difference { cylinder { <0, 0, 0>, <0, 2, 0>,0.5 } torus { 0.5, 0.5 scale <1, 2, 1> translate <0, 1, 0> } } plane { y, 1 } bounded_by { cylinder { <0, 0, 0>, <0, 1, 0>, 0.5 } } translate <2, 3, 0> texture { Stone18 translate <1, 1.25, 1.25> finish { phong 1.0 phong_size 90 } }} */

union { sphere { <0, 0, 0>, 0.25 }

http://library.thinkquest.org/3285/scenes/rcolumns2.pov

http://library.thinkquest.org/3285/scenes/rcolumns2.pov (3 of 4) [9/12/2001 3:41:06 PM]

Page 240: POV Ray Tutorial

cone { <0, -0.083333, 0>, 0.235702 <0, -0.75, 0>, 0 } bounded_by { box { <-0.25, -0.75, -0.25>, <0.25, 0.25, 0.25> } } translate <2, 3.75, 0> texture { Stone18 finish { reflection 0.3 } }}

// the floor and the walls

union { plane { y, 0 texture { Sapphire_Agate } } plane { x - z, -3 } plane { -x - z, -3 } texture { Polished_Chrome// finish { phong 0 diffuse 0 metallic } }}

camera { location <0, 3.5, -5> look_at <0, 2, 0> }light_source { <3, 6, -2> color rgb <1.25, 1.25, 1.25> spotlight point_at <0, 2, 0> radius 25 falloff 35 tightness 5}light_source { <-3, 6, -2> color rgb <1.25, 1.25, 1.25> spotlight point_at <0, 2, 0> radius 25 falloff 35 tightness 5}

http://library.thinkquest.org/3285/scenes/rcolumns2.pov

http://library.thinkquest.org/3285/scenes/rcolumns2.pov (4 of 4) [9/12/2001 3:41:06 PM]

Page 241: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Resources

Links for BeginnersThe comp.graphics.rendering.raytracing FAQ●

A novices guide to getting started with POV-Ray●

POV-Ray's pseudo-FTP site, where you can get the official binaries for many platforms, andcountless other POV-Ray utilities/related programs

POV-Ray Related FilesPOVAFX, an unofficial version of POV-Ray with simple atmospheric effects (MSDOS,Win95/NT)

Breeze Designer, a freeware modeller for Win95/NT/32s●

Texture Magic, an interactive texture editor for Win95/NT●

POVLAB, another shareware modeller for POV-Ray (DOS only)●

SCED, a constraint-based scene designer for Unix/XWindows●

Other Online ResourcesThe Official POV-Ray Site●

The Internet Raytracing Competition, a great place to see all manner of spectacular raytracedimages. And most of them include the source!

A great online texture library●

The POV-Ray 2.0 documentation in HTML format●

An online request form from The Tackle Box BBS for users to personally request any obscure orhard-to-find POV-Ray/raytracing related files from the SysOp of that BBS; draws from a base ofover 7000 files in 200 different file areas

Main Page

The Online POV-Ray Tutorial: Object Library

http://library.thinkquest.org/3285/resource_lib.html [9/12/2001 3:41:12 PM]

Page 242: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray UpdateDuring the creation of this Web page, POV-Ray 3.0 was released. POV-Ray 3.0 contains many excitingnew features, including ground fog, focal blur, and iterative functions. Unfortunately, we were not able todocument all of the additions in time.

The Tutorial covers POV-Ray 2.2, and everything found in here will work with POV-Ray 3.0. We advisethat users interested in the new features of POV-Ray 3.0 consult its documentation after having gonethrough the Path of Learning.

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: POV-Ray Update

http://library.thinkquest.org/3285/update.html [9/12/2001 3:41:15 PM]

Page 243: POV Ray Tutorial

The Online POV-Ray Tutorial

Introduction to POV-Ray and Ray-tracing(Show Jump Points) (Hide Jump Points)

In this section, you will learn what ray-tracing is, how it works, what POV-Ray is, and how POV-Rayrelates to the rest of the ray-tracing world. This is a good section if you've never experimented with (oreven heard of) ray-tracing before.

Quick index:

What is ray-tracing?1.

How does ray-tracing work?2.

What is POV-Ray?3.

How do I set up POV-Ray?4.

What is ray-tracing?

Ray-tracing is a method of creating visual art in which a description of an object or scene ismathematically converted into a picture. In more precise terms, ray-tracing is the process ofmathematically generating near-photorealistic images from a given description of a scene via geometricalmodeling of light rays.

Ray-tracing can generate very beautiful and complex scenes, and can open exciting possibilities as a newmethod of creating visual art. One of the most important advantages of computer-based ray-tracing overmore "orthodox" art forms is that it removes the need for technical skills (such as the ability to paint,draw, or sculpt) that may take years to master, and places the burden on the computer. This leaves theuser to be as creative as possible, without having to spend years learning difficult skills. In fact, youshould be well on your way to creating some exciting pictures before you're far along this tutorial.

Ray-tracing can require millions and even billions of complex mathematical calculations and, as such, isusually done by computer (and even then, is not a speedy process). Usually, in the computer-basedray-tracing procedure, a file containing the description of a scene (in terms that the ray-tracing softwarecan understand, and usually in some human-readable format) is converted, by the computer, into anactual image of the scene. Later on in the tutorial you will learn how to use the POV-Ray software tocreate scenes of your own, with the help of your computer.

Of course, ray-tracing is not a magical technique that makes all art easy. Certain types of scenes aredifficult or impossible to create with ray-tracing software. In most cases, you will find that ray-tracing isgood at generating mathematically simple objects, such as those composed of spheres, cones and cubes,and poor (slower or more difficult to describe) at generating more complex objects, like a human face.There are several ways of getting around these barriers, but ray-tracing, like all forms of art, does havecertain inherent limitations.

The Online POV-Ray Tutorial: Introduction to POV-Ray and Ray-tracing

http://library.thinkquest.org/3285/tutorial/intro.html (1 of 4) [9/12/2001 3:41:25 PM]

Page 244: POV Ray Tutorial

Because ray-tracing is based on math, ray-traced scenes have some distinct characteristics. For example,in a simple ray-traced scene, all objects are in focus, and all shadows are crisp and well-defined; in fact,every object in the scene is mathematically perfect. (When was the last time you saw a mathematicallyperfect pear?) Because of this, images produced by ray-tracing tend to look slightly odd, or evensurrealistic, a side-effect many artists can exploit to their benefit. It is, interestingly enough, considered amark of a "true ray-tracing artist" to be able to create more realistic, "less perfect" scenes.

How does ray-tracing work?

We won't go into all the gory details, but having a general understanding of what's going on behind thescenes (so to speak) can be helpful when you start ray-tracing your own images. Although there areseveral methods of ray-tracing, one of the most common (and the one the POV-Ray software packageuses) works something like this:

First, an internal model of the scene is generated, with your computer screen included as the receiving"eye" in the model. Then, the software traces imaginary light rays backwards from where their endpointlies (a pixel on your computer screen) to their initial point (some light source in the scene). This step isrepeated, pixel by pixel, until the entire image has been created.

The reason the software traces the light rays backwards, instead of starting at the light source, is forefficiency's sake -- if a light ray doesn't end up on your screen, then you, as the user, don't care about it(because you'll never see it). By tracing the light rays backwards, beginning at the computer screen, thesoftware can assure that every light ray it calculates is one you care about, because it knows that it willend up on your screen.

In their journey, the light rays can be reflected by mirrors, refracted by glass, or undergo various othercontortions, all of which result in a single pixel of the final image. Because the ray-tracing software musttrace one ray of light for each pixel in the output image, and because the light rays can undergo so manycontortions, the process of ray-tracing can take a very long time, depending on the size and complexity ofthe image and the processing power of your computer. Unless you have an extraordinarily fast computer,you will most likely find yourself waiting around impatiently for your scene to finish rendering onceyou've begun to ray-trace in earnest.

What is POV-Ray?

POV-Ray is a high-quality, freely available ray-tracing software package that is available for PC,Macintosh and UNIX platforms. Yes, that's right, it's free! If you're a programmer interested inPOV-Ray, you can also pick up a copy of the source code without charge. POV-Ray is perhaps one ofthe most commonly used ray-tracing software to date, because of its relative ease of use, cheap price, andhigh quality.

POV-Ray is no toy. Despite not generating any direct income from their POV-Ray software, thePOV-Ray Team (the people responsible for POV-Ray) has managed to create a commercial-qualityproduct and, in the true spirit of the Internet, distribute it widely and without charge. As a consequence,

The Online POV-Ray Tutorial: Introduction to POV-Ray and Ray-tracing

http://library.thinkquest.org/3285/tutorial/intro.html (2 of 4) [9/12/2001 3:41:25 PM]

Page 245: POV Ray Tutorial

POV-Ray is one of the most popular ray-tracing programs to date. We, the authors of the Tutorial, thinkthat POV-Ray is one of the greatest things to come out of the Internet (gee, is it a little obvious?), whichis why we decided to create this Web page.

At any rate, POV-Ray is what is known as a "rendering engine". What this means is that POV-Ray willtake a file as input and generate an output file, but does not have much in the way of interface. There aremodellers available for POV-Ray that will do that kind of visualization for you, if you choose, but werecommend you only start using those tools once you have a firm grasp of the POV-Ray language.Otherwise, you'll get stuck down the road.

Describing scenes to POV-Ray is fairly simple. You give POV-Ray a file containing a description ofevery object in the scene, written in the POV-Ray language (which you will learn later in the tutorial).Each object's description consists of:

What type of object you want (one of POV-Ray's simple objects or one you've created yourself);and

1.

Various attributes of the object (its color, how it reflects light, etc).2.

POV-Ray takes this file and generates a picture, which you can then view.

The Path of Learning is not meant to cover every single detail of the POV-Ray language. Such a taskwould be tremendous (although the Language Reference has come very close). Instead the Path willguide you as you learn about each section, and, when appropriate, refer you to more complete sources ofinformation. At the end of the Path, you should be well on your way to being a certified POV-Rayblackbelt.

How do I set up POV-Ray?

The latest version of POV-Ray can always be found at ftp.povray.org. You will have to download thecorrect version for your computer (there are versions available for most operating systems) and to set itup.

Once you have POV-Ray, how you set it up is highly dependant on your operating system. We're notabout to teach you how to use your own computer; if you can't set it up yourself, ask a local computerguru to help.

As we mentioned above, POV-Ray doesn't have much of an interface; on most operating systems, youwill give POV-Ray the name of your input file, the name of your output file, and a whole bunch of otheroptions via the command line. You will also need some form of image viewer and/or converter in orderto display the output files that POV-Ray creates; again, this is highly operating-system-dependant.

POV-Ray also comes with documentation and example scenes; these make excellent references if you'restuck or need to know more.

Ok, we're ready to start learning the real stuff now!

The Online POV-Ray Tutorial: Introduction to POV-Ray and Ray-tracing

http://library.thinkquest.org/3285/tutorial/intro.html (3 of 4) [9/12/2001 3:41:25 PM]

Page 246: POV Ray Tutorial

Top of Document Main Page Step 2: POV-Ray Basics

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Introduction to POV-Ray and Ray-tracing

http://library.thinkquest.org/3285/tutorial/intro.html (4 of 4) [9/12/2001 3:41:25 PM]

Page 247: POV Ray Tutorial

JumpPoints

Main Page

IntroductionBasics

Simple ScenesAdvanced

Conclusion

Language ReferenceGlossary / Index

Texture LibraryObject LibraryScene Library

Resource Library

Color ToolNormal ToolFinish Tool

Note: this frame isresizeable

The Online POV-Ray Tutorial

Introduction to POV-Ray andRay-tracing

(Show Jump Points) (Hide Jump Points)

In this section, you will learn what ray-tracing is, how it works, what POV-Ray is,and how POV-Ray relates to the rest of the ray-tracing world. This is a goodsection if you've never experimented with (or even heard of) ray-tracing before.

Quick index:

What is ray-tracing?1.

How does ray-tracing work?2.

What is POV-Ray?3.

How do I set up POV-Ray?4.

What is ray-tracing?

Ray-tracing is a method of creating visual art in which a description of an object orscene is mathematically converted into a picture. In more precise terms,ray-tracing is the process of mathematically generating near-photorealistic imagesfrom a given description of a scene via geometrical modeling of light rays.

Ray-tracing can generate very beautiful and complex scenes, and can openexciting possibilities as a new method of creating visual art. One of the mostimportant advantages of computer-based ray-tracing over more "orthodox" artforms is that it removes the need for technical skills (such as the ability to paint,draw, or sculpt) that may take years to master, and places the burden on thecomputer. This leaves the user to be as creative as possible, without having tospend years learning difficult skills. In fact, you should be well on your way tocreating some exciting pictures before you're far along this tutorial.

Ray-tracing can require millions and even billions of complex mathematicalcalculations and, as such, is usually done by computer (and even then, is not aspeedy process). Usually, in the computer-based ray-tracing procedure, a filecontaining the description of a scene (in terms that the ray-tracing software canunderstand, and usually in some human-readable format) is converted, by thecomputer, into an actual image of the scene. Later on in the tutorial you will learnhow to use the POV-Ray software to create scenes of your own, with the help ofyour computer.

Of course, ray-tracing is not a magical technique that makes all art easy. Certain

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/intro_frames.html (1 of 4) [9/12/2001 3:41:54 PM]

Page 248: POV Ray Tutorial

types of scenes are difficult or impossible to create with ray-tracing software. Inmost cases, you will find that ray-tracing is good at generating mathematicallysimple objects, such as those composed of spheres, cones and cubes, and poor(slower or more difficult to describe) at generating more complex objects, like ahuman face. There are several ways of getting around these barriers, butray-tracing, like all forms of art, does have certain inherent limitations.

Because ray-tracing is based on math, ray-traced scenes have some distinctcharacteristics. For example, in a simple ray-traced scene, all objects are in focus,and all shadows are crisp and well-defined; in fact, every object in the scene ismathematically perfect. (When was the last time you saw a mathematically perfectpear?) Because of this, images produced by ray-tracing tend to look slightly odd,or even surrealistic, a side-effect many artists can exploit to their benefit. It is,interestingly enough, considered a mark of a "true ray-tracing artist" to be able tocreate more realistic, "less perfect" scenes.

How does ray-tracing work?

We won't go into all the gory details, but having a general understanding of what'sgoing on behind the scenes (so to speak) can be helpful when you start ray-tracingyour own images. Although there are several methods of ray-tracing, one of themost common (and the one the POV-Ray software package uses) works somethinglike this:

First, an internal model of the scene is generated, with your computer screenincluded as the receiving "eye" in the model. Then, the software traces imaginarylight rays backwards from where their endpoint lies (a pixel on your computerscreen) to their initial point (some light source in the scene). This step is repeated,pixel by pixel, until the entire image has been created.

The reason the software traces the light rays backwards, instead of starting at thelight source, is for efficiency's sake -- if a light ray doesn't end up on your screen,then you, as the user, don't care about it (because you'll never see it). By tracingthe light rays backwards, beginning at the computer screen, the software canassure that every light ray it calculates is one you care about, because it knows thatit will end up on your screen.

In their journey, the light rays can be reflected by mirrors, refracted by glass, orundergo various other contortions, all of which result in a single pixel of the finalimage. Because the ray-tracing software must trace one ray of light for each pixelin the output image, and because the light rays can undergo so many contortions,the process of ray-tracing can take a very long time, depending on the size andcomplexity of the image and the processing power of your computer. Unless youhave an extraordinarily fast computer, you will most likely find yourself waitingaround impatiently for your scene to finish rendering once you've begun toray-trace in earnest.

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/intro_frames.html (2 of 4) [9/12/2001 3:41:54 PM]

Page 249: POV Ray Tutorial

What is POV-Ray?

POV-Ray is a high-quality, freely available ray-tracing software package that isavailable for PC, Macintosh and UNIX platforms. Yes, that's right, it's free! Ifyou're a programmer interested in POV-Ray, you can also pick up a copy of thesource code without charge. POV-Ray is perhaps one of the most commonly usedray-tracing software to date, because of its relative ease of use, cheap price, andhigh quality.

POV-Ray is no toy. Despite not generating any direct income from their POV-Raysoftware, the POV-Ray Team (the people responsible for POV-Ray) has managedto create a commercial-quality product and, in the true spirit of the Internet,distribute it widely and without charge. As a consequence, POV-Ray is one of themost popular ray-tracing programs to date. We, the authors of the Tutorial, thinkthat POV-Ray is one of the greatest things to come out of the Internet (gee, is it alittle obvious?), which is why we decided to create this Web page.

At any rate, POV-Ray is what is known as a "rendering engine". What this meansis that POV-Ray will take a file as input and generate an output file, but does nothave much in the way of interface. There are modellers available for POV-Raythat will do that kind of visualization for you, if you choose, but we recommendyou only start using those tools once you have a firm grasp of the POV-Raylanguage. Otherwise, you'll get stuck down the road.

Describing scenes to POV-Ray is fairly simple. You give POV-Ray a filecontaining a description of every object in the scene, written in the POV-Raylanguage (which you will learn later in the tutorial). Each object's descriptionconsists of:

What type of object you want (one of POV-Ray's simple objects or oneyou've created yourself); and

1.

Various attributes of the object (its color, how it reflects light, etc).2.

POV-Ray takes this file and generates a picture, which you can then view.

The Path of Learning is not meant to cover every single detail of the POV-Raylanguage. Such a task would be tremendous (although the Language Reference hascome very close). Instead the Path will guide you as you learn about each section,and, when appropriate, refer you to more complete sources of information. At theend of the Path, you should be well on your way to being a certified POV-Rayblackbelt.

How do I set up POV-Ray?

The latest version of POV-Ray can always be found at ftp.povray.org. You willhave to download the correct version for your computer (there are versionsavailable for most operating systems) and to set it up.

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/intro_frames.html (3 of 4) [9/12/2001 3:41:54 PM]

Page 250: POV Ray Tutorial

Once you have POV-Ray, how you set it up is highly dependant on your operatingsystem. We're not about to teach you how to use your own computer; if you can'tset it up yourself, ask a local computer guru to help.

As we mentioned above, POV-Ray doesn't have much of an interface; on mostoperating systems, you will give POV-Ray the name of your input file, the nameof your output file, and a whole bunch of other options via the command line. Youwill also need some form of image viewer and/or converter in order to display theoutput files that POV-Ray creates; again, this is highlyoperating-system-dependant.

POV-Ray also comes with documentation and example scenes; these makeexcellent references if you're stuck or need to know more.

Ok, we're ready to start learning the real stuff now!

Top of Document Main Page Step 2: POV-Ray Basics

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuestTeam

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/intro_frames.html (4 of 4) [9/12/2001 3:41:54 PM]

Page 251: POV Ray Tutorial

The Online POV-Ray Tutorial

POV-Ray Basics(Show Jump Points) (Hide Jump Points)

Before you can start creating scenes in POV-Ray, you need to know a few things: how to describeobjects in three dimensions, some of POV-Ray's basic notation, and other stuff. This section will giveyou the background knowledge you'll need to get started.

Quick reference:

POV-Ray's Coordinate System1.

Vectors in POV-Ray2.

How to describe color: RGB and RGBF Vectors3.

Normal Vectors4.

POV-Ray Source Code5.

Comments in POV-Ray Source Code6.

Including files7.

POV-Ray's Coordinate System

The source code file, the file POV-Ray takes as input, is really one big list of descriptions of objects. Thevery first thing we need in order to describe objects is a way of telling POV-Ray where things go. Such amethod is called a coordinate system. If you have taken elementary algebra, you will already haveexperience with a simple coordinate system: a two-dimensional (or 2D) Cartesian coordinate system. Aquick graph of a 2D Cartesian plane looks something like this:

Any position on this graph can be specified by a set of coordinates, usually written in the form (x,y). Thex coordinate corresponds to its position along the horizontal, or x, axis, and the y coordinate correspondsto its position along the vertical, or y axis. For example, (0,0) corresponds to the point in the middle ofthe graph, or the origin. The point (1,3) corresponds to the point on the graph one unit right from theorigin, and three units up from the origin. Negative numbers can also be used: (-6,4) corresponds to thepoint 6 units left from the origin, and four units up. You get the idea.

Now this is all well and good, but when we look at things other than our computer screen, we notice wecan observe three dimensions, not two: in other words, we describe objects not just by how far to the

The Online POV-Ray Tutorial: POV-Ray Basics

http://library.thinkquest.org/3285/tutorial/basics.html (1 of 6) [9/12/2001 3:42:03 PM]

Page 252: POV Ray Tutorial

right (or left) and how high (or low) they are, but also how close they are in front (or in back) of you. Inother words, to be able to describe a real scene to POV-Ray, we need, in addition to the x and ycoordinates, a third coordinate. This coordinate is called (surprisingly enough) the z coordinate.

The coordinate system that POV-Ray uses, then, is called a three-dimensional (or 3D) Cartesiancoordinate system. A quick graph looks like this:

(You have to use your imagination somewhat: that third axis is not a diagonal but is perpendicular toyour computer screen -- imagine it shooting out at your face). As you can see, it looks similar to the 2Dgraph, except that one additional axis has been added: the z axis. Because of the additional possibledirection, points in this coordinate system must be described in the form (x,y,z). The point (0,0,0)corresponds to the origin, or center of the graph, and (1,-2,7) corresponds to the point one unit to theright of, two units below, and seven units behind the origin.

If you have experience with mathematical 3D coordinate systems, you will notice that the axes arelabelled slightly differently than the system most commonly used in mathematical terms. The axis wehave drawn above is not fixed in POV-Ray -- the way the axis looks (in terms of which axes are which)really depends on where you place your camera in POV-Ray. We'll get to explaining the camera soon.For now, just understand that the labels on the axes may change, depending on how you position yourcamera.

The 3D graph above represents a coordinate system that POV-Ray can use. Visualizing objects andscenes in three dimensions can be tricky. Often, a pad of paper and a pencil can be extremely valuabletools, especially in more complex scenes. Alternatively, you can take a look at the Resource Library forsome graphical tools that may help.

Vectors in POV-Ray

POV-Ray calls the number triples that define positions position vectors. The term vector refers to anygroup of numbers describing a certain thing -- there are color vectors and normal vectors, for example, inaddition to position vectors.

In POV-Ray, vectors are surrounded by angle brackets (that's < and >). For example, to specify the originin terms that POV-Ray understands, we would say <0,0,0>.

The magnitude of a vector can be thought of as the "length" of the vector. Imagine a line from the originto the point in the coordinate system represented by your vector. The magnitude is the length of this line.(If you really care about the math, the magnitute can be computed as the square root of the sum of thesquares of the elements of the vector -- but don't worry, you probably won't have to know that).

The Online POV-Ray Tutorial: POV-Ray Basics

http://library.thinkquest.org/3285/tutorial/basics.html (2 of 6) [9/12/2001 3:42:03 PM]

Page 253: POV Ray Tutorial

An important thing to know about is a POV-Ray feature called vector promotion. Vector promotion iswhen a single number is substituted in place of a vector. The single number is then promoted to a vector,one with all elements equal to that number. For example, promoting the number 2 to a three-dimensionalvector would result in the vector <2,2,2>. Vector promotion is done automatically for you by POV-Rayin most cases -- just put in a single number instead of a vector. This feature allows you to quickly specifysimilar vectors.

How to describe color: RGB and RGBF Vectors

Much as any position within the scene can be specified by a three-element vector, so can any color. Indescribing a position, each coordinate in the vector corresponds to the position along a particular axis. Indescribing a color, each element of the vector corresponds to the amount of a primary color -- red, greenand blue. Such a vector is called a RGB vector (for red green blue vector).

In a position vector, the individual elements can be any real number at all (actually, this isn't quite true --there are upper and lower limits set by the hardware constraints of your computer). In a RGB vector, thenumbers should be between 0.0 and 1.0. You can have values higher that 1.0, but they don't correspondto any physical property (what's greener than green?). A value of 1.0 means 100% of that color. Forexample, the color black, which is actually the absence of all color, is described by the color vector<0,0,0>. The color white, a complete combination of all three primary colors, is specified by the colorvector <1,1,1>. Try experimenting with the Color Tool to find the color vectors for particular colors -- itwill help you get a good "feel" for describing colors in terms of POV-Ray color vectors.

In addition to RGB vectors, you can specify a color in POV-Ray with an RGBF vector. As you mightguess, a RGBF vector is like a RGB vector, but with one extra element - the F, for filter. The filter valuespecifies how transparent the pigment is, ranging from 0.0 (not transparent at all) to 1.0 (100%transparent). RGB vectors have an implied filter value of 0.0 -- in other words, a color specified by aRGB vector will be perfectly opaque. A filter value of 1.0 means that all light will be let through, but thelight will still be filtered. For example, the RGBF vector <1,0,0,1> acts like red cellophane -- 100% oflight is passed through, but it is filtered by the red pigment. RGBF vectors can be a little confusing atfirst, but they aren't too difficult once you get the hang of it.

These are the most commonly-used ways of specifying color. There are a few more ways to do it; if youwant to read about them, look at the color section of the Language Reference.

Normal Vectors

Occasionally you will be called upon to specify a normal vector in POV-Ray. Simply put, a normalvector is a vector parallel to a given plane in three dimensions. Imagine a flat sheet of paper. If you wereto poke a pencil all the way through it so that the end of the pencil was touching the paper and the pencilwas standing straight up (with respect to the paper), the pencil would represent the normal vector to thepaper. In the picture below, the normal vector is in red and the plane is in blue.

The Online POV-Ray Tutorial: POV-Ray Basics

http://library.thinkquest.org/3285/tutorial/basics.html (3 of 6) [9/12/2001 3:42:03 PM]

Page 254: POV Ray Tutorial

Note that the magnitude of normal vectors is not important (as long as it is non-zero). This is becausenormal vectors are used to specify an orientation, not a distance.

POV-Ray is kind enough to automatically define three normal vectors for you: x (corresponding to<1,0,0>), the normal vector for a plane lying along the y and z axes, y (corresponding to <0, 1, 0>), thenormal vector for a plane lying along the x and z axes, and z (corresponding to <0, 0, 1>), the normalvector for a plane lying along the x and y axes. Any time you are asked for a normal vector (or anyvector, really) you can substitute those letters.

POV-Ray Source Code

Source code is the name for the text you give to POV-Ray. POV-Ray reads the source code file andoutputs an image. There are two things you need to know about POV-Ray source code:

POV-Ray source code is case sensitive1.

POV-Ray ignores whitespace2.

Ordering is unimportant3.

Case sensitive means that upper and lower-case letters are not treated as the same by POV-Ray. Forexample, to POV-Ray, sphere is not the same as Sphere and is not the same as SpHeRe. Whitespace isthe common name for any characters you can't directly see on screen -- spaces, tab characters (theinvisible characters put there when you press the Tab key), carriage returns and line feeds (the invisiblecharacters put there when you hit the Enter key). Between any two words or symbols in your sourcecode, POV-Ray doesn't care whether you put one space, two spaces, one hundred spaces, a new line, orany other whitespace.

For example, the phrase:

one two

the phrase

one two

and the phrase

onetwo

The Online POV-Ray Tutorial: POV-Ray Basics

http://library.thinkquest.org/3285/tutorial/basics.html (4 of 6) [9/12/2001 3:42:03 PM]

Page 255: POV Ray Tutorial

are all treated the same by POV-Ray.

Ordering means the order in which you declare objects. POV-Ray does not care where in the file theobjects are -- it makes no difference to the final scene. (VRML programmers will note that this is a verydifferent approach than VRML's "virtual pen" concept). This does not hold entirely true for someattributes and CSG operations (both of which we will describe in detail later), but in the outer-most levelin POV-Ray (the one in which you list the objects in your scene) it doesn't matter.

Comments in POV-Ray Source Code

Comments are another useful part of POV-Ray source code. A comment is a portion of text thatPOV-Ray will ignore. It is used to add information to the source code, usually to make things clearer tothe human reader. Comments can be enclosed in /* and */, or, for single-line comments, can be prefixedwith a //. For example:

// this is a single-line comment/* this is another comment. it can be as long as you want it to be */

C and C++ programmers will recognized this comment style. For a detailed description of comments, seethe comments section of the Language Reference.

Including files

Including files is a feature of many languages that makes re-using code easier. If you have, for example,many red objects in your scene, you will find it cumbersome (and not very readable) to type the correctRGB vector for red every time. POV-Ray comes to the rescue with a file full of pre-defined colors,which you can use and re-use in your source code. (POV-Ray also comes with files of textures and evenobjects; we'll get to those later). You can take advantage of these files by adding the string #include"filename" to the beginning of your file. For example, to use the pre-defined colors, you would add thestring

#include "colors.inc"

to the beginning of your file. Technically, the statement does not have to occur at the beginning of thefile, but the convention is such, and it makes for readability.

The example statement above tells POV-Ray to look for the file called colors.inc and to read it beforecontinuing to the rest of your file. colors.inc defines many colors, such as Red, that you can use in yourfile any time you need a color, in place of a RGB (or RGBF) vector. This makes your source file mucheasier to read. Later in the tutorial, you will learn how to define your own colors (and objects, andtextures, and so on) and how to put them in your own text files. For now, know how to use the providedones and be happy.

Now that you've got that out of the way, you're ready to start creating your first scene... almost.

The Online POV-Ray Tutorial: POV-Ray Basics

http://library.thinkquest.org/3285/tutorial/basics.html (5 of 6) [9/12/2001 3:42:03 PM]

Page 256: POV Ray Tutorial

Top of Document MainPage

Step 1: Introduction toPOV-Ray and Ray-tracing

Step 3: CreatingSimple Scenes

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: POV-Ray Basics

http://library.thinkquest.org/3285/tutorial/basics.html (6 of 6) [9/12/2001 3:42:03 PM]

Page 257: POV Ray Tutorial

JumpPoints

Main Page

IntroductionBasics

Simple ScenesAdvanced

Conclusion

Language ReferenceGlossary / Index

Texture LibraryObject LibraryScene Library

Resource Library

Color ToolNormal ToolFinish Tool

Note: this frame isresizeable

The Online POV-Ray Tutorial

POV-Ray Basics(Show Jump Points) (Hide Jump Points)

Before you can start creating scenes in POV-Ray, you need to know a few things: how todescribe objects in three dimensions, some of POV-Ray's basic notation, and other stuff.This section will give you the background knowledge you'll need to get started.

Quick reference:

POV-Ray's Coordinate System1.

Vectors in POV-Ray2.

How to describe color: RGB and RGBF Vectors3.

Normal Vectors4.

POV-Ray Source Code5.

Comments in POV-Ray Source Code6.

Including files7.

POV-Ray's Coordinate System

The source code file, the file POV-Ray takes as input, is really one big list of descriptions ofobjects. The very first thing we need in order to describe objects is a way of tellingPOV-Ray where things go. Such a method is called a coordinate system. If you have takenelementary algebra, you will already have experience with a simple coordinate system: atwo-dimensional (or 2D) Cartesian coordinate system. A quick graph of a 2D Cartesianplane looks something like this:

Any position on this graph can be specified by a set of coordinates, usually written in theform (x,y). The x coordinate corresponds to its position along the horizontal, or x, axis, andthe y coordinate corresponds to its position along the vertical, or y axis. For example, (0,0)corresponds to the point in the middle of the graph, or the origin. The point (1,3)corresponds to the point on the graph one unit right from the origin, and three units up fromthe origin. Negative numbers can also be used: (-6,4) corresponds to the point 6 units leftfrom the origin, and four units up. You get the idea.

Now this is all well and good, but when we look at things other than our computer screen,we notice we can observe three dimensions, not two: in other words, we describe objects notjust by how far to the right (or left) and how high (or low) they are, but also how close theyare in front (or in back) of you. In other words, to be able to describe a real scene toPOV-Ray, we need, in addition to the x and y coordinates, a third coordinate. This

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/basics_frames.html (1 of 5) [9/12/2001 3:42:40 PM]

Page 258: POV Ray Tutorial

coordinate is called (surprisingly enough) the z coordinate.

The coordinate system that POV-Ray uses, then, is called a three-dimensional (or 3D)Cartesian coordinate system. A quick graph looks like this:

(You have to use your imagination somewhat: that third axis is not a diagonal but isperpendicular to your computer screen -- imagine it shooting out at your face). As you cansee, it looks similar to the 2D graph, except that one additional axis has been added: the zaxis. Because of the additional possible direction, points in this coordinate system must bedescribed in the form (x,y,z). The point (0,0,0) corresponds to the origin, or center of thegraph, and (1,-2,7) corresponds to the point one unit to the right of, two units below, andseven units behind the origin.

If you have experience with mathematical 3D coordinate systems, you will notice that theaxes are labelled slightly differently than the system most commonly used in mathematicalterms. The axis we have drawn above is not fixed in POV-Ray -- the way the axis looks (interms of which axes are which) really depends on where you place your camera inPOV-Ray. We'll get to explaining the camera soon. For now, just understand that the labelson the axes may change, depending on how you position your camera.

The 3D graph above represents a coordinate system that POV-Ray can use. Visualizingobjects and scenes in three dimensions can be tricky. Often, a pad of paper and a pencil canbe extremely valuable tools, especially in more complex scenes. Alternatively, you can takea look at the Resource Library for some graphical tools that may help.

Vectors in POV-Ray

POV-Ray calls the number triples that define positions position vectors. The term vectorrefers to any group of numbers describing a certain thing -- there are color vectors andnormal vectors, for example, in addition to position vectors.

In POV-Ray, vectors are surrounded by angle brackets (that's < and >). For example, tospecify the origin in terms that POV-Ray understands, we would say <0,0,0>.

The magnitude of a vector can be thought of as the "length" of the vector. Imagine a linefrom the origin to the point in the coordinate system represented by your vector. Themagnitude is the length of this line. (If you really care about the math, the magnitute can becomputed as the square root of the sum of the squares of the elements of the vector -- butdon't worry, you probably won't have to know that).

An important thing to know about is a POV-Ray feature called vector promotion. Vectorpromotion is when a single number is substituted in place of a vector. The single number isthen promoted to a vector, one with all elements equal to that number. For example,promoting the number 2 to a three-dimensional vector would result in the vector <2,2,2>.Vector promotion is done automatically for you by POV-Ray in most cases -- just put in a

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/basics_frames.html (2 of 5) [9/12/2001 3:42:40 PM]

Page 259: POV Ray Tutorial

single number instead of a vector. This feature allows you to quickly specify similar vectors.

How to describe color: RGB and RGBF Vectors

Much as any position within the scene can be specified by a three-element vector, so can anycolor. In describing a position, each coordinate in the vector corresponds to the positionalong a particular axis. In describing a color, each element of the vector corresponds to theamount of a primary color -- red, green and blue. Such a vector is called a RGB vector (forred green blue vector).

In a position vector, the individual elements can be any real number at all (actually, this isn'tquite true -- there are upper and lower limits set by the hardware constraints of yourcomputer). In a RGB vector, the numbers should be between 0.0 and 1.0. You can havevalues higher that 1.0, but they don't correspond to any physical property (what's greenerthan green?). A value of 1.0 means 100% of that color. For example, the color black, whichis actually the absence of all color, is described by the color vector <0,0,0>. The color white,a complete combination of all three primary colors, is specified by the color vector <1,1,1>.Try experimenting with the Color Tool to find the color vectors for particular colors -- it willhelp you get a good "feel" for describing colors in terms of POV-Ray color vectors.

In addition to RGB vectors, you can specify a color in POV-Ray with an RGBF vector. Asyou might guess, a RGBF vector is like a RGB vector, but with one extra element - the F,for filter. The filter value specifies how transparent the pigment is, ranging from 0.0 (nottransparent at all) to 1.0 (100% transparent). RGB vectors have an implied filter value of 0.0-- in other words, a color specified by a RGB vector will be perfectly opaque. A filter valueof 1.0 means that all light will be let through, but the light will still be filtered. For example,the RGBF vector <1,0,0,1> acts like red cellophane -- 100% of light is passed through, but itis filtered by the red pigment. RGBF vectors can be a little confusing at first, but they aren'ttoo difficult once you get the hang of it.

These are the most commonly-used ways of specifying color. There are a few more ways todo it; if you want to read about them, look at the color section of the Language Reference.

Normal Vectors

Occasionally you will be called upon to specify a normal vector in POV-Ray. Simply put, anormal vector is a vector parallel to a given plane in three dimensions. Imagine a flat sheetof paper. If you were to poke a pencil all the way through it so that the end of the pencil wastouching the paper and the pencil was standing straight up (with respect to the paper), thepencil would represent the normal vector to the paper. In the picture below, the normalvector is in red and the plane is in blue.

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/basics_frames.html (3 of 5) [9/12/2001 3:42:40 PM]

Page 260: POV Ray Tutorial

Note that the magnitude of normal vectors is not important (as long as it is non-zero). This isbecause normal vectors are used to specify an orientation, not a distance.

POV-Ray is kind enough to automatically define three normal vectors for you: x(corresponding to <1,0,0>), the normal vector for a plane lying along the y and z axes, y(corresponding to <0, 1, 0>), the normal vector for a plane lying along the x and z axes, andz (corresponding to <0, 0, 1>), the normal vector for a plane lying along the x and y axes.Any time you are asked for a normal vector (or any vector, really) you can substitute thoseletters.

POV-Ray Source Code

Source code is the name for the text you give to POV-Ray. POV-Ray reads the source codefile and outputs an image. There are two things you need to know about POV-Ray sourcecode:

POV-Ray source code is case sensitive1.

POV-Ray ignores whitespace2.

Ordering is unimportant3.

Case sensitive means that upper and lower-case letters are not treated as the same byPOV-Ray. For example, to POV-Ray, sphere is not the same as Sphere and is not the sameas SpHeRe. Whitespace is the common name for any characters you can't directly see onscreen -- spaces, tab characters (the invisible characters put there when you press the Tabkey), carriage returns and line feeds (the invisible characters put there when you hit theEnter key). Between any two words or symbols in your source code, POV-Ray doesn't carewhether you put one space, two spaces, one hundred spaces, a new line, or any otherwhitespace.

For example, the phrase:

one two

the phrase

one two

and the phrase

onetwo

are all treated the same by POV-Ray.

Ordering means the order in which you declare objects. POV-Ray does not care where inthe file the objects are -- it makes no difference to the final scene. (VRML programmers willnote that this is a very different approach than VRML's "virtual pen" concept). This does nothold entirely true for some attributes and CSG operations (both of which we will describe indetail later), but in the outer-most level in POV-Ray (the one in which you list the objects inyour scene) it doesn't matter.

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/basics_frames.html (4 of 5) [9/12/2001 3:42:40 PM]

Page 261: POV Ray Tutorial

Comments in POV-Ray Source Code

Comments are another useful part of POV-Ray source code. A comment is a portion of textthat POV-Ray will ignore. It is used to add information to the source code, usually to makethings clearer to the human reader. Comments can be enclosed in /* and */, or, forsingle-line comments, can be prefixed with a //. For example:

// this is a single-line comment/* this is another comment. it can be as long as you want it to be */

C and C++ programmers will recognized this comment style. For a detailed description ofcomments, see the comments section of the Language Reference.

Including files

Including files is a feature of many languages that makes re-using code easier. If you have,for example, many red objects in your scene, you will find it cumbersome (and not veryreadable) to type the correct RGB vector for red every time. POV-Ray comes to the rescuewith a file full of pre-defined colors, which you can use and re-use in your source code.(POV-Ray also comes with files of textures and even objects; we'll get to those later). Youcan take advantage of these files by adding the string #include "filename" to the beginningof your file. For example, to use the pre-defined colors, you would add the string

#include "colors.inc"

to the beginning of your file. Technically, the statement does not have to occur at thebeginning of the file, but the convention is such, and it makes for readability.

The example statement above tells POV-Ray to look for the file called colors.inc and to readit before continuing to the rest of your file. colors.inc defines many colors, such as Red, thatyou can use in your file any time you need a color, in place of a RGB (or RGBF) vector.This makes your source file much easier to read. Later in the tutorial, you will learn how todefine your own colors (and objects, and textures, and so on) and how to put them in yourown text files. For now, know how to use the provided ones and be happy.

Now that you've got that out of the way, you're ready to start creating your first scene...almost.

Top of Document MainPage

Step 1: Introduction toPOV-Ray and

Ray-tracing

Step 3:Creating

Simple Scenes

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/basics_frames.html (5 of 5) [9/12/2001 3:42:40 PM]

Page 262: POV Ray Tutorial

The Online POV-Ray Tutorial

Creating Simple Scenes(Show Jump Points) (Hide Jump Points)

The POV-Ray language is fairly easy to use, once you understand it. In fact, if you have any experiencewith programming, you will find POV-Ray very easy -- there are no variables, conditionals, loops, oranything else that can make programming tricky. Basically, a POV-Ray source file (the file you makeand give to POV-Ray) is just a list of objects and their descriptions. Of course, describing the scene youhave in your mind to POV-Ray is the tricky part, because you have to speak POV-Ray's language.

Quick index:

Creating simple objects1.

The Camera2.

Let there be light! (Light sources)3.

The first example scene4.

Transformations5.

Texture6.

Pigment7.

Finish8.

Normal9.

Including Textures10.

Creating simple objects

The building blocks of all POV-Ray objects and scenes are called primitives. Primitives are objects thatPOV-Ray already knows about, and all you have to do is describe a few attributes. POV-Ray primitivesare usually simple geometric shapes such as spheres, cubes, and cones.

Describing primitives, in general, take this form in POV-Ray:

Object_Name { Object_Parameters Some_Simple_Attribute Some_Other_Simple_Attribute Some_Complex_Attribute { Some_Attribute Some_Other_Attribute }

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (1 of 15) [9/12/2001 3:43:37 PM]

Page 263: POV Ray Tutorial

}

This isn't very enlightening. Let's take a look at a short example:

sphere { <0, 0, 0>, 5 pigment { color rgb <1, 0, 0> }}

Deciphering what this does isn't too tricky. The code defines a sphere with its center at the origin (that's<0,0,0>, remember?) and with a radius of 5 (in other words, the distance from the center of the sphere toany point on the edge of the sphere is exactly 5 units). The phrase pigment { color rgb <1,0,0> } simplymeans that the sphere's pigment (or color) attribute is described by the rgb vector <1,0,0>, which is thecolor red. You could have just as well used color Red, if you had #included the correct file. The pigmentattribute, by the way, is a complex attribute, of which color is just one of the many attributes that can goinside it.

There are two types of primitives in POV-Ray: finite primitives and infinite primitives. Finite primitiveshave well-defined limits. Examples of finite primitives include spheres, cones, torii, and blobs. Infiniteprimitives have components that can potentially stretch to infinity -- for example, a plane is bothinfinitely thin and infinitely wide. Examples of infinite objects include planes, quadrics and cubics. Atany rate, describing primitives in POV-Ray is only a matter of knowing the syntax for the particularprimitive you want to describe. You can find a complete syntax reference in the finite object and infiniteobject language references.

By now, you're probably itching to make your first scene. Before you can do that, however, you need tolearn about two things: the camera and light sources.

The Camera

Before POV-Ray can generate the scene, it needs to know from where you are looking. If you imagineyour computer screen as the camera taking a snapshot of the scene you're describing, you'll see POV-Rayneeds to know a) where the camera is in the scene, and b) which direction it's pointing. Such data is givento POV-Ray through the camera object. As you might imagine, the camera object is a rather importantone: in fact, POV-Ray requires that there be one and only one in each scene.

There are many attributes that the camera object can have; of these, we will only concentrate on the twomost useful: the location and the look_at attributes. A complete reference of all the camera attributes canbe found in the Camera Reference.

A simple camera in POV-Ray looks like this:

camera { location <2,5,-10>

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (2 of 15) [9/12/2001 3:43:37 PM]

Page 264: POV Ray Tutorial

look_at <0,0,0>}

This example defines a camera located at <2,5,-10> and pointing at the origin. This means that anythingwith a z coordinate less than -10 will definately be invisible -- it will be behind the camera!

You can put the camera anywhere you want in the scene, including inside of objects (although you maynot see very much), with one exception: you may not place the camera directly over the origin and haveit looking straight down. For complex mathematical reasons, this will cause POV-Ray to generate anerror. If you need that type of setup, position the camera a little to the left or the right -- your problemwill be solved, and your scene will look (almost) exactly the same.

Anyways, now that we have a way of receiving light, we need to have a way of providing light.

Let there be light! (Light sources)

If you gave POV-Ray a file containing the camera definition above and the sphere definition before that,the output image would be a lovely blank picture. This would happen because you'd have no light in yourscene. To add light (thereby enabling you to actually see something), you need to add a light source.

There are a few different types of light sources in POV-Ray. We will concentrate here on the mostsimple (and useful): the point light source. A point light source can be thought of as an infinitely smallobject that emits light. Because they are infinitely small, point light sources cannot be directly seen (soyou don't have to worry about them appearing in your scene). However, their effects can certainly beseen: your scene lights up!

Point light sources as known as non-attenuating light sources: the emitted light does not get weaker withdistance. This means that you can illuminate your entire scene with one point light source placed faraway from the scene. You can have as many light sources as you want, but they are computationallyexpensive -- the more you have, the longer POV-Ray will take to trace your scene.

An example of a simple point light source definition in POV-Ray looks like this:

light_source { <0,10,-10> color rgb <1,1,1>}

The first vector is a position vector specifying the location of the light source. The second vectorspecifies the color (and brightness) of the light. It is generally a good idea to use white or gray light, asusing colored light can have side effects that are not immediately obvious (for example, green objectswill not show up when exposed to pure red light). Complete information for light sources can be found inthe lights section of the Language Reference.

Anyways, now that we can add light, we're ready to construct our first full scene.

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (3 of 15) [9/12/2001 3:43:37 PM]

Page 265: POV Ray Tutorial

The first example scene

Putting together all we have learned to far, we get a complete POV-Ray source code file that looks likethis:

// This is a simple red sphere

// first, the camera positioncamera { location <2,5,-10> look_at <0,0,0>}

// now, some lightlight_source { <0,-10,0> color rgb <1,1,1>}

// the spheresphere { <0,0,0>, 5 pigment { color rgb <1,0,0> }}

After running POV-Ray, the output image looks like this:

Finally! Your first image! Of course, this one is a little boring -- but don't worry, we'll get to some funstuff soon. For now, experiment! It's the best way to learn. Try replacing the sphere with other objectsand seeing what happens. The objects that you should easily be able to use are boxes, cones, cylinders,spheres, torii and planes.

Transformations

So now we can create some simple objecs. But wait! Some of these objects can only be created aroundthe origin (like the torus). What if we want to put them somewhere else? What if we want to move themaround? POV-Ray provides answers to all these questions in the form of transformations.

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (4 of 15) [9/12/2001 3:43:37 PM]

Page 266: POV Ray Tutorial

Transformations, in ray-tracing terms, are attributes that change the position, size or orientation ofobjects (and of the various attributes of the objects). The most common types of transformations, and theones that POV-Ray supports, are translations, rotations and scalings.

A translation is a transformation that moves an object relative to its current position. It is specified inPOV-Ray by the phrase translate <x,y,z>. Translations are easy to visualize. Consider a cube sitting onthe origin, like this:

Our camera is positioned so that the x axis increases to the right, the y axis increases upwards and the zaxis increases towards us. A translation of <-1,4,2> results in the cube being moved left one unit, up four,and back two, like this:

A rotation is a transformation that changes the orientation of an object (the way that it's facing).Rotations are the most complex of the transformations. They are specified to POV-Ray by the stringrotation <x,y,z>, where x, y, and z are the number of degrees (not radians) around the respective axis.Consider the original cube up above. A rotation of <0,0,45> rotates the cube 45 degrees around the zaxis, leaving us with a cube looking like this:

A quick way to remember which way the objects are going to rotate is by usings the so-called "left handrule." Hold out your left hand, fingers clenched and thumb out. Point your thumb in the positive directionof the axis you are rotating about (if you're rotating about more than one axis at a time, this won't helpyou -- unless you have more than one thumb!) The direction that your fingers curl is the direction an

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (5 of 15) [9/12/2001 3:43:37 PM]

Page 267: POV Ray Tutorial

object will rotate when the number of degrees is positive. (Negative degrees rotate the oppositedirection).

Another important thing to remember about rotations is that they are always with respect to thecoordinate axes -- in other words, unless your object is located at the origin, it will orbit around the axis(or axes) you are rotating it about. For example, this is what would happen if we translated the cube first,and then rotated it:

To get around this, make sure you rotate your object when its centered at the origin, and then translate it.Your picture will end up like this:

Transformations are one of the few aspects of POV-Ray in which the order matters, simply becausetransformations are always made with respect to the object's current orientation.

The last translation you need to know about is scaling. Simply enough, scaling changes the size of theobject with respect to its current size. Scaling is specified in POV-Ray via the string scale <x,y,z>. Theelements of the vector specify the how much to scale the shape with respect to the coordinate axis: ascale of 1.0 leaves the object the same, and a scale of 0.0 or less is invalid. Going back to our originalcube, if we scaled the object with the string scale <1,4,1>, we would get a result like this:

Because of vector promotion (if you don't remember what that is, you can re-read about it), scaling canalso take a single number rather than a vector. This causes the object to be scaled in every direction by

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (6 of 15) [9/12/2001 3:43:37 PM]

Page 268: POV Ray Tutorial

that number. For example, the phrase scale 2 is the same as the phrase scale <2,2,2>.

Transformations are placed like any other attribute. For example:

torus { 3, 11 pigment { color Yellow } scale <1.5,1,1> rotate <-45,0,0> translate <0,2,0>}

This code makes a yellow torus, slightly widened around the x axis, rotated -45 degrees around the x axisand with its center at <0,2,0>, like this:

Note that torus objects are created around the origin, so you are in fact forced to use transformations toget them where you want... luckily for you, you now know how. And to quote G. I. Joe, knowing is halfthe battle.

Texture

We admit it -- we lied to you. The pigment attribute is actually a part of a bigger attribute called thetexture attribute. Every time you used pigment, it should have really looked like this:

texture { pigment { color Red }}

The reason that POV-Ray is a little loose about the pigment attribute and lets you use it outside of textureis because pigment is so frequently used by itself that it becomes a pain to type out the whole texturestatement. In fact, most parts of the texture { } block you can do the same thing with. Either way, theyhave the same effect.

The texture attribute contains attributes describing the outward appearance of the object: pigment, finishand normal. The pigment attribute, as you know, describes the color of the object (although it's a lot morecomplicated than what we've shown you so far). The finish attribute describes how the object "interactswith light" -- highlighting, metallic luster, shinyness, reflectivity, etc. The normal attribute describessome three-dimensional features of objects, such as bumps, waves, and ripples. We'll cover these one by

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (7 of 15) [9/12/2001 3:43:37 PM]

Page 269: POV Ray Tutorial

one.

Pigment

You've seen the use of the color attribute within the pigment attribute (for example, pigment { color Blue}). A more complete description that what we've given you so far can be found in the Color section of theLanguage Reference. A more flexibe attribute, however, is color_map. color_maps are used to do a widevariety of things. Basically, a color_map defines bands of color on a "map" ranging from 0.0 to 1.0 Let'slook at a simple example:

color_map { [0.0 color Red] [0.25 color Blue] [0.9 color Green]}

This defines three bands of color: red from 0.0 to 0.25, blue from 0.25 to 0.9, and green from 0.9 to 1.0.The other commonly used format looks like this:

color_map { [0.0 0.25 color Red] [0.25 0.9 color Blue] [0.9 1.0 color Green]}

They both do the same thing; the second one just contains information about where you want the bandsto stop as well as start.

The next step is tell POV-Ray what to do with this. This is done by using of the many pigment types. Asimple pigment type is called gradient. Gradient creates bands of color based on the color map. Using thesource code from the first scene we created, and replacing the color Red with our color map and pigmenttype, we get this:

sphere { <0,0,0>, 5 pigment { gradient <0, 1, 0> color_map { [0.0 color Red] [0.25 color Blue] [1.0 color Green] } scale 3 }}

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (8 of 15) [9/12/2001 3:43:37 PM]

Page 270: POV Ray Tutorial

This source code requires a bit of explaining. The vector following the gradient keyword is the normalvector to the orientation of the bands of color (you remember normal vectors, don't you? Or did you thinkwe were wasting our time telling you stuff you didn't need to know? Admit it! You skipped over thatsection! Well, we're forgiving; you can go back and read about it again). The scale statement applies tothe pigment, not to the object (look carefully at where it's placed -- inside the pigment { } block).

Our sphere now looks like this:

A careful examination of this image yields some interesting facts. Starting from the top down, you cansee a slight bit of green (the rest of it was cut off), which fades into the the large blue band, which in turnfades into the small red band. The red band is abruptly cut off and the cycle repeats itself again.However, the next time, the pattern has reversed! The red band is on the top. This is because gradientpatterns reverse themselves at the origin. To get around this, you can translate the texture away from theorigin (you can apply all transformations to textures, remember?). More information on gradients can befound in the gradient section of the Language Reference.

Ok, now let's try something else. Add the phrase turbulence 0.5 after the gradient statement. Theresulting picture looks like this:

Whoah! The turbulence keyword, as you may have guessed, "mixes stuff up." With this color map, weget a freakish plasma-like sphere. Values for turbulence range from 0.0 to 1.0. A complete descriptioncan be found in the turbulence section of the Language Reference.

There are many other pigment types than gradient. For example, there is a pigment type called marble.By itself, rather boring and un-marble-like. However, with a high turbulence, it can create some veryrealistic marble pigments. Here's some sample source code:

sphere { <0,0,0>,5 pigment {

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (9 of 15) [9/12/2001 3:43:37 PM]

Page 271: POV Ray Tutorial

marble turbulence 1 // full turbulence color_map { [0.0 color Gray90] // 90% gray [0.8 color Gray60] // 60% gray [1.0 color Gray20] // 20% gray } }}

This high-turbulence marble pigment generates some very nice-looking marble:

Not too shabby, huh? Other pigment types include wood, agate, bozo, and a host of others that can befound in the pigment section of the Language Reference. And although technically not pigment types perse, you may want to check out the checker and hexagon pigment patterns, as well as the image mappattern (which lets you map an external image to an object), all found in the same section as above. Andremember, the best way to learn is to experiment!

Finish

Finish describes how the objects interact with light: how much they reflect, how they shine, how metallicthey are, etc. All finish attributes are enclosed in a finish { } block.

Perhaps the most used of the finish attributes is the phong attribute. A phong is a highlight, or glare. It isspecified, strangely enough, by the phong attribute, followed by a number between 0.0 and 1.0 thatspecifies how bright the phong is. There is also a phong_size that controlls how "tight" the phong is -- inother words, the higher this number, the smaller in size the phong is (this is a little misleading, yes). Herewe have a green sphere with a phong highlight of 1.0:

sphere { <0,0,0>, 5 pigment { color rgb <1,1,0> } finish { phong 0.8 }}

When lit by two light sources, the sphere looks like this:

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (10 of 15) [9/12/2001 3:43:37 PM]

Page 272: POV Ray Tutorial

As you can see, the phong adds a nice bit of realistic "shine" whenever a light source directly hits part ofthe object. A more complete description of phong can be found in the phong section of the LanguageReference.

Another finish attribute that can produce stunning effects is the reflection keyword. This causes objectsto reflect their surroundings to a certain degree. Reflection takes one number, ranging from 0.0 to 1.0,that specifies how reflective the object is. Let's take a look at a more complex scene with a reflectiveobject.

#include "colors.inc"

camera { location <-2, 3, -10> look_at <0, 5, 0>}

plane { // the floor y, 0 // along the x-z plane (y is the normal vector) pigment { checker color Black color White } // checkered pattern}

sphere { <0, 5, 0>, 2 pigment { color White } finish { reflection 0.9 phong 1 }}

light_source { <10, 10, -10> color White }

light_source { <-10, 5, -15> color White }

The image this produces is:

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (11 of 15) [9/12/2001 3:43:37 PM]

Page 273: POV Ray Tutorial

As you can see, this generates a yellowish mirrored sphere floating above an infinite checkerboard -- avariant of one of the standard ray-tracing scenes. A more in-depth description of reflectivity can be foundin the reflection section of the Reference manual.

The final attribute of the finish keyword we will describe here is the refraction keyword. Refraction iswhat happens when light rays passing through a translucent object get bent, causing a distortion ofeverything seen through the object. For example, if you look through a crystal ball, you will see adistorted view of whatever is behind it.

The refraction keyword takes one value. This value should either be 0.0 or 1.0, for refraction off and on,respectively. Although you can specify values in between, it is not recommended as it does notcorrespond to any known physical property. How noticeably it refracts is controlled by the ior keyword(for index of refraction), which takes a number greater than 0. The default ior of "empty space" isdefined as 1.0. So, if we wanted to create the crystal ball described above, we would use something likethis:

sphere { <0,5,0>,2 pigment { color rgbf <1,1,1,.8> } finish { reflection 0.1 refraction 1.0 ior 1.5 phong 1.0 }}

Remember your RGBF vectors? A filter value of 1.0 would mean this was an invisible sphere, certainlynot what we want. Our filter value of 0.8 gives the sphere enough definition to be visible. The imagegenerated looks like this:

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (12 of 15) [9/12/2001 3:43:37 PM]

Page 274: POV Ray Tutorial

Now we start seeing some of the true power of ray-tracing. The warped look of the checkboard pattern isdue to the refraction, the bright hightlighting is due to a phong, and a bit of reflection makes this all themore realistic. Tinting the glass would be easy: just change the color of the sphere from <1,1,1> (orwhite) to whatever color you want it tinted. Modify the filter value to make the ball more and lesstranslucent. It's fun!

There are many other finish attributes that you can play with, including metallic, ambient, and crand.We've touched on a few; for a complete reference, read the finish section of the Language Reference. Toget a good feel for most of the finish attributes, you can experiment with the Finish Tool.

Normal

The normal attribute creates some simple 3D features on your objects: bumps, ripples, waves, and thelike. It does not actually change the object; instead, it changes slightly the way light bounces off theobject and essentailly fools the eye into believing the object is a little different than it really is. As such,the effects are not 100% true to real life, but they are much, much faster than actually describing thechanges individually would be.

Let's try a bumps example. Bumps are created with (oddly enough) the bumps keyword, followed by asingle number, generally between 0.0 and 1.0, that specifies the relative size of the bumps. Here's somesource code:

cone { <0,-3,0>,1 <0,3,0>,0.1 texture { normal { bumps 1/2 scale 1/6 } pigment { color rgb <.5,.7,.2> } }}

This creates a green cone with a slightly bumpy appearance, like this:

Not to difficult, eh? Imagine how difficult it would be to model all those bumps yourself. Now, here's a

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (13 of 15) [9/12/2001 3:43:37 PM]

Page 275: POV Ray Tutorial

fun one to try -- ripples:

plane { y, -2 texture { pigment { color rgb <.1,.9,.9> } normal { ripples 0.5 } }}

The number following the ripples keyword specifies, again, the relative size of the ripples. The imagethis produces is:

Pretty nifty! The ripples keyword and its close relative, the waves keyword, can take a few modifiers thatgive a little more control than we've shown you. A complete reference can be found in the ripples sectionof the Language Reference. More normal attributes, such a dents and wrinkles, can be found in thenormal section of the same document. You can also experiment with the Normal Tool to get a feeling forthe various attributes.

Including Textures

Much like you learned how to include colors beforehand, you can also include textures. POV-Ray comeswith a file full of some very good textures, called textures.inc. Including this is the same as before:

#include "colors.inc"#include "textures.inc"

Note that you must include colors.inc before you include textures.inc, because textures.inc uses colorsfrom colors.inc.

Using an included texture is easy. To make a sphere that uses the Jade textures, for example, you wouldsay:

sphere { <-2, 4, 6>, 5.6

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (14 of 15) [9/12/2001 3:43:37 PM]

Page 276: POV Ray Tutorial

texture { Jade }}

Look through the file textures.inc for a list of the textures included. You can also look through colors.incfor a list of the colors in there.

Well, if you've managed this far, you're in good shape. Keep it up! The next section gets in to the reallyfun stuff.

Top of Document MainPage

Step 2: POV-RayBasics

Step 4: AdvancedPOV-Ray Features

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Creating Simple Scenes

http://library.thinkquest.org/3285/tutorial/simple.html (15 of 15) [9/12/2001 3:43:37 PM]

Page 277: POV Ray Tutorial

JumpPoints

Main Page

IntroductionBasics

Simple ScenesAdvanced

Conclusion

Language ReferenceGlossary / Index

Texture LibraryObject LibraryScene Library

Resource Library

Color ToolNormal ToolFinish Tool

Note: this frame isresizeable

The Online POV-Ray Tutorial

Creating Simple Scenes(Show Jump Points) (Hide Jump Points)

The POV-Ray language is fairly easy to use, once you understand it. In fact, if you have anyexperience with programming, you will find POV-Ray very easy -- there are no variables,conditionals, loops, or anything else that can make programming tricky. Basically, a POV-Raysource file (the file you make and give to POV-Ray) is just a list of objects and their descriptions.Of course, describing the scene you have in your mind to POV-Ray is the tricky part, because youhave to speak POV-Ray's language.

Quick index:

Creating simple objects1.

The Camera2.

Let there be light! (Light sources)3.

The first example scene4.

Transformations5.

Texture6.

Pigment7.

Finish8.

Normal9.

Including Textures10.

Creating simple objects

The building blocks of all POV-Ray objects and scenes are called primitives. Primitives areobjects that POV-Ray already knows about, and all you have to do is describe a few attributes.POV-Ray primitives are usually simple geometric shapes such as spheres, cubes, and cones.

Describing primitives, in general, take this form in POV-Ray:

Object_Name { Object_Parameters Some_Simple_Attribute Some_Other_Simple_Attribute Some_Complex_Attribute { Some_Attribute Some_Other_Attribute }}

This isn't very enlightening. Let's take a look at a short example:

sphere { <0, 0, 0>, 5 pigment {

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (1 of 13) [9/12/2001 3:44:25 PM]

Page 278: POV Ray Tutorial

color rgb <1, 0, 0> }}

Deciphering what this does isn't too tricky. The code defines a sphere with its center at the origin(that's <0,0,0>, remember?) and with a radius of 5 (in other words, the distance from the center ofthe sphere to any point on the edge of the sphere is exactly 5 units). The phrase pigment { colorrgb <1,0,0> } simply means that the sphere's pigment (or color) attribute is described by the rgbvector <1,0,0>, which is the color red. You could have just as well used color Red, if you had#included the correct file. The pigment attribute, by the way, is a complex attribute, of whichcolor is just one of the many attributes that can go inside it.

There are two types of primitives in POV-Ray: finite primitives and infinite primitives. Finiteprimitives have well-defined limits. Examples of finite primitives include spheres, cones, torii, andblobs. Infinite primitives have components that can potentially stretch to infinity -- for example, aplane is both infinitely thin and infinitely wide. Examples of infinite objects include planes,quadrics and cubics. At any rate, describing primitives in POV-Ray is only a matter of knowingthe syntax for the particular primitive you want to describe. You can find a complete syntaxreference in the finite object and infinite object language references.

By now, you're probably itching to make your first scene. Before you can do that, however, youneed to learn about two things: the camera and light sources.

The Camera

Before POV-Ray can generate the scene, it needs to know from where you are looking. If youimagine your computer screen as the camera taking a snapshot of the scene you're describing,you'll see POV-Ray needs to know a) where the camera is in the scene, and b) which direction it'spointing. Such data is given to POV-Ray through the camera object. As you might imagine, thecamera object is a rather important one: in fact, POV-Ray requires that there be one and only onein each scene.

There are many attributes that the camera object can have; of these, we will only concentrate onthe two most useful: the location and the look_at attributes. A complete reference of all the cameraattributes can be found in the Camera Reference.

A simple camera in POV-Ray looks like this:

camera { location <2,5,-10> look_at <0,0,0>}

This example defines a camera located at <2,5,-10> and pointing at the origin. This means thatanything with a z coordinate less than -10 will definately be invisible -- it will be behind thecamera!

You can put the camera anywhere you want in the scene, including inside of objects (although youmay not see very much), with one exception: you may not place the camera directly over theorigin and have it looking straight down. For complex mathematical reasons, this will causePOV-Ray to generate an error. If you need that type of setup, position the camera a little to the leftor the right -- your problem will be solved, and your scene will look (almost) exactly the same.

Anyways, now that we have a way of receiving light, we need to have a way of providing light.

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (2 of 13) [9/12/2001 3:44:25 PM]

Page 279: POV Ray Tutorial

Let there be light! (Light sources)

If you gave POV-Ray a file containing the camera definition above and the sphere definitionbefore that, the output image would be a lovely blank picture. This would happen because you'dhave no light in your scene. To add light (thereby enabling you to actually see something), youneed to add a light source.

There are a few different types of light sources in POV-Ray. We will concentrate here on the mostsimple (and useful): the point light source. A point light source can be thought of as an infinitelysmall object that emits light. Because they are infinitely small, point light sources cannot bedirectly seen (so you don't have to worry about them appearing in your scene). However, theireffects can certainly be seen: your scene lights up!

Point light sources as known as non-attenuating light sources: the emitted light does not getweaker with distance. This means that you can illuminate your entire scene with one point lightsource placed far away from the scene. You can have as many light sources as you want, but theyare computationally expensive -- the more you have, the longer POV-Ray will take to trace yourscene.

An example of a simple point light source definition in POV-Ray looks like this:

light_source { <0,10,-10> color rgb <1,1,1>}

The first vector is a position vector specifying the location of the light source. The second vectorspecifies the color (and brightness) of the light. It is generally a good idea to use white or graylight, as using colored light can have side effects that are not immediately obvious (for example,green objects will not show up when exposed to pure red light). Complete information for lightsources can be found in the lights section of the Language Reference.

Anyways, now that we can add light, we're ready to construct our first full scene.

The first example scene

Putting together all we have learned to far, we get a complete POV-Ray source code file that lookslike this:

// This is a simple red sphere

// first, the camera positioncamera { location <2,5,-10> look_at <0,0,0>}

// now, some lightlight_source { <0,-10,0> color rgb <1,1,1>}

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (3 of 13) [9/12/2001 3:44:25 PM]

Page 280: POV Ray Tutorial

// the spheresphere { <0,0,0>, 5 pigment { color rgb <1,0,0> }}

After running POV-Ray, the output image looks like this:

Finally! Your first image! Of course, this one is a little boring -- but don't worry, we'll get to somefun stuff soon. For now, experiment! It's the best way to learn. Try replacing the sphere with otherobjects and seeing what happens. The objects that you should easily be able to use are boxes,cones, cylinders, spheres, torii and planes.

Transformations

So now we can create some simple objecs. But wait! Some of these objects can only be createdaround the origin (like the torus). What if we want to put them somewhere else? What if we wantto move them around? POV-Ray provides answers to all these questions in the form oftransformations. Transformations, in ray-tracing terms, are attributes that change the position, sizeor orientation of objects (and of the various attributes of the objects). The most common types oftransformations, and the ones that POV-Ray supports, are translations, rotations and scalings.

A translation is a transformation that moves an object relative to its current position. It is specifiedin POV-Ray by the phrase translate <x,y,z>. Translations are easy to visualize. Consider a cubesitting on the origin, like this:

Our camera is positioned so that the x axis increases to the right, the y axis increases upwards andthe z axis increases towards us. A translation of <-1,4,2> results in the cube being moved left oneunit, up four, and back two, like this:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (4 of 13) [9/12/2001 3:44:25 PM]

Page 281: POV Ray Tutorial

A rotation is a transformation that changes the orientation of an object (the way that it's facing).Rotations are the most complex of the transformations. They are specified to POV-Ray by thestring rotation <x,y,z>, where x, y, and z are the number of degrees (not radians) around therespective axis. Consider the original cube up above. A rotation of <0,0,45> rotates the cube 45degrees around the z axis, leaving us with a cube looking like this:

A quick way to remember which way the objects are going to rotate is by usings the so-called "lefthand rule." Hold out your left hand, fingers clenched and thumb out. Point your thumb in thepositive direction of the axis you are rotating about (if you're rotating about more than one axis ata time, this won't help you -- unless you have more than one thumb!) The direction that yourfingers curl is the direction an object will rotate when the number of degrees is positive. (Negativedegrees rotate the opposite direction).

Another important thing to remember about rotations is that they are always with respect to thecoordinate axes -- in other words, unless your object is located at the origin, it will orbit aroundthe axis (or axes) you are rotating it about. For example, this is what would happen if wetranslated the cube first, and then rotated it:

To get around this, make sure you rotate your object when its centered at the origin, and thentranslate it. Your picture will end up like this:

Transformations are one of the few aspects of POV-Ray in which the order matters, simplybecause transformations are always made with respect to the object's current orientation.

The last translation you need to know about is scaling. Simply enough, scaling changes the size ofthe object with respect to its current size. Scaling is specified in POV-Ray via the string scale<x,y,z>. The elements of the vector specify the how much to scale the shape with respect to thecoordinate axis: a scale of 1.0 leaves the object the same, and a scale of 0.0 or less is invalid.Going back to our original cube, if we scaled the object with the string scale <1,4,1>, we wouldget a result like this:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (5 of 13) [9/12/2001 3:44:25 PM]

Page 282: POV Ray Tutorial

Because of vector promotion (if you don't remember what that is, you can re-read about it), scalingcan also take a single number rather than a vector. This causes the object to be scaled in everydirection by that number. For example, the phrase scale 2 is the same as the phrase scale <2,2,2>.

Transformations are placed like any other attribute. For example:

torus { 3, 11 pigment { color Yellow } scale <1.5,1,1> rotate <-45,0,0> translate <0,2,0>}

This code makes a yellow torus, slightly widened around the x axis, rotated -45 degrees around thex axis and with its center at <0,2,0>, like this:

Note that torus objects are created around the origin, so you are in fact forced to usetransformations to get them where you want... luckily for you, you now know how. And to quoteG. I. Joe, knowing is half the battle.

Texture

We admit it -- we lied to you. The pigment attribute is actually a part of a bigger attribute calledthe texture attribute. Every time you used pigment, it should have really looked like this:

texture { pigment { color Red }}

The reason that POV-Ray is a little loose about the pigment attribute and lets you use it outside oftexture is because pigment is so frequently used by itself that it becomes a pain to type out thewhole texture statement. In fact, most parts of the texture { } block you can do the same thingwith. Either way, they have the same effect.

The texture attribute contains attributes describing the outward appearance of the object: pigment,finish and normal. The pigment attribute, as you know, describes the color of the object (although

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (6 of 13) [9/12/2001 3:44:25 PM]

Page 283: POV Ray Tutorial

it's a lot more complicated than what we've shown you so far). The finish attribute describes howthe object "interacts with light" -- highlighting, metallic luster, shinyness, reflectivity, etc. Thenormal attribute describes some three-dimensional features of objects, such as bumps, waves, andripples. We'll cover these one by one.

Pigment

You've seen the use of the color attribute within the pigment attribute (for example, pigment {color Blue }). A more complete description that what we've given you so far can be found in theColor section of the Language Reference. A more flexibe attribute, however, is color_map.color_maps are used to do a wide variety of things. Basically, a color_map defines bands of coloron a "map" ranging from 0.0 to 1.0 Let's look at a simple example:

color_map { [0.0 color Red] [0.25 color Blue] [0.9 color Green]}

This defines three bands of color: red from 0.0 to 0.25, blue from 0.25 to 0.9, and green from 0.9to 1.0. The other commonly used format looks like this:

color_map { [0.0 0.25 color Red] [0.25 0.9 color Blue] [0.9 1.0 color Green]}

They both do the same thing; the second one just contains information about where you want thebands to stop as well as start.

The next step is tell POV-Ray what to do with this. This is done by using of the many pigmenttypes. A simple pigment type is called gradient. Gradient creates bands of color based on the colormap. Using the source code from the first scene we created, and replacing the color Red with ourcolor map and pigment type, we get this:

sphere { <0,0,0>, 5 pigment { gradient <0, 1, 0> color_map { [0.0 color Red] [0.25 color Blue] [1.0 color Green] } scale 3 }}

This source code requires a bit of explaining. The vector following the gradient keyword is thenormal vector to the orientation of the bands of color (you remember normal vectors, don't you?Or did you think we were wasting our time telling you stuff you didn't need to know? Admit it!You skipped over that section! Well, we're forgiving; you can go back and read about it again).The scale statement applies to the pigment, not to the object (look carefully at where it's placed --

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (7 of 13) [9/12/2001 3:44:25 PM]

Page 284: POV Ray Tutorial

inside the pigment { } block).

Our sphere now looks like this:

A careful examination of this image yields some interesting facts. Starting from the top down, youcan see a slight bit of green (the rest of it was cut off), which fades into the the large blue band,which in turn fades into the small red band. The red band is abruptly cut off and the cycle repeatsitself again. However, the next time, the pattern has reversed! The red band is on the top. This isbecause gradient patterns reverse themselves at the origin. To get around this, you can translate thetexture away from the origin (you can apply all transformations to textures, remember?). Moreinformation on gradients can be found in the gradient section of the Language Reference.

Ok, now let's try something else. Add the phrase turbulence 0.5 after the gradient statement. Theresulting picture looks like this:

Whoah! The turbulence keyword, as you may have guessed, "mixes stuff up." With this colormap, we get a freakish plasma-like sphere. Values for turbulence range from 0.0 to 1.0. Acomplete description can be found in the turbulence section of the Language Reference.

There are many other pigment types than gradient. For example, there is a pigment type calledmarble. By itself, rather boring and un-marble-like. However, with a high turbulence, it can createsome very realistic marble pigments. Here's some sample source code:

sphere { <0,0,0>,5 pigment { marble turbulence 1 // full turbulence color_map { [0.0 color Gray90] // 90% gray [0.8 color Gray60] // 60% gray [1.0 color Gray20] // 20% gray } }}

This high-turbulence marble pigment generates some very nice-looking marble:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (8 of 13) [9/12/2001 3:44:25 PM]

Page 285: POV Ray Tutorial

Not too shabby, huh? Other pigment types include wood, agate, bozo, and a host of others that canbe found in the pigment section of the Language Reference. And although technically not pigmenttypes per se, you may want to check out the checker and hexagon pigment patterns, as well as theimage map pattern (which lets you map an external image to an object), all found in the samesection as above. And remember, the best way to learn is to experiment!

Finish

Finish describes how the objects interact with light: how much they reflect, how they shine, howmetallic they are, etc. All finish attributes are enclosed in a finish { } block.

Perhaps the most used of the finish attributes is the phong attribute. A phong is a highlight, orglare. It is specified, strangely enough, by the phong attribute, followed by a number between 0.0and 1.0 that specifies how bright the phong is. There is also a phong_size that controlls how"tight" the phong is -- in other words, the higher this number, the smaller in size the phong is (thisis a little misleading, yes). Here we have a green sphere with a phong highlight of 1.0:

sphere { <0,0,0>, 5 pigment { color rgb <1,1,0> } finish { phong 0.8 }}

When lit by two light sources, the sphere looks like this:

As you can see, the phong adds a nice bit of realistic "shine" whenever a light source directly hitspart of the object. A more complete description of phong can be found in the phong section of theLanguage Reference.

Another finish attribute that can produce stunning effects is the reflection keyword. This causesobjects to reflect their surroundings to a certain degree. Reflection takes one number, ranging from0.0 to 1.0, that specifies how reflective the object is. Let's take a look at a more complex scenewith a reflective object.

#include "colors.inc"

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (9 of 13) [9/12/2001 3:44:25 PM]

Page 286: POV Ray Tutorial

camera { location <-2, 3, -10> look_at <0, 5, 0>}

plane { // the floor y, 0 // along the x-z plane (y is the normal vector) pigment { checker color Black color White } // checkered pattern}

sphere { <0, 5, 0>, 2 pigment { color White } finish { reflection 0.9 phong 1 }}

light_source { <10, 10, -10> color White }

light_source { <-10, 5, -15> color White }

The image this produces is:

As you can see, this generates a yellowish mirrored sphere floating above an infinite checkerboard-- a variant of one of the standard ray-tracing scenes. A more in-depth description of reflectivitycan be found in the reflection section of the Reference manual.

The final attribute of the finish keyword we will describe here is the refraction keyword.Refraction is what happens when light rays passing through a translucent object get bent, causinga distortion of everything seen through the object. For example, if you look through a crystal ball,you will see a distorted view of whatever is behind it.

The refraction keyword takes one value. This value should either be 0.0 or 1.0, for refraction offand on, respectively. Although you can specify values in between, it is not recommended as itdoes not correspond to any known physical property. How noticeably it refracts is controlled bythe ior keyword (for index of refraction), which takes a number greater than 0. The default ior of"empty space" is defined as 1.0. So, if we wanted to create the crystal ball described above, wewould use something like this:

sphere { <0,5,0>,2 pigment { color rgbf <1,1,1,.8> } finish { reflection 0.1 refraction 1.0

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (10 of 13) [9/12/2001 3:44:25 PM]

Page 287: POV Ray Tutorial

ior 1.5 phong 1.0 }}

Remember your RGBF vectors? A filter value of 1.0 would mean this was an invisible sphere,certainly not what we want. Our filter value of 0.8 gives the sphere enough definition to be visible.The image generated looks like this:

Now we start seeing some of the true power of ray-tracing. The warped look of the checkboardpattern is due to the refraction, the bright hightlighting is due to a phong, and a bit of reflectionmakes this all the more realistic. Tinting the glass would be easy: just change the color of thesphere from <1,1,1> (or white) to whatever color you want it tinted. Modify the filter value tomake the ball more and less translucent. It's fun!

There are many other finish attributes that you can play with, including metallic, ambient, andcrand. We've touched on a few; for a complete reference, read the finish section of the LanguageReference. To get a good feel for most of the finish attributes, you can experiment with the FinishTool.

Normal

The normal attribute creates some simple 3D features on your objects: bumps, ripples, waves, andthe like. It does not actually change the object; instead, it changes slightly the way light bouncesoff the object and essentailly fools the eye into believing the object is a little different than it reallyis. As such, the effects are not 100% true to real life, but they are much, much faster than actuallydescribing the changes individually would be.

Let's try a bumps example. Bumps are created with (oddly enough) the bumps keyword, followedby a single number, generally between 0.0 and 1.0, that specifies the relative size of the bumps.Here's some source code:

cone { <0,-3,0>,1 <0,3,0>,0.1 texture { normal { bumps 1/2 scale 1/6 } pigment { color rgb <.5,.7,.2> } }}

This creates a green cone with a slightly bumpy appearance, like this:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (11 of 13) [9/12/2001 3:44:25 PM]

Page 288: POV Ray Tutorial

Not to difficult, eh? Imagine how difficult it would be to model all those bumps yourself. Now,here's a fun one to try -- ripples:

plane { y, -2 texture { pigment { color rgb <.1,.9,.9> } normal { ripples 0.5 } }}

The number following the ripples keyword specifies, again, the relative size of the ripples. Theimage this produces is:

Pretty nifty! The ripples keyword and its close relative, the waves keyword, can take a fewmodifiers that give a little more control than we've shown you. A complete reference can be foundin the ripples section of the Language Reference. More normal attributes, such a dents andwrinkles, can be found in the normal section of the same document. You can also experiment withthe Normal Tool to get a feeling for the various attributes.

Including Textures

Much like you learned how to include colors beforehand, you can also include textures. POV-Raycomes with a file full of some very good textures, called textures.inc. Including this is the same asbefore:

#include "colors.inc"#include "textures.inc"

Note that you must include colors.inc before you include textures.inc, because textures.inc usescolors from colors.inc.

Using an included texture is easy. To make a sphere that uses the Jade textures, for example, youwould say:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (12 of 13) [9/12/2001 3:44:25 PM]

Page 289: POV Ray Tutorial

sphere { <-2, 4, 6>, 5.6 texture { Jade }}

Look through the file textures.inc for a list of the textures included. You can also look throughcolors.inc for a list of the colors in there.

Well, if you've managed this far, you're in good shape. Keep it up! The next section gets in to thereally fun stuff.

Top of Document MainPage

Step 2: POV-RayBasics

Step 4: AdvancedPOV-Ray Features

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/simple_frames.html (13 of 13) [9/12/2001 3:44:25 PM]

Page 290: POV Ray Tutorial

The Online POV-Ray Tutorial

Advanced POV-Ray Features(Show Jump Points) (Hide Jump Points)

If you've made it this far, you're in good shape! This section covers the features of POV-Ray that are most mostcomplex, but also the most powerful. Once you complete this section, you'll be ready a certified ray-tracing master.

Quick Index:

#declare1.

CSG

Union1.

Difference2.

Intersection3.

Merge4.

Inverse5.

2.

Advanced Objects3.

#declare

Up until now, creating large numbers of similar objects has been an excersize in cut-and-paste editor features.POV-Ray provides a very powerful, very flexible way to create many similar objects with a statement called#declare. #declare essentially creates a new type of object (or pigment, or texture, or almost anything) that you canuse and re-use whenever you like. Take a look at the following code:

#declare my_sphere =sphere { <0, 0, 0>, 5 finish { pigment rgbf <.5, .2, .4, .667> }}

What this does, essentially, is declare a new type of object called "my_sphere" which you can now use later on inyour source code, like this:

object { my_sphere translate <-2, 0, 0>}

The object statement tells POV-Ray to create an object of type "my_sphere." Theoretically, you can put objectstatements around every object you use (including primitives, like spheres) but POV-Ray only requires it for#declared objects.

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (1 of 9) [9/12/2001 3:45:14 PM]

Page 291: POV Ray Tutorial

Note that any attributes you place inside the object statement override those in the #declare statement -- in thisexample, our sphere is moved from its original location at <0,0,0> to <-2,0,0>. This hold true for pigments,finishes, etc.

VRML programmers should take note that this #declare differs somewhat from VRML's DFN node. #declare doesnot create an instance of the object (which DFN does), only the definition. In other words, the above #declarestatement would not add any objects to your scene on its own. You need to instantiate the objects (with the objectkeyword) to do that.

Now, why would you want to use #declare? Say, for example, you're making a Greek temple. You would wantmany pillars in your object, so you would create a pillar object with #declare, like this:

#declare pillar =cylinder { <0, -5, 0>, <0, 5, 0> texture { White_Marble }}

Then, you would create however many of these you needed, translating to your heart's content. Say, however, thatyou decide the columns in your temple should be made out of red marble, not white. All you have to do is changethe one #declare statement, and all the pillars change! If you had created those pillars without #declare, you'd haveto change each one by hande -- a major hassle, especially if you had 40 pillars in your temple.

So you can see one immediate benefit to #declare -- updating your scene becomes a lot easier. But wait, there'smore! You can also use #declare to create your own colors and textures. In fact, the colors.inc and textures.inc filesare basically long lists of #declared colors and textures, respectively. The syntax is intuitive:

#declare blue_green_filter = rgbf <0, .5, .5, .5>

#declare red_glass =texture { finish { refraction 1.0 reflection 0.1 ior 1.5 }

pigment { color rgbf <1, .7, .7, .7> }}

As you can most likely guess, these define a new color, called "blue_green_filter" and a new texture, called"red_glass". You would use these like this:

sphere { <0, 0, 0>, 1 pigment { blue_green_filter }}

cone { <-2, -4, 16>, 5

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (2 of 9) [9/12/2001 3:45:14 PM]

Page 292: POV Ray Tutorial

<0, -3, 1>, 1 texture { red_glass }}

Not too difficult! You can use #declare to create custom finish, normal, and pigment statements... you can even useit with vectors and single numbers, like this:

#declare PI = 3.1415926545338327950288

This will save you a bit of typing if you reference PI frequently in your scene file! (Please remember that you don'tneed to put an object statement around anything you #declare other than objects).

C and C++ programmers should not be mislead by #delare's superficial similarity to the C/C++ pre-processormacro #define. Their behaviour is quite different. #define actually changes the source code before it gets compiled(why is why it's called a pre-processor macro). POV-Ray does not have a pre-processor, and so #declare, althoughmisleadingly labeled, will not do source-code substitution.

At any rate, you can get the complete syntax for object and #declare in the Language Reference. They are bothpowerful tools, and if you create anything other than very simple scenes, you will find them invaluable.

CSG

CSG stands for Constructive Solid Geometry, a powerful technique in POV-Ray for creating new objects fromcombinations of other objects. So far, you have been limited to POV-Ray's primitives, which, while nice, aren'talways what you need. POV-Ray lets you use the primitives in a much more constructive (har har) way with CSG:you can carve away parts of objects, you can stick objects together, and other exciting stuff.

There are five operators in CSG: union, intersection, merge, difference, and inverse. The syntax of all the operators(except inverse) is very simple: it's the operator, followed by a list of two or more objects enclosed by braces, likethis:

CSG_operator { object_1 object_2 etc.}

You actually don't have to put any objects at all between the braces, but it doesn't make sense to have less than twoobjects (remember, CSG creates new objects from combinations of other objects) and POV-Ray will warn youwhen you trace the file. The syntax for inverse is even easier: it's just the word "inverse."

We'll go over these operators one by one, because they're all important. A complete reference can be found in theCSG Section of the Language Reference.

Union

A union is the easiest CSG operator to understand. It simply takes a bunch of objects, and "sticks them together." Itdoesn't actually move the objects at all, but it creates a common bond between the objects, kind of like they'vejoined a special club for important primitives. (We'll politely ignore the similarities to certain political parties). Thesource code to a sample union looks like this:

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (3 of 9) [9/12/2001 3:45:14 PM]

Page 293: POV Ray Tutorial

union { sphere { <0, 1, 2>, 3 } box { <-77, 6, 5>, <2, 3, 55> } sphere { <-2, -3, -4>, 5 }}

Now rendering the scene doesn't look any different whether you have the union keyword there or not. So whybother? Two reasons: first, you can assign attributes to the entire union of objects very easily:

union { sphere { <0, 1, 2>, 3 } box { <-77, 6, 5>, <2, 3, 55> } sphere { <-2, -3, -4>, 5 } pigment { color Blue } // applies to the entire union}

In this case, the attribute pigment { color Blue } is applied to every object in the union. As always, this works withany attribute you care to try: pigment, translations, normal, etc.

The second, and perhaps even more useful reason for using unions, is when you combine CSG and the #declarekeyword, like this:

#define two_spheres = union { sphere { <0, 0, 0>, 3 } sphere { <-1, -5, -1>, 3 }}

From now on, you can reference the object two_spheres (which is, amazingly enough, two separate spheres) just asyou would any other #declared object:

object { two_spheres pigment { color Pink } rotate <0, 180, 0>}

Let's go through one more example, to make sure you understand -- this is a very important concept. Say youwanted to ray-trace a car. You'd create the wheels, then an axle, and then use union to stick them together. Youcould then re-use this wheel and axle combination however many times you wanted (depending on how many setsof wheels your car has). Your code might look something like this:

#declare wheels_n_axle =union { object { // left wheel wheel // assuming we have already created a wheel object translate <-3, 0, 0> }

object { // axle

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (4 of 9) [9/12/2001 3:45:14 PM]

Page 294: POV Ray Tutorial

axle // assuming we have already created an axle object }

object { // right wheel wheel // assuming we have already created a wheel object translate <3, 0, 0> }}

#declare car = union { object { // front wheels and axle wheel_n_axle translate <0, 0, 5> }

object { // rear wheels and axle wheels_n_axle translate <0, 0, -5> }

// other car parts go here }

Note that the order you place objects in a union is unimportant -- objects within a union don't really care about theother objects. This is different from the objects in a difference -- they are very caring, almost loving, objects, asyou will see in the next section.

A complete description of the union operator can be found in the CSG Section of the Language Reference.

Difference

A CSG difference is much like a mathematical difference -- it subtracts objects from one another. Morespecifically, it takes chunks out of the first object, each chunk being defined by the other objects in the differencestatement. For example, say we wanted to make a wall that we would add a door to. The simplest way to do this iswith a difference:

#declare wall =difference { box { <0, 0, 0>, <10, 10, 1> } // 10x10x1 wall box { <2, 0, -1>, <6, 8, 2> } // minus a doorway texture { Wall_Texture } // assuming we have already created a Wall_Texture}

The first cube serves as the wall, and the second cube describes what, exactly, we want to take out from the wall.The two objects without the difference statement look like this:

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (5 of 9) [9/12/2001 3:45:14 PM]

Page 295: POV Ray Tutorial

When we add the difference statement, we get:

Note that we made the doorway cube thicker than the wall. Why? This is because, occasionally, POV-Ray will getconfused when you have two objects that overlay exactly the same space. So, we made the doorway cube a littlethicker, avoiding a potentially weird image, and at no loss to anything else.

One important thing to remember about differences is that all objects are subtracted from the first one. If, forexample, we wanted to add a few window holes to the wall above, we could just add a few more cubes at the veryend, and voila! Once again, any attributes placed at the end of the difference statement will apply to the entireobject.

A complete reference for the difference keyword is located in the CSG Section of the Language Reference.

Intersection

Much as a difference removes the insides of objects, a intersection removes the outsides of objects. The result ofusing the intersection operator is that the only thing remaining is the parts which all the objects within the operatorhad in common. Let's say that you want to make a single, colored, sugar-coated chocolate candy that won't melt inyour hands (not nameing any names). Furthermore, it must be a mathematically perfect candy. The easiest way todo this in POV-Ray is with an intersection, like this:

#include "colors.inc"

camera { location <0, 0, -5> look_at <0, 0, 0>}

light_source { <10, 10, -10> color White }

intersection {

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (6 of 9) [9/12/2001 3:45:14 PM]

Page 296: POV Ray Tutorial

sphere { <0, -1, 0>, 2 } sphere { <0, 1, 0>, 2 }

pigment { color Yellow }}

This code takes two spheres that overlap, like this:

Then, it uses the intersection operator to remove everything that isn't overlapping, leaving an a remarkablysweet-looking goody, like this:

Although intersections are a little more difficult to imagine than some of the other CSG operators, they can be avery powerful tool. You can find a complete reference in the intersection section of the Language Reference.

Merge

Merge is very similar to union. In fact, the only difference between the two is that, if the objects actually overlap,merge will make the interior a smooth, continuous unit. Now, obviously, this won't make a difference to you ifyour objects aren't opaque. But if you have transparent, overlapping objects in your scene, the original objectboundaries will be shown if you use a union (or no CSG at all); to get around this, you muts use merge.

A complete reference for the merge operator can be found in the CSG Section of the Language Reference.

Inverse

Inverse is not used very often, but there are times when it must be used. Inverse will take your object and reversewhat POV-Ray considers to be its "inside" and "outside." This will make no difference to the way your objectlooks, but it makes a great deal of difference to the wayyour object acts when you use it in CSG. Consider theintersection of a sphere and a box. If the sphere is inverted (by placing the keyword invert in its definition), thenPOV-Ray will take the intersection of the box and an object defined as "the entire universe except this sphere." Ifyou think about it for a while (probaby a long while), you'll realize that that's the same as a difference. In other

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (7 of 9) [9/12/2001 3:45:14 PM]

Page 297: POV Ray Tutorial

words, this:

intersection { box { <0,0,0>,<1,1,1> } sphere { <1,1,1>, 1 inverse }}

is the same as this:

difference { box { <0,0,0>,<1,1,1> } sphere { <1,1,1>, 1 }}

In fact, POV-Ray calculates differences using this same method. A complete reference to the inverse keyword canbe found in the CSG Section of the Language Reference.

Advanced Objects

There are times when POV-Ray's geometric primitives aren't going to be enough for you. Face it, if you want toray-trace something as complex as a human being, even CSG won't help you. In this case, there are two options leftto you:

The first is to specify your object in mathematical terms. Obviously, this will only work if

Your object can be described by an n-dimensional polynomial in 3-space;1.

You know what the heck I'm talking about; and2.

You like pain3.

What we're trying to say here is that we're not about to teach you the math necessary to specify these objects, and,furthermore, we recommend against it, unless you really know what you're doing. Of course, if you'd like to readabout the objects involved (namely, quadrics, cubics, quadrics and polys), the go right ahead. And if you can usethem, so much the better. But if you don't have the math behind it, then don't worry about it; you'll probably sleepbetter at night. We have found these objects to be of limited use.

The second option you have is to use a modelling program. What a modelling program can do is generateextremely complex objects in POV-Ray by specifying them as a whole bunch of really simple objects, normallyblobs, triangles, smooth triangles. or bicubic patches. These objects, much like the the mathematical ones above,are not generally meant for human consumption -- in other words, don't bother trying to create objects with theseby hand, because unless you really know what you're doing, you'll probably just waste a lot of time.

Instead, find a good modelling program (there are many free and shareware ones out there; try the ResourceLibrary), create the complex object in there (usually the modelling programs will have a very nice, graphicalinterface) and run POV-Ray on the file it creates. You will save a lot of time and effort.

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (8 of 9) [9/12/2001 3:45:14 PM]

Page 298: POV Ray Tutorial

Top of Document Main Page Step 3: Creating Simple Scenes Step 5: Conclusion

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Advanced POV-Ray Features

http://library.thinkquest.org/3285/tutorial/advanced.html (9 of 9) [9/12/2001 3:45:14 PM]

Page 299: POV Ray Tutorial

JumpPoints

Main Page

IntroductionBasics

Simple ScenesAdvanced

Conclusion

Language ReferenceGlossary / Index

Texture LibraryObject LibraryScene Library

Resource Library

Color ToolNormal ToolFinish Tool

Note: this frame isresizeable

The Online POV-Ray Tutorial

Advanced POV-Ray Features(Show Jump Points) (Hide Jump Points)

If you've made it this far, you're in good shape! This section covers the features of POV-Ray that are most mostcomplex, but also the most powerful. Once you complete this section, you'll be ready a certified ray-tracing master.

Quick Index:

#declare1.

CSG

Union1.

Difference2.

Intersection3.

Merge4.

Inverse5.

2.

Advanced Objects3.

#declare

Up until now, creating large numbers of similar objects has been an excersize in cut-and-paste editor features.POV-Ray provides a very powerful, very flexible way to create many similar objects with a statement called#declare. #declare essentially creates a new type of object (or pigment, or texture, or almost anything) that you canuse and re-use whenever you like. Take a look at the following code:

#declare my_sphere =sphere { <0, 0, 0>, 5 finish { pigment rgbf <.5, .2, .4, .667> }}

What this does, essentially, is declare a new type of object called "my_sphere" which you can now use later on inyour source code, like this:

object { my_sphere translate <-2, 0, 0>}

The object statement tells POV-Ray to create an object of type "my_sphere." Theoretically, you can put objectstatements around every object you use (including primitives, like spheres) but POV-Ray only requires it for#declared objects.

Note that any attributes you place inside the object statement override those in the #declare statement -- in thisexample, our sphere is moved from its original location at <0,0,0> to <-2,0,0>. This hold true for pigments,finishes, etc.

VRML programmers should take note that this #declare differs somewhat from VRML's DFN node. #declare doesnot create an instance of the object (which DFN does), only the definition. In other words, the above #declarestatement would not add any objects to your scene on its own. You need to instantiate the objects (with the objectkeyword) to do that.

Now, why would you want to use #declare? Say, for example, you're making a Greek temple. You would wantmany pillars in your object, so you would create a pillar object with #declare, like this:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (1 of 7) [9/12/2001 3:46:18 PM]

Page 300: POV Ray Tutorial

#declare pillar =cylinder { <0, -5, 0>, <0, 5, 0> texture { White_Marble }}

Then, you would create however many of these you needed, translating to your heart's content. Say, however, thatyou decide the columns in your temple should be made out of red marble, not white. All you have to do is changethe one #declare statement, and all the pillars change! If you had created those pillars without #declare, you'd haveto change each one by hande -- a major hassle, especially if you had 40 pillars in your temple.

So you can see one immediate benefit to #declare -- updating your scene becomes a lot easier. But wait, there'smore! You can also use #declare to create your own colors and textures. In fact, the colors.inc and textures.inc filesare basically long lists of #declared colors and textures, respectively. The syntax is intuitive:

#declare blue_green_filter = rgbf <0, .5, .5, .5>

#declare red_glass =texture { finish { refraction 1.0 reflection 0.1 ior 1.5 }

pigment { color rgbf <1, .7, .7, .7> }}

As you can most likely guess, these define a new color, called "blue_green_filter" and a new texture, called"red_glass". You would use these like this:

sphere { <0, 0, 0>, 1 pigment { blue_green_filter }}

cone { <-2, -4, 16>, 5 <0, -3, 1>, 1 texture { red_glass }}

Not too difficult! You can use #declare to create custom finish, normal, and pigment statements... you can even useit with vectors and single numbers, like this:

#declare PI = 3.1415926545338327950288

This will save you a bit of typing if you reference PI frequently in your scene file! (Please remember that you don'tneed to put an object statement around anything you #declare other than objects).

C and C++ programmers should not be mislead by #delare's superficial similarity to the C/C++ pre-processormacro #define. Their behaviour is quite different. #define actually changes the source code before it gets compiled(why is why it's called a pre-processor macro). POV-Ray does not have a pre-processor, and so #declare, althoughmisleadingly labeled, will not do source-code substitution.

At any rate, you can get the complete syntax for object and #declare in the Language Reference. They are bothpowerful tools, and if you create anything other than very simple scenes, you will find them invaluable.

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (2 of 7) [9/12/2001 3:46:18 PM]

Page 301: POV Ray Tutorial

CSG

CSG stands for Constructive Solid Geometry, a powerful technique in POV-Ray for creating new objects fromcombinations of other objects. So far, you have been limited to POV-Ray's primitives, which, while nice, aren'talways what you need. POV-Ray lets you use the primitives in a much more constructive (har har) way with CSG:you can carve away parts of objects, you can stick objects together, and other exciting stuff.

There are five operators in CSG: union, intersection, merge, difference, and inverse. The syntax of all the operators(except inverse) is very simple: it's the operator, followed by a list of two or more objects enclosed by braces, likethis:

CSG_operator { object_1 object_2 etc.}

You actually don't have to put any objects at all between the braces, but it doesn't make sense to have less than twoobjects (remember, CSG creates new objects from combinations of other objects) and POV-Ray will warn youwhen you trace the file. The syntax for inverse is even easier: it's just the word "inverse."

We'll go over these operators one by one, because they're all important. A complete reference can be found in theCSG Section of the Language Reference.

Union

A union is the easiest CSG operator to understand. It simply takes a bunch of objects, and "sticks them together." Itdoesn't actually move the objects at all, but it creates a common bond between the objects, kind of like they'vejoined a special club for important primitives. (We'll politely ignore the similarities to certain political parties). Thesource code to a sample union looks like this:

union { sphere { <0, 1, 2>, 3 } box { <-77, 6, 5>, <2, 3, 55> } sphere { <-2, -3, -4>, 5 }}

Now rendering the scene doesn't look any different whether you have the union keyword there or not. So whybother? Two reasons: first, you can assign attributes to the entire union of objects very easily:

union { sphere { <0, 1, 2>, 3 } box { <-77, 6, 5>, <2, 3, 55> } sphere { <-2, -3, -4>, 5 } pigment { color Blue } // applies to the entire union}

In this case, the attribute pigment { color Blue } is applied to every object in the union. As always, this works withany attribute you care to try: pigment, translations, normal, etc.

The second, and perhaps even more useful reason for using unions, is when you combine CSG and the #declarekeyword, like this:

#define two_spheres = union { sphere { <0, 0, 0>, 3 } sphere { <-1, -5, -1>, 3 }}

From now on, you can reference the object two_spheres (which is, amazingly enough, two separate spheres) just asyou would any other #declared object:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (3 of 7) [9/12/2001 3:46:18 PM]

Page 302: POV Ray Tutorial

object { two_spheres pigment { color Pink } rotate <0, 180, 0>}

Let's go through one more example, to make sure you understand -- this is a very important concept. Say youwanted to ray-trace a car. You'd create the wheels, then an axle, and then use union to stick them together. Youcould then re-use this wheel and axle combination however many times you wanted (depending on how many setsof wheels your car has). Your code might look something like this:

#declare wheels_n_axle =union { object { // left wheel wheel // assuming we have already created a wheel object translate <-3, 0, 0> }

object { // axle axle // assuming we have already created an axle object }

object { // right wheel wheel // assuming we have already created a wheel object translate <3, 0, 0> }}

#declare car = union { object { // front wheels and axle wheel_n_axle translate <0, 0, 5> }

object { // rear wheels and axle wheels_n_axle translate <0, 0, -5> }

// other car parts go here }

Note that the order you place objects in a union is unimportant -- objects within a union don't really care about theother objects. This is different from the objects in a difference -- they are very caring, almost loving, objects, asyou will see in the next section.

A complete description of the union operator can be found in the CSG Section of the Language Reference.

Difference

A CSG difference is much like a mathematical difference -- it subtracts objects from one another. Morespecifically, it takes chunks out of the first object, each chunk being defined by the other objects in the differencestatement. For example, say we wanted to make a wall that we would add a door to. The simplest way to do this iswith a difference:

#declare wall =difference { box { <0, 0, 0>, <10, 10, 1> } // 10x10x1 wall box { <2, 0, -1>, <6, 8, 2> } // minus a doorway texture { Wall_Texture } // assuming we have already created a Wall_Texture

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (4 of 7) [9/12/2001 3:46:18 PM]

Page 303: POV Ray Tutorial

}

The first cube serves as the wall, and the second cube describes what, exactly, we want to take out from the wall.The two objects without the difference statement look like this:

When we add the difference statement, we get:

Note that we made the doorway cube thicker than the wall. Why? This is because, occasionally, POV-Ray will getconfused when you have two objects that overlay exactly the same space. So, we made the doorway cube a littlethicker, avoiding a potentially weird image, and at no loss to anything else.

One important thing to remember about differences is that all objects are subtracted from the first one. If, forexample, we wanted to add a few window holes to the wall above, we could just add a few more cubes at the veryend, and voila! Once again, any attributes placed at the end of the difference statement will apply to the entireobject.

A complete reference for the difference keyword is located in the CSG Section of the Language Reference.

Intersection

Much as a difference removes the insides of objects, a intersection removes the outsides of objects. The result ofusing the intersection operator is that the only thing remaining is the parts which all the objects within the operatorhad in common. Let's say that you want to make a single, colored, sugar-coated chocolate candy that won't melt inyour hands (not nameing any names). Furthermore, it must be a mathematically perfect candy. The easiest way todo this in POV-Ray is with an intersection, like this:

#include "colors.inc"

camera { location <0, 0, -5> look_at <0, 0, 0>}

light_source { <10, 10, -10> color White }

intersection { sphere { <0, -1, 0>, 2 } sphere { <0, 1, 0>, 2 }

pigment { color Yellow }}

This code takes two spheres that overlap, like this:

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (5 of 7) [9/12/2001 3:46:18 PM]

Page 304: POV Ray Tutorial

Then, it uses the intersection operator to remove everything that isn't overlapping, leaving an a remarkablysweet-looking goody, like this:

Although intersections are a little more difficult to imagine than some of the other CSG operators, they can be avery powerful tool. You can find a complete reference in the intersection section of the Language Reference.

Merge

Merge is very similar to union. In fact, the only difference between the two is that, if the objects actually overlap,merge will make the interior a smooth, continuous unit. Now, obviously, this won't make a difference to you ifyour objects aren't opaque. But if you have transparent, overlapping objects in your scene, the original objectboundaries will be shown if you use a union (or no CSG at all); to get around this, you muts use merge.

A complete reference for the merge operator can be found in the CSG Section of the Language Reference.

Inverse

Inverse is not used very often, but there are times when it must be used. Inverse will take your object and reversewhat POV-Ray considers to be its "inside" and "outside." This will make no difference to the way your objectlooks, but it makes a great deal of difference to the wayyour object acts when you use it in CSG. Consider theintersection of a sphere and a box. If the sphere is inverted (by placing the keyword invert in its definition), thenPOV-Ray will take the intersection of the box and an object defined as "the entire universe except this sphere." Ifyou think about it for a while (probaby a long while), you'll realize that that's the same as a difference. In otherwords, this:

intersection { box { <0,0,0>,<1,1,1> } sphere { <1,1,1>, 1 inverse }}

is the same as this:

difference { box { <0,0,0>,<1,1,1> } sphere { <1,1,1>, 1 }}

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (6 of 7) [9/12/2001 3:46:18 PM]

Page 305: POV Ray Tutorial

In fact, POV-Ray calculates differences using this same method. A complete reference to the inverse keyword canbe found in the CSG Section of the Language Reference.

Advanced Objects

There are times when POV-Ray's geometric primitives aren't going to be enough for you. Face it, if you want toray-trace something as complex as a human being, even CSG won't help you. In this case, there are two optionsleft to you:

The first is to specify your object in mathematical terms. Obviously, this will only work if

Your object can be described by an n-dimensional polynomial in 3-space;1.

You know what the heck I'm talking about; and2.

You like pain3.

What we're trying to say here is that we're not about to teach you the math necessary to specify these objects, and,furthermore, we recommend against it, unless you really know what you're doing. Of course, if you'd like to readabout the objects involved (namely, quadrics, cubics, quadrics and polys), the go right ahead. And if you can usethem, so much the better. But if you don't have the math behind it, then don't worry about it; you'll probably sleepbetter at night. We have found these objects to be of limited use.

The second option you have is to use a modelling program. What a modelling program can do is generateextremely complex objects in POV-Ray by specifying them as a whole bunch of really simple objects, normallyblobs, triangles, smooth triangles. or bicubic patches. These objects, much like the the mathematical ones above,are not generally meant for human consumption -- in other words, don't bother trying to create objects with theseby hand, because unless you really know what you're doing, you'll probably just waste a lot of time.

Instead, find a good modelling program (there are many free and shareware ones out there; try the ResourceLibrary), create the complex object in there (usually the modelling programs will have a very nice, graphicalinterface) and run POV-Ray on the file it creates. You will save a lot of time and effort.

Top of Document Main Page Step 3: Creating Simple Scenes Step 5: Conclusion

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/advanced_frames.html (7 of 7) [9/12/2001 3:46:18 PM]

Page 306: POV Ray Tutorial

The Online POV-Ray Tutorial

Conclusion(Show Jump Points) (Hide Jump Points)

Well, well, well. You've come far from the beginning of the Path of Learning. We'd just like to take amonute to congratulate you on your new found skills. Congratulations. You now know the POV-Raylanguage. Anything that can be done in POV-Ray is now within your grasp. However, this is just thebeginning of your full journey through POV-Ray. This tutorial has helped as much as it can. Now all youneed is experience. The main thing that distinguishes a good POV-Ray artist from an awesome POV-Rayartist is experience with ray tracing and possibly better hardware, but that's not as important. There are agreat many ray tracing libraries on the internet and many of them include source. Check 'em out and seehow the masters do things. Then you will be well on your way to becoming a POV-Ray master yourself.

Top of Document Main Page Step 4: Advanced POV-Ray Features

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Conclusion

http://library.thinkquest.org/3285/tutorial/conclusion.html [9/12/2001 3:46:29 PM]

Page 307: POV Ray Tutorial

JumpPoints

Main Page

IntroductionBasics

Simple ScenesAdvanced

Conclusion

Language ReferenceGlossary / Index

Texture LibraryObject LibraryScene Library

Resource Library

Color ToolNormal ToolFinish Tool

Note: this frame isresizeable

The Online POV-Ray Tutorial

Conclusion(Show Jump Points) (Hide Jump Points)

Well, well, well. You've come far from the beginning of the Path of Learning.We'd just like to take a monute to congratulate you on your new found skills.Congratulations. You now know the POV-Ray language. Anything that can bedone in POV-Ray is now within your grasp. However, this is just the beginning ofyour full journey through POV-Ray. This tutorial has helped as much as it can.Now all you need is experience. The main thing that distinguishes a goodPOV-Ray artist from an awesome POV-Ray artist is experience with ray tracingand possibly better hardware, but that's not as important. There are a great manyray tracing libraries on the internet and many of them include source. Check 'emout and see how the masters do things. Then you will be well on your way tobecoming a POV-Ray master yourself.

Top of Document Main Page Step 4: Advanced POV-RayFeatures

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuestTeam

The Online POV-Ray Tutorial: The Path of Learning

http://library.thinkquest.org/3285/tutorial/conclusion_frames.html [9/12/2001 3:46:58 PM]

Page 308: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Difference Example #1A wall without a doorway.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Difference Example #1

http://library.thinkquest.org/3285/tutorial/examples/difference1.html [9/12/2001 3:47:02 PM]

Page 309: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/difference1.gif

http://library.thinkquest.org/3285/tutorial/images/difference1.gif [9/12/2001 3:47:12 PM]

Page 310: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/difference1_big.gif

http://library.thinkquest.org/3285/tutorial/images/difference1_big.gif [9/12/2001 3:48:26 PM]

Page 311: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Difference Example #2A wall with a doorway.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Difference Example #2

http://library.thinkquest.org/3285/tutorial/examples/difference2.html [9/12/2001 3:48:28 PM]

Page 312: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/difference2.gif

http://library.thinkquest.org/3285/tutorial/images/difference2.gif [9/12/2001 3:48:30 PM]

Page 313: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/difference2_big.gif

http://library.thinkquest.org/3285/tutorial/images/difference2_big.gif [9/12/2001 3:48:58 PM]

Page 314: POV Ray Tutorial

#include "colors.inc"

camera { location <-3, 10, 5> look_at <5, 5, 0>}

plane { y, 0 pigment { checker color Black color White }}

light_source { <-5, 10, 4> color White }light_source { <-3, 10, 5> color White }

difference { box { <0, 0, 0>, <10, 10, 1> } box { <2, 0, -1>, <6, 8, 2> } pigment { color Red }}

http://library.thinkquest.org/3285/tutorial/examples/src/difference2.pov

http://library.thinkquest.org/3285/tutorial/examples/src/difference2.pov [9/12/2001 3:48:59 PM]

Page 315: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Intersection Example #1Two big spheres stuck together.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Intersection Example #1

http://library.thinkquest.org/3285/tutorial/examples/intersection1.html [9/12/2001 3:49:01 PM]

Page 316: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/intersection1.gif

http://library.thinkquest.org/3285/tutorial/images/intersection1.gif [9/12/2001 3:49:11 PM]

Page 317: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/intersection1_big.gif

http://library.thinkquest.org/3285/tutorial/images/intersection1_big.gif [9/12/2001 3:49:28 PM]

Page 318: POV Ray Tutorial

#include "colors.inc"

camera { location <0, 0, -5> look_at <0, 0, 0>}

light_source { <10, 10, -10> color White }

sphere { <0, -1, 0>, 2 pigment { color Yellow } }sphere { <0, 1, 0>, 2 pigment { color Yellow } }

http://library.thinkquest.org/3285/tutorial/examples/src/intersection1.pov

http://library.thinkquest.org/3285/tutorial/examples/src/intersection1.pov [9/12/2001 3:49:31 PM]

Page 319: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Intersection Example #2The perfect bite-sized candy-coated chocolate treat.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Intersection Example #2

http://library.thinkquest.org/3285/tutorial/examples/intersection2.html [9/12/2001 3:49:32 PM]

Page 320: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/intersection2.gif

http://library.thinkquest.org/3285/tutorial/images/intersection2.gif [9/12/2001 3:49:34 PM]

Page 321: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/intersection2_big.gif

http://library.thinkquest.org/3285/tutorial/images/intersection2_big.gif [9/12/2001 3:49:43 PM]

Page 322: POV Ray Tutorial

#include "colors.inc"

camera { location <0, 0, -5> look_at <0, 0, 0>}

light_source { <10, 10, -10> color White }

intersection { sphere { <0, -1, 0>, 2 } sphere { <0, 1, 0>, 2 }

pigment { color Yellow }}

http://library.thinkquest.org/3285/tutorial/examples/src/intersection2.pov

http://library.thinkquest.org/3285/tutorial/examples/src/intersection2.pov [9/12/2001 3:49:47 PM]

Page 323: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Example Scene #1The first example scene. A red sphere.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Example Scene #1

http://library.thinkquest.org/3285/tutorial/examples/demo1.html [9/12/2001 3:49:53 PM]

Page 324: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/demo1.gif

http://library.thinkquest.org/3285/tutorial/images/demo1.gif [9/12/2001 3:49:57 PM]

Page 325: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/demo1_big.gif

http://library.thinkquest.org/3285/tutorial/images/demo1_big.gif [9/12/2001 3:50:27 PM]

Page 326: POV Ray Tutorial

// A simple red sphere

// first, the camera positioncamera { location <2,5,-10> look_at <0,0,0>}

// now, some lightlight_source { <0,10,-10> color rgb <1,1,1>}

// the spheresphere { <0,0,0>, 5 pigment { color rgb <1,0,0> }}

http://library.thinkquest.org/3285/tutorial/examples/src/demo1.pov

http://library.thinkquest.org/3285/tutorial/examples/src/demo1.pov [9/12/2001 3:50:28 PM]

Page 327: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #1Regular, un-transformed cube.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #1

http://library.thinkquest.org/3285/tutorial/examples/transform1.html [9/12/2001 3:50:29 PM]

Page 328: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform1.gif

http://library.thinkquest.org/3285/tutorial/images/transform1.gif [9/12/2001 3:50:31 PM]

Page 329: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform1_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform1_big.gif [9/12/2001 3:50:55 PM]

Page 330: POV Ray Tutorial

// A plain blue box with x/y/z axes

camera { location <5, 5, -10> look_at <0, 0, 0>}

cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 0, 1> }}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform1.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform1.pov [9/12/2001 3:50:57 PM]

Page 331: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #2Translated cube.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #1

http://library.thinkquest.org/3285/tutorial/examples/transform2.html [9/12/2001 3:51:05 PM]

Page 332: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform2.gif

http://library.thinkquest.org/3285/tutorial/images/transform2.gif [9/12/2001 3:51:06 PM]

Page 333: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform2_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform2_big.gif [9/12/2001 3:51:12 PM]

Page 334: POV Ray Tutorial

// A simple translated box with x/y/z axes.

camera { location <5, 5, -10> look_at <0, 0, 0>}

cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 0, 1> } translate <-1, 4, 2>}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform2.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform2.pov [9/12/2001 3:51:13 PM]

Page 335: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #3Rotated cube.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #3

http://library.thinkquest.org/3285/tutorial/examples/transform3.html [9/12/2001 3:51:16 PM]

Page 336: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform3.gif

http://library.thinkquest.org/3285/tutorial/images/transform3.gif [9/12/2001 3:51:17 PM]

Page 337: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform3_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform3_big.gif [9/12/2001 3:51:47 PM]

Page 338: POV Ray Tutorial

// A simple rotated box with x/y/z axes.

camera { location <5, 5, -10> look_at <0, 0, 0>}

cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 0, 1> } rotate <0, 0, 45>}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform3.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform3.pov [9/12/2001 3:51:48 PM]

Page 339: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #4Translated, then rotated, cube.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #4

http://library.thinkquest.org/3285/tutorial/examples/transform4.html [9/12/2001 3:51:50 PM]

Page 340: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform4.gif

http://library.thinkquest.org/3285/tutorial/images/transform4.gif [9/12/2001 3:51:52 PM]

Page 341: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform4_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform4_big.gif [9/12/2001 3:52:12 PM]

Page 342: POV Ray Tutorial

//A simple translated and rotated box with x/y/z axes

camera { location <5, 5, -10> look_at <0, 0, 0>}

cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 0, 1> } translate <-1, 4, 2> rotate <0, 0, 45>}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform4.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform4.pov [9/12/2001 3:52:17 PM]

Page 343: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #7Rotated, then translated, sphere.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #7

http://library.thinkquest.org/3285/tutorial/examples/transform7.html [9/12/2001 3:52:24 PM]

Page 344: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform7.gif

http://library.thinkquest.org/3285/tutorial/images/transform7.gif [9/12/2001 3:52:25 PM]

Page 345: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform7_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform7_big.gif [9/12/2001 3:52:34 PM]

Page 346: POV Ray Tutorial

// A rotated, then translated, cube, with x/y/z axes

camera { location <5, 5, -10> look_at <0, 0, 0>}

cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 0, 1> } rotate <0, 0, 45> translate <-1, 4, 2>}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform7.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform7.pov [9/12/2001 3:52:46 PM]

Page 347: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #5Scaled cube.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #5

http://library.thinkquest.org/3285/tutorial/examples/transform5.html [9/12/2001 3:52:48 PM]

Page 348: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform5.gif

http://library.thinkquest.org/3285/tutorial/images/transform5.gif [9/12/2001 3:52:52 PM]

Page 349: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform5_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform5_big.gif [9/12/2001 3:54:59 PM]

Page 350: POV Ray Tutorial

//A simple scaled box with x/y/z axes

camera { location <5, 5, -10> look_at <0, 0, 0>}

cylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

cylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}cylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

box { <-1, -1, -1>, <1, 1, 1> pigment { color rgb <0, 0, 1> } scale <1, 4, 1>}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform5.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform5.pov [9/12/2001 3:55:03 PM]

Page 351: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Transformation Example #6Scaled, translated and rotated torus.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Transformation Example #6

http://library.thinkquest.org/3285/tutorial/examples/transform6.html [9/12/2001 3:55:04 PM]

Page 352: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform6.gif

http://library.thinkquest.org/3285/tutorial/images/transform6.gif [9/12/2001 3:55:06 PM]

Page 353: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/transform6_big.gif

http://library.thinkquest.org/3285/tutorial/images/transform6_big.gif [9/12/2001 3:55:29 PM]

Page 354: POV Ray Tutorial

// A translated, scaled and rotated torus

#include "colors.inc"

torus { 3, 1 pigment { color Yellow } scale <1.5, 1, 1> rotate <-45, 0, 0> translate <0, 2, 0>}

camera { location <5, 5, -10> look_at <0, 0, 0>}

// x axiscylinder { <-50, 0, 0>, <50, 0, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

// y axiscylinder { <0, -50, 0>, <0, 50, 0>, 0.1 pigment { color rgb <0, 1, 0> }}

//z axiscylinder { <0, 0, -50>, <0, 0, 50>, 0.1 pigment { color rgb <0, 1, 0> }}

light_source { <-10, 10, -10> color rgb <1, 1, 1>}

light_source { <10, 10, -10> color rgb <1, 1, 1>}

http://library.thinkquest.org/3285/tutorial/examples/src/transform6.pov

http://library.thinkquest.org/3285/tutorial/examples/src/transform6.pov [9/12/2001 3:55:37 PM]

Page 355: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Pigment Example #1A sphere with a gradient color map.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Pigment Example #1

http://library.thinkquest.org/3285/tutorial/examples/pigment1.html [9/12/2001 3:55:39 PM]

Page 356: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/pigment1.gif

http://library.thinkquest.org/3285/tutorial/images/pigment1.gif [9/12/2001 3:56:03 PM]

Page 357: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/pigment1_big.gif

http://library.thinkquest.org/3285/tutorial/images/pigment1_big.gif [9/12/2001 3:56:41 PM]

Page 358: POV Ray Tutorial

// This is a sphere demonstrating the gradient pigment#include "colors.inc"

// first, the camera positioncamera { location <2,5,-10> look_at <0,0,0>}

// now, some lightlight_source { <0,10,-10> color White}

light_source { <0,0,-10> color White}

// the spheresphere { <0,0,0>, 5 pigment { gradient <0, 1, 0> color_map { [0.0 color Red] [0.25 color Blue] [1.0 color Green] } scale 3 // make the pigment bigger }}

http://library.thinkquest.org/3285/tutorial/examples/src/pigment1.pov

http://library.thinkquest.org/3285/tutorial/examples/src/pigment1.pov [9/12/2001 3:56:42 PM]

Page 359: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Pigment Example #2A sphere with a gradient color map and some turbulence.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Pigment Example #2

http://library.thinkquest.org/3285/tutorial/examples/pigment2.html [9/12/2001 3:56:44 PM]

Page 360: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/pigment2.gif

http://library.thinkquest.org/3285/tutorial/images/pigment2.gif [9/12/2001 3:56:47 PM]

Page 361: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/pigment2_big.gif

http://library.thinkquest.org/3285/tutorial/images/pigment2_big.gif [9/12/2001 3:58:05 PM]

Page 362: POV Ray Tutorial

// This is a sphere demonstrating the gradient pigment and turbulence#include "colors.inc"

// first, the camera positioncamera { location <2,5,-10> look_at <0,0,0>}

// now, some lightlight_source { <0,10,-10> color White}

light_source { <0,0,-10> color White}

// the spheresphere { <0,0,0>, 5 pigment { gradient <0, 1, 0> turbulence 0.5 color_map { [0.0 color Red] [0.25 color Blue] [1.0 color Green] } scale 3 // make the pigment bigger translate <0, 10, 0> }}

http://library.thinkquest.org/3285/tutorial/examples/src/pigment2.pov

http://library.thinkquest.org/3285/tutorial/examples/src/pigment2.pov [9/12/2001 3:58:09 PM]

Page 363: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Finish Example #1Sphere with phong highlights.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Finish Example #1

http://library.thinkquest.org/3285/tutorial/examples/finish1.html [9/12/2001 3:58:12 PM]

Page 364: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/finish1.gif

http://library.thinkquest.org/3285/tutorial/images/finish1.gif [9/12/2001 3:58:20 PM]

Page 365: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/finish1_big.gif

http://library.thinkquest.org/3285/tutorial/images/finish1_big.gif [9/12/2001 3:58:34 PM]

Page 366: POV Ray Tutorial

// This is a simple red sphere with phong highlights

// first, the camera positioncamera { location <2,5,-10> look_at <0,0,0>}

// now, some lightlight_source { <-7,10,-10> color rgb <1,1,1>}

light_source { <17, -10, 0> color rgb <1,1,1>}

// the spheresphere { <0,0,0>, 5 pigment { color rgb <0,1,0> } finish { phong 1 }}

http://library.thinkquest.org/3285/tutorial/examples/src/finish1.pov

http://library.thinkquest.org/3285/tutorial/examples/src/finish1.pov [9/12/2001 3:58:37 PM]

Page 367: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Finish Example #2Yellow mirrorish sphere floating above an infinite checkerboard.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Finish Example #2

http://library.thinkquest.org/3285/tutorial/examples/finish2.html [9/12/2001 3:58:38 PM]

Page 368: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/finish2.gif

http://library.thinkquest.org/3285/tutorial/images/finish2.gif [9/12/2001 3:58:45 PM]

Page 369: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/finish2_big.gif

http://library.thinkquest.org/3285/tutorial/images/finish2_big.gif [9/12/2001 3:59:41 PM]

Page 370: POV Ray Tutorial

// A yellow mirrorish sphere above a checkerboard

#include "colors.inc"

camera { location <-2, 3, -10> look_at <0, 5, 0>}

plane { // the floor y, 0 // along the x-z plane (y is the normal vector) pigment { checker color Black color White } // checkered pattern}

sphere { <0, 5, 0>, 2 pigment { color Yellow } finish { reflection 0.9 phong 1 }}

light_source { <10, 10, -10> color White }

light_source { <-10, 5, -15> color White }

http://library.thinkquest.org/3285/tutorial/examples/src/finish2.pov

http://library.thinkquest.org/3285/tutorial/examples/src/finish2.pov [9/12/2001 3:59:42 PM]

Page 371: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Finish Example #3A crystal ball.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Finish Example #3

http://library.thinkquest.org/3285/tutorial/examples/finish3.html [9/12/2001 3:59:47 PM]

Page 372: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/finish3.gif

http://library.thinkquest.org/3285/tutorial/images/finish3.gif [9/12/2001 4:00:05 PM]

Page 373: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/finish3_big.gif

http://library.thinkquest.org/3285/tutorial/images/finish3_big.gif [9/12/2001 4:01:22 PM]

Page 374: POV Ray Tutorial

// A crystal ball

#include "colors.inc"

camera { location <-2, 5, -5> look_at <0, 5, 0>}

plane { // the floor z, 10 // along the x-z plane (y is the normal vector) pigment { checker color Green color Yellow } // checkered pattern}

sphere { <0, 5, 0>, 2 pigment { color rgbf <1, 1, 1, .8> } // transparent sphere finish { reflection 0.1 refraction 1.0 ior 1.5 phong 1 }}

light_source { <10, 10, -10> color White }

http://library.thinkquest.org/3285/tutorial/examples/src/finish3.pov

http://library.thinkquest.org/3285/tutorial/examples/src/finish3.pov [9/12/2001 4:01:27 PM]

Page 375: POV Ray Tutorial

The Online POV-Ray Tutorial

Finish Exploration ToolThis tool is designed to let you experiment with different values of different finishes. To experiment witha parameter, select an option from the menu below and press "Select". Viewing "collectively" will showyou all the possible images you can view and allow you to select from them. Viewing "individually" willshow you an image and allow you to vary the amount of the finish. The images we have here do notrepresent the only allowable values for these parameters, we just chose a range of values so you could geta feel for how the parameter changes the object.

I want to experiment with and view the images

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Finish Tool

http://library.thinkquest.org/3285/cgi-bin/SelectFinish.cgi [9/12/2001 4:01:29 PM]

Page 376: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Normal Example #1A bumpy cone.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Normal Example #1

http://library.thinkquest.org/3285/tutorial/examples/normal1.html [9/12/2001 4:01:33 PM]

Page 377: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/normal1.gif

http://library.thinkquest.org/3285/tutorial/images/normal1.gif [9/12/2001 4:01:41 PM]

Page 378: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/normal1_big.gif

http://library.thinkquest.org/3285/tutorial/images/normal1_big.gif [9/12/2001 4:02:04 PM]

Page 379: POV Ray Tutorial

// A bumpy cone

// first, the camera positioncamera { location <2,2,-6> look_at <0,0,0>}

// now, some lightlight_source { <3,2,-6> color rgb <2,2,2>}

// the conecone { <0, -3, 0>, 1 <0, 3, 0>, 0.1

texture { normal { bumps 0.5 // add some bumps scale 1/6 } pigment { color rgb <.5, .7, .2> } }}

http://library.thinkquest.org/3285/tutorial/examples/src/normal1.pov

http://library.thinkquest.org/3285/tutorial/examples/src/normal1.pov [9/12/2001 4:02:05 PM]

Page 380: POV Ray Tutorial

The Online POV-Ray Tutorial

Image: Normal Example #2A blue plane with ripples.

Original Image Large Image Source Code

Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Image: Normal Example #2

http://library.thinkquest.org/3285/tutorial/examples/normal2.html [9/12/2001 4:02:06 PM]

Page 381: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/normal2.gif

http://library.thinkquest.org/3285/tutorial/images/normal2.gif [9/12/2001 4:02:13 PM]

Page 382: POV Ray Tutorial

http://library.thinkquest.org/3285/tutorial/images/normal2_big.gif

http://library.thinkquest.org/3285/tutorial/images/normal2_big.gif [9/12/2001 4:05:12 PM]

Page 383: POV Ray Tutorial

// A plane with ripples

// first, the camera positioncamera { location <-4,5,-6> look_at <0,0,0>}

// now, some lightlight_source { <3,2,-6> color rgb <2,2,2>}

plane { y, -2 texture { pigment { color rgb <.1, .9, .9> } normal { ripples 0.5 } }}

http://library.thinkquest.org/3285/tutorial/examples/src/normal2.pov

http://library.thinkquest.org/3285/tutorial/examples/src/normal2.pov [9/12/2001 4:05:13 PM]

Page 384: POV Ray Tutorial

The Online POV-Ray Tutorial

Normal Exploration Tool

This tool is designed to let you experiment with different values of different normals. To experiment witha parameter, select an option from the menu below and press "Select". Viewing "collectively" will showyou all the possible images you can view and allow you to select from them. Viewing "individually" willshow you an image and allow you to vary the amount of the normal modifier. The images we have heredo not represent the only allowable values for these parameters, we just chose a range of values so youcould get a feel for how the parameter changes the object.

I want to experiment with and view the images

Top of Document Main Page

The Online POV-Ray Tutorial © 1996 The Online POV-Ray Tutorial ThinkQuest Team

The Online POV-Ray Tutorial: Normal Tool

http://library.thinkquest.org/3285/cgi-bin/SelectNormal.cgi [9/12/2001 4:05:15 PM]

Page 385: POV Ray Tutorial

#include "colors.inc"

union {

box { <-1, -1, -1>, <1, 1, 1> pigment { color Red } }

cylinder { <1.5, 1.5, -1.5>, <-1.5, -1.5, 1.5>, 0.5 pigment { color Green } }

}

plane { y, -3 pigment { checker color White color Black }}

plane { -z, -3 pigment { checker color White color Black }}

light_source { <-400, 200, -300> color rgb <1, 1, 1> }

camera { location <-2, 3, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/csg7.pov

http://library.thinkquest.org/3285/language/src/csg7.pov [9/12/2001 4:05:46 PM]

Page 386: POV Ray Tutorial

box { <-1, -1, -1>, <1, 1, 1> clipped_by { sphere { <-1, -1, 1>, 2.6 } } pigment { color rgb <1, 1, 0> }}

light_source { <40, 40, -50> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/modifie1.pov

http://library.thinkquest.org/3285/language/src/modifie1.pov [9/12/2001 4:06:23 PM]

Page 387: POV Ray Tutorial

box { <-1, -1, -1>, <1, 1, 1> clipped_by { sphere { <-1, -1, 1>, 2.6 } sphere { <1, 1, -1>, 2.6 } } pigment { color rgb <1, 1, 0> }}

light_source { <40, 40, -50> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/modifie2.pov

http://library.thinkquest.org/3285/language/src/modifie2.pov [9/12/2001 4:06:24 PM]

Page 388: POV Ray Tutorial

box { <0, 0, 0>, <1, 1, 1> pigment { image_map { gif "../gfx/mmap.gif" } }}

plane { -z, -10 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> rotate 45*z }}

light_source { <50, 30, -50> color rgb <1, 1, 1> }

camera { location <1.5, 1.5, -2> look_at <0.5, 0.5, 0.5>}

http://library.thinkquest.org/3285/language/src/pig19.pov

http://library.thinkquest.org/3285/language/src/pig19.pov [9/12/2001 4:06:27 PM]

Page 389: POV Ray Tutorial

sphere { <0, 0, 0>, 0.5 pigment { image_map { gif "../gfx/mmap.gif" map_type 1 } rotate y*-90 } translate <0.5, 0.5, 0.5>}

plane { -z, -10 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> rotate 45*z }}

light_source { <50, 30, -50> color rgb <1, 1, 1> }

camera { location <1.5, 1.5, -2> look_at <0.5, 0.5, 0.5>}

http://library.thinkquest.org/3285/language/src/modifie7.pov

http://library.thinkquest.org/3285/language/src/modifie7.pov [9/12/2001 4:06:32 PM]

Page 390: POV Ray Tutorial

cylinder { <0, 0, 0>, <0, 1, 0>, 0.5 pigment { image_map { gif "../gfx/mmap.gif" map_type 2 } rotate y*-90 } translate <0.5, 0.5, 0.5>}

plane { -z, -10 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> rotate 45*z }}

light_source { <50, 30, -50> color rgb <1, 1, 1> }

camera { location <1.5, 1.5, -2> look_at <0.5, 0.5, 0.5>}

http://library.thinkquest.org/3285/language/src/modifie8.pov

http://library.thinkquest.org/3285/language/src/modifie8.pov [9/12/2001 4:06:33 PM]

Page 391: POV Ray Tutorial

torus { 0.75, 0.25 pigment { image_map { gif "../gfx/mmap.gif" map_type 5 } rotate y*-90 } translate <0.5, 0.5, 0.5>}

plane { -z, -10 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> rotate 45*z }}

light_source { <50, 30, -50> color rgb <1, 1, 1> }

camera { location <1.5, 1.5, -2> look_at <0.5, 0.5, 0.5>}

http://library.thinkquest.org/3285/language/src/modifie9.pov

http://library.thinkquest.org/3285/language/src/modifie9.pov [9/12/2001 4:06:34 PM]

Page 392: POV Ray Tutorial

sphere { <0, 0, 0>, 1 pigment { color rgb <1, 0, 0> }}

disc { <0, -2, 0>, y, 4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> }}

light_source { <10, 50, -10> color rgb <1, 1, 1> }

camera { location <0, 1, -4> look_at <0, -1, 0>}

http://library.thinkquest.org/3285/language/src/modifie5.pov

http://library.thinkquest.org/3285/language/src/modifie5.pov [9/12/2001 4:06:35 PM]

Page 393: POV Ray Tutorial

sphere { <0, 0, 0>, 1 no_shadow pigment { color rgb <1, 0, 0> }}

disc { <0, -2, 0>, y, 4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> }}

light_source { <10, 50, -10> color rgb <1, 1, 1> }

camera { location <0, 1, -4> look_at <0, -1, 0>}

http://library.thinkquest.org/3285/language/src/modifie6.pov

http://library.thinkquest.org/3285/language/src/modifie6.pov [9/12/2001 4:06:36 PM]

Page 394: POV Ray Tutorial

cylinder { <0, 0, -2>, <0, 0, 2>, 0.5 pigment { color rgb <1, 0, 0> } rotate <-6, 6, 0>}

light_source { <0, 4, -20> color rgb <1, 1, 1> }

camera { location <0, 0, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/modifie3.pov

http://library.thinkquest.org/3285/language/src/modifie3.pov [9/12/2001 4:06:43 PM]

Page 395: POV Ray Tutorial

cylinder { <0, 0, -2>, <0, 0, 2>, 0.5 open pigment { color rgb <1, 0, 0> } rotate <-6, 6, 0>}

light_source { <0, 4, -20> color rgb <1, 1, 1> }

camera { location <0, 0, -4> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/modifie4.pov

http://library.thinkquest.org/3285/language/src/modifie4.pov [9/12/2001 4:06:44 PM]

Page 396: POV Ray Tutorial

box { <0, 0, 0>, <1, 0.99, 1> texture { material_map { gif "mmap.gif" texture { pigment { mandel 100 color_map { [0.00 color rgb <0.2, 0, 0.2>] [0.10 color rgb <1, 0, 1>] [0.60 color rgb <1, 1, 1>] [1.00 color rgb <1, 1, 1>] [1.00 color rgb <0, 0, 0>] } scale 1/4 rotate <0, 0, -45> translate <0.5, 0.5, 0> } } texture { pigment { mandel 100 color_map { [0.00 color rgb <0, 0.2, 0.2>] [0.10 color rgb <0, 1, 1>] [0.60 color rgb <1, 1, 1>] [1.00 color rgb <1, 1, 1>] [1.00 color rgb <0, 1, 1>] } scale 1/4 rotate <0, 0, -45> translate <0.5, 0.5, 0> } } texture { pigment { marble color_map { [0 color rgb <0, 0, 0>] [1 color rgb <1, 1, 1>] } turbulence 1.0 scale 1/6 } } texture { pigment { color rgb <1, 1, 1> } finish { reflection 0.8 diffuse 0.2 ambient 0 } normal { bumps 0.1 scale 1/2 } } } }

http://library.thinkquest.org/3285/language/src/texture1.pov

http://library.thinkquest.org/3285/language/src/texture1.pov (1 of 2) [9/12/2001 4:06:51 PM]

Page 397: POV Ray Tutorial

scale 4}

disc { <0, 0, 0>, y, 15 pigment { checker color rgb <0, 0, 0> color rgb <1, 1, 1> } rotate 30 * y}

light_source { <50, 50, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <2, 2, 0>}

http://library.thinkquest.org/3285/language/src/texture1.pov

http://library.thinkquest.org/3285/language/src/texture1.pov (2 of 2) [9/12/2001 4:06:51 PM]

Page 398: POV Ray Tutorial

#default { finish { ambient 0 diffuse 1 }}

sphere { <0, 0, 0>, 2 texture { pigment { bozo color_map { [0.0 color rgb <0.3, 0, 0>] [1.0 color rgb <0.6, 0.2, 0>] } turbulence 0.3 scale 1/2 } }}

light_source { <50, 35, -50> color rgb <1, 1, 1> }

camera { location <0, 0, -6> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/texture2.pov

http://library.thinkquest.org/3285/language/src/texture2.pov [9/12/2001 4:06:56 PM]

Page 399: POV Ray Tutorial

#default { finish { ambient 0 diffuse 1 }}

sphere { <0, 0, 0>, 2 texture { pigment { bozo color_map { [0.0 color rgb <0.3, 0, 0>] [1.0 color rgb <0.6, 0.2, 0>] } turbulence 0.3 scale 1/2 } } texture { pigment { agate color_map { [0.0 color rgbf <1, 1, 1, 1>] [0.5 color rgbf <1, 1, 1, 1>] [0.5 color rgbf <0.5, 0, 0, 1>] [0.75 color rgb <0.5, 0, 0>] [1.0 color rgb <1, 0.5, 0>] } turbulence 1.0 scale 1.5 } }}

light_source { <50, 35, -50> color rgb <1, 1, 1> }

camera { location <0, 0, -6> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/texture3.pov

http://library.thinkquest.org/3285/language/src/texture3.pov [9/12/2001 4:06:57 PM]

Page 400: POV Ray Tutorial

#default { finish { ambient 0 diffuse 1 }}

sphere { <0, 0, 0>, 2 texture { pigment { bozo color_map { [0.0 color rgb <0.3, 0, 0>] [1.0 color rgb <0.6, 0.2, 0>] } turbulence 0.3 scale 1/2 } } texture { pigment { agate color_map { [0.0 color rgbf <1, 1, 1, 1>] [0.5 color rgbf <1, 1, 1, 1>] [0.5 color rgbf <0.5, 0, 0, 1>] [0.75 color rgb <0.5, 0, 0>] [1.0 color rgb <1, 0.5, 0>] } turbulence 1.0 scale 1.5 } } texture { pigment { granite color_map { [0.0 color rgb <1, 1, 0>] [0.2 color rgbf <1, 1, 1, 1>] [1.0 color rgbf <1, 1, 1, 1>] } } }}

light_source { <50, 35, -50> color rgb <1, 1, 1> }

camera { location <0, 0, -6> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/texture4.pov

http://library.thinkquest.org/3285/language/src/texture4.pov [9/12/2001 4:06:59 PM]

Page 401: POV Ray Tutorial

plane { -z, 0 texture { tiles { texture { pigment { marble color_map { [0.0 color rgb <1, 1, 1>] [0.75 color rgb <0.75, 0.75, 0.75>] [1.0 color rgb <0, 0, 0>] } turbulence 0.8 } finish { phong 0.7 } } tile2 texture { pigment { marble color_map { [0.0 color rgb <0, 0, 0>] [0.75 color rgb <0.25, 0.25, 0.25>] [1.0 color rgb <1, 1, 1>] } turbulence 0.8 } finish { phong 0.7 } rotate <0, 0, 90> } } }}

light_source { <5, 0, -6> color rgb <1, 1, 1> }

camera { location <0, 0, -6> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/texture5.pov

http://library.thinkquest.org/3285/language/src/texture5.pov [9/12/2001 4:07:04 PM]

Page 402: POV Ray Tutorial

plane { y, 0 rotate <-55, -45, 0> translate <0, 1/2, 0> texture { tiles { texture { pigment { marble color_map { [0.0 color rgb <1, 1, 1>] [0.75 color rgb <0.75, 0.75, 0.75>] [1.0 color rgb <0, 0, 0>] } turbulence 0.8 } finish { phong 0.7 } } tile2 texture { pigment { marble color_map { [0.0 color rgb <0, 0, 0>] [0.75 color rgb <0.25, 0.25, 0.25>] [1.0 color rgb <1, 1, 1>] } turbulence 0.8 } finish { phong 0.7 } rotate <0, 0, 90> } } } scale 3}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <6, 0, -6> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/texture6.pov

http://library.thinkquest.org/3285/language/src/texture6.pov [9/12/2001 4:07:05 PM]

Page 403: POV Ray Tutorial

#declare Pigm = pigment { granite color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig18.pov

http://library.thinkquest.org/3285/language/src/pig18.pov [9/12/2001 4:07:13 PM]

Page 404: POV Ray Tutorial

#declare Pigm = pigment { hexagon color rgb <1, 0.25, 0.25> color rgb <0.25, 0.25, 1> color rgb <0.25, 1, 0.25> scale 0.5}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig14.pov

http://library.thinkquest.org/3285/language/src/pig14.pov [9/12/2001 4:07:14 PM]

Page 405: POV Ray Tutorial

#declare Pigm = pigment { leopard color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] } scale 1/5}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig3.pov

http://library.thinkquest.org/3285/language/src/pig3.pov [9/12/2001 4:07:22 PM]

Page 406: POV Ray Tutorial

#declare Pigm = pigment { mandel 50 color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig4.pov

http://library.thinkquest.org/3285/language/src/pig4.pov [9/12/2001 4:07:23 PM]

Page 407: POV Ray Tutorial

#declare Pigm = pigment { marble color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig5.pov

http://library.thinkquest.org/3285/language/src/pig5.pov [9/12/2001 4:07:25 PM]

Page 408: POV Ray Tutorial

#declare Pigm = pigment { marble color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] } turbulence 0.8}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig17.pov

http://library.thinkquest.org/3285/language/src/pig17.pov [9/12/2001 4:07:26 PM]

Page 409: POV Ray Tutorial

#declare Pigm = pigment { onion color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig6.pov

http://library.thinkquest.org/3285/language/src/pig6.pov [9/12/2001 4:07:36 PM]

Page 410: POV Ray Tutorial

#declare Pigm = pigment { spotted color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig8.pov

http://library.thinkquest.org/3285/language/src/pig8.pov [9/12/2001 4:07:43 PM]

Page 411: POV Ray Tutorial

#declare Pigm = pigment { wood color_map { [0.00 color rgb <1, 0.25, 0.25>] [0.33 color rgb <1, 1, 0.25>] [0.50 color rgb <0.25, 1, 0.25>] [0.66 color rgb <0.25, 0.25, 1>] [1.00 color rgb <1, 0.25, 0.25>] }}

sphere { <1.5, 0, 0>, 1 pigment { Pigm translate <1.5, 0, 0> }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { Pigm translate <-1.5, 0, 0> }}

light_source { <150, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/pig9.pov

http://library.thinkquest.org/3285/language/src/pig9.pov [9/12/2001 4:07:48 PM]

Page 412: POV Ray Tutorial

plane { y, 0 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> }}

union { cone { <0, 0, 0>, 1 <0, 4, 0>, 0 } cone { <4, 0, 0>, 1 <4, 3, 0>, 0 } cone { <-4, 0, 0>, 1 <-4, 3, 0>, 0 } cone { <0, 0, 4>, 1 <0, 3, 4>, 0 } cone { <0, 0, -4>, 1 <0, 3, -4>, 0 } pigment { color rgb <1, 1, 0> }}

light_source { <-100, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 7, -2> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/languag1.pov

http://library.thinkquest.org/3285/language/src/languag1.pov [9/12/2001 4:08:00 PM]

Page 413: POV Ray Tutorial

plane { y, 0 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> }}

union { cone { <0, 0, 0>, 1 <0, 4, 0>, 0 } cone { <4, 0, 0>, 1 <4, 3, 0>, 0 } cone { <-4, 0, 0>, 1 <-4, 3, 0>, 0 } cone { <0, 0, 4>, 1 <0, 3, 4>, 0 } cone { <0, 0, -4>, 1 <0, 3, -4>, 0 } pigment { color rgb <1, 1, 0> }}

fog { color rgb <0, 0, 1> distance 12}

light_source { <-100, 200, -500> color rgb <1, 1, 1> }

camera { location <2, 7, -2> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/languag2.pov

http://library.thinkquest.org/3285/language/src/languag2.pov [9/12/2001 4:08:04 PM]

Page 414: POV Ray Tutorial

cone { <0, 0, 0>, 1, <0, 4, 0>, 0 pigment { hexagon color rgb <1, 0.4, 0> color rgb <1, 1, 0> color rgb <1, 0.7, 0> scale 1/6 }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0, 2, -8> look_at <0, 2, 0>}

http://library.thinkquest.org/3285/language/src/languag3.pov

http://library.thinkquest.org/3285/language/src/languag3.pov [9/12/2001 4:08:05 PM]

Page 415: POV Ray Tutorial

cone { <0, 0, 0>, 1, <0, 4, 0>, 0 pigment { hexagon color rgb <1, 0.4, 0> color rgb <1, 1, 0> color rgb <1, 0.7, 0> scale 1/6 } rotate <-90, 90, 0>}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0, 2, -8> look_at <0, 2, 0>}

http://library.thinkquest.org/3285/language/src/languag4.pov

http://library.thinkquest.org/3285/language/src/languag4.pov [9/12/2001 4:08:08 PM]

Page 416: POV Ray Tutorial

cone { <0, 0, 0>, 1, <0, 4, 0>, 0 pigment { hexagon color rgb <1, 0.4, 0> color rgb <1, 1, 0> color rgb <1, 0.7, 0> scale 1/6 } rotate 90*y rotate -90*x}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <0, 2, -8> look_at <0, 2, 0>}

http://library.thinkquest.org/3285/language/src/languag5.pov

http://library.thinkquest.org/3285/language/src/languag5.pov [9/12/2001 4:08:10 PM]

Page 417: POV Ray Tutorial

union { cylinder { <1, 0, 0>, <1, 1, 0>, 0.25 } cylinder { <-0.5, 0, 0.866025>, <-0.5, 1, 0.866025>, 0.25 } cylinder { <-0.5, 0, -0.866025>, <-0.5, 1, -0.866025>, 0.25 } pigment { color rgb <0, 1, 1> }}

disc { <0, 0, 0>, y, 3 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <1.5, 3, -1.5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/languag9.pov

http://library.thinkquest.org/3285/language/src/languag9.pov [9/12/2001 4:08:11 PM]

Page 418: POV Ray Tutorial

union { cylinder { <1, 0, 0>, <1, 1, 0>, 0.25 } cylinder { <1, 0, 0>, <1, 1, 0>, 0.25 rotate 120*y } cylinder { <1, 0, 0>, <1, 1, 0>, 0.25 rotate 240*y } pigment { color rgb <0, 1, 1> }}

disc { <0, 0, 0>, y, 3 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 0> }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <1.5, 3, -1.5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/langua10.pov

http://library.thinkquest.org/3285/language/src/langua10.pov [9/12/2001 4:08:12 PM]

Page 419: POV Ray Tutorial

box { <0, 0, -0.5>, <1, 1, 0.5> pigment { checker color rgb <0.6, 0.6, 1.0> color rgb <0.2, 0.2, 1.0> scale 1/3.9 }}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <1.25, 1.25, -2> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/languag6.pov

http://library.thinkquest.org/3285/language/src/languag6.pov [9/12/2001 4:08:22 PM]

Page 420: POV Ray Tutorial

box { <0, 0, -0.5>, <1, 1, 0.5> pigment { checker color rgb <0.6, 0.6, 1.0> color rgb <0.2, 0.2, 1.0> scale 1/3.9 } scale <1, 1/3, 1> rotate 45*z}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <1.25, 1.25, -2> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/languag7.pov

http://library.thinkquest.org/3285/language/src/languag7.pov [9/12/2001 4:08:23 PM]

Page 421: POV Ray Tutorial

box { <0, 0, -0.5>, <1, 1, 0.5> pigment { checker color rgb <0.6, 0.6, 1.0> color rgb <0.2, 0.2, 1.0> scale 1/3.9 } rotate 45*z scale <1, 1/3, 1>}

light_source { <50, 50, -50> color rgb <1, 1, 1> }

camera { location <1.25, 1.25, -2> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/languag8.pov

http://library.thinkquest.org/3285/language/src/languag8.pov [9/12/2001 4:08:24 PM]

Page 422: POV Ray Tutorial

#declare Fin = finish { phong 0.9}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin8.pov

http://library.thinkquest.org/3285/language/src/fin8.pov [9/12/2001 4:08:54 PM]

Page 423: POV Ray Tutorial

#declare Fin = finish { phong 0.9 metallic}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin7.pov

http://library.thinkquest.org/3285/language/src/fin7.pov [9/12/2001 4:08:57 PM]

Page 424: POV Ray Tutorial

#declare Fin = finish { phong 0.9 phong_size 4}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin9.pov

http://library.thinkquest.org/3285/language/src/fin9.pov [9/12/2001 4:08:59 PM]

Page 425: POV Ray Tutorial

#declare Fin = finish { phong 0.9 phong_size 180}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin10.pov

http://library.thinkquest.org/3285/language/src/fin10.pov [9/12/2001 4:09:04 PM]

Page 426: POV Ray Tutorial

#declare Fin = finish { reflection 0.3}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin11.pov

http://library.thinkquest.org/3285/language/src/fin11.pov [9/12/2001 4:09:09 PM]

Page 427: POV Ray Tutorial

#declare Fin = finish { refraction 1 ior 1}

sphere { <1.5, 0, 0>, 1 pigment { color rgbf <1, 1, 0, 0.7> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgbf <1, 0, 1, 0.7> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin14.pov

http://library.thinkquest.org/3285/language/src/fin14.pov [9/12/2001 4:09:14 PM]

Page 428: POV Ray Tutorial

#declare Fin = finish { refraction 1 ior 1.5}

sphere { <1.5, 0, 0>, 1 pigment { color rgbf <1, 1, 0, 0.7> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgbf <1, 0, 1, 0.7> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin12.pov

http://library.thinkquest.org/3285/language/src/fin12.pov [9/12/2001 4:09:15 PM]

Page 429: POV Ray Tutorial

#declare Fin = finish { refraction 1 ior 2.0}

sphere { <1.5, 0, 0>, 1 pigment { color rgbf <1, 1, 0, 0.7> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgbf <1, 0, 1, 0.7> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin13.pov

http://library.thinkquest.org/3285/language/src/fin13.pov [9/12/2001 4:09:19 PM]

Page 430: POV Ray Tutorial

#declare Fin = finish { specular 0.9}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin17.pov

http://library.thinkquest.org/3285/language/src/fin17.pov [9/12/2001 4:09:24 PM]

Page 431: POV Ray Tutorial

#declare Fin = finish { specular 0.9 roughness 0.75}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin15.pov

http://library.thinkquest.org/3285/language/src/fin15.pov [9/12/2001 4:09:26 PM]

Page 432: POV Ray Tutorial

#declare Fin = finish { specular 0.9 roughness 0.001}

sphere { <1.5, 0, 0>, 1 pigment { color rgb <1, 1, 0> } finish { Fin }}

box { <-2.5, -1, -1>, <-0.5, 1, 1> pigment { color rgb <1, 0, 1> } finish { Fin }}

plane { y, -1 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> }}

plane { -z, -4 pigment { checker color rgb <1, 1, 1> color rgb <0, 0, 1> } finish { ambient 0.5 }}

light_source { <100, 500, -100> color rgb <1, 1, 1> }

camera { location <2, 2, -5> look_at <0, 0, 0>}

http://library.thinkquest.org/3285/language/src/fin16.pov

http://library.thinkquest.org/3285/language/src/fin16.pov [9/12/2001 4:09:34 PM]

Page 433: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 10, 0> radius 1.5 falloff 1.5}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light5.pov

http://library.thinkquest.org/3285/language/src/light5.pov [9/12/2001 4:09:53 PM]

Page 434: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 0.75 falloff 0.75}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light6.pov

http://library.thinkquest.org/3285/language/src/light6.pov [9/12/2001 4:09:56 PM]

Page 435: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 2.5 falloff 2.5}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light7.pov

http://library.thinkquest.org/3285/language/src/light7.pov [9/12/2001 4:10:00 PM]

Page 436: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 1.5 falloff 2 tightness 1}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light8.pov

http://library.thinkquest.org/3285/language/src/light8.pov [9/12/2001 4:10:03 PM]

Page 437: POV Ray Tutorial

#default { texture { finish { ambient 0 diffuse 1 } }}

#declare sqrt2_2 = 0.707

#declare Light = light_source { <100, 100, -200> color rgb <1, 1, 1>

spotlight point_at <0, 0, 0> radius 1.5 falloff 2 tightness 100}

union { torus { 5, 0.5 rotate <90, 0, 0> } cylinder { <0, 0, 0>, <0, 10, 0>, 0.5 } pigment { color rgb <0.5, 0.5, 1> }}

plane { y, 0 pigment { checker color rgb <0.75, 0, 0.75> color rgb <0.5, 0, 0.5> scale 3 }}

light_source { Light }

camera { location <-2, 16, -8> look_at <0, 5, 0>}

http://library.thinkquest.org/3285/language/src/light9.pov

http://library.thinkquest.org/3285/language/src/light9.pov [9/12/2001 4:10:05 PM]