Introduction to the scenery description langage of the POV-Ray Raytracer         - page 2 -
by Friedrich A. Lohmüller
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorials
 
  
POV-Ray Introduction
   Content  -  INDEX
 
  0. Working with POV-Ray:
      "Insert Menu Add-on".
>1. Basics
      on writing texts.
>2. 3D Coordinates,
      Floats and Vectors
  3. Scene Structur
      #include files,
      camera, light_source.
      Types of light sources
  4. Basic Objects plane, sphere,
      box, cylinder, cone, torus.
      Other Shapes
      height_field, text, etc.
  5. Transformations
      Streching, Turning,
      Moving and others.
      CSG: union,
      difference, intersection.
  6. Color + Surfaces       texture, pigment, normal, finish
  7. #declare, #local,
      #macro .. #end,
      #include,
      re-usable objects.
  8. #while Loops
  9. Efficiency,
      speed, flexibility,
      modulare working
      adapting from 3.1 to 3.5;3.6
      adapting from 3.5;3.6 to 3.7
 
  - Insert Menu Add-on
    & Download
      POV-Ray + Windows Vista.
                                       

I  The basics of descriping a scene

To describe a scene you will use a set of text consisting of statements with keywords and values, which must be written carefully! A comma or a bracket at the wrong place is likely to mess up the whole scene or make it not render able. The program is case-significant, which means that it considers capitals and small letters as different characters! Also, don't use specific national characters outside of comments or in file names!
The parser (= the part of the program, which translates the written statements into mathematical formulas) reads the text from top to bottom. Don't use abbreviations before you have declared them!
You may not divide keywords by spaces, but sometimes keyword must be separated by spaces from their according values! I.e. "scale2" is an error, but "scale 2" is ok! Multiple spaces and CR/LF between keywords are ignored. After the characters // you may write comments and remarks also using any specific national character sets, the rest of the line will be ignored. Longer comments spread over more then one line must use the sequences /* ("start of comment") and */ ("end of comment").


II   xyz-coordinates and vectors

POV-Ray normally uses a so-called "left handed" coordinate system. The three dimensional coordinates for the directions x, y and z are defined relatively to each other as follows:

      x to the right positive following your thumb - horizontal
      y to    up    positive following your index finger - vertical
      z forward positive following your middle finger - away into of the depth of the space

left hand axis coordinates

For angles, such as in the command "rotate<0,40,0>" rotation is counterclockwise, as long as you are looking in the positive direction of the axis! (left thumb rule)

pov axis

Please attention: This view and relative expressions like "right", "up" and "left" do only work right if your camera (standpoint = "location") is at a negative z position pointing towards positive z!


About floats and vectors

Ordered groups of 3 or 4 floats (called "vectors") are written in brackets separated by commas: "< , , >" . For example, the point at x = 0.2, y = 3.35 and z = 1 is represented as <0.2,3.35,1>. The coordinates are noted in the alphabetic order according to the "left-hand-rule" <x,y,z> !
It is possible to describe values by arithmetic expressions, variables and formulas. If a vector is connected with an arithmetic expression like "*" then the operation is applied to every component of the vector: <0.5,1.0,3.5>*2 = < 0.5*2,1.0*2,3.5*2> = <1.0,2.0,7.0>. The basic arithmetic signs are: + , - , * , / and round brackets.
For the transformation of an angle A in degrees to its radiant value there exists the function radians(A). The functions sin(A) cos(A) tan(A) need the argument of the angle A in radiant value. With atan2(A,B) you can calculate the arctan of A/B, this gives the value of the angle in radians. Changing a radians value R to a degree value is possible by degrees(R). With this and a lot of many other float, vector and string functions, also very advanced users can be very satisfied!

top

© Friedrich A. Lohmüller, 2009
email email: Friedrich.Lohmueller_at_t-online.de
homepage:http://www.f-lohmueller.de