Upcoming SlideShare
×

# POV-Ray tutorial

1,440 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
1,440
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
16
0
Likes
0
Embeds 0
No embeds

No notes for slide

### POV-Ray tutorial

1. 1. POVRAY Tutorial 204481 Foundation of Computer graphics Pradondet Nilagupta
2. 2. What is POV-Ray? <ul><li>POVRAY = Persistence of Vision Ray-Tracer </li></ul><ul><li>POV-Ray is a high-quality, freely available ray-tracing software package that is available for PC, Macintosh and UNIX platforms. </li></ul><ul><li>POV-Ray is no toy. </li></ul><ul><li>POV-Ray is what is known as a &quot;rendering engine&quot;. </li></ul>
3. 3. Written POV-Ray language <ul><li>Describing scenes to POV-Ray is fairly simple </li></ul><ul><li>Give POV-Ray a file containing a description of every object in the scene. POV-Ray takes this file and generates a picture, which you can then view. </li></ul>
4. 4. Object description of POVRAY <ul><li>What type of object you want (one of POV-Ray's simple objects or one you've created yourself. </li></ul><ul><li>Various attributes of the object (its color, how it reflects light, etc). </li></ul>
5. 5. What is ray-tracing? <ul><li>Ray-tracing is a method of creating visual art in which a description of an object or scene is mathematically converted into a picture. </li></ul><ul><li>ray-tracing is the process of mathematically generating near-photorealistic images from a given description of a scene via geometrical modeling of light rays. </li></ul>
6. 6. POV-Ray's Coordinate System <ul><li>The coordinate system that POV-Ray uses, then, is called a three-dimensional (or 3D) Cartesian coordinate system. </li></ul><ul><li>The axis we have drawn 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. </li></ul>
7. 7. Vectors in POV-Ray <ul><li>The term vector refers to any group of numbers describing a certain thing -- there are color vectors and normal vectors. </li></ul><ul><li>vectors are surrounded by angle brackets (that's < and >). </li></ul><ul><li>For example, to specify the origin in terms that POV-Ray understands, we would say <0,0,0> </li></ul>
8. 8. How to describe color: RGB and RGBF Vectors <ul><li>In describing a color, each element of the vector corresponds to the amount of a primary color -- red, green and blue. Such a vector is called a RGB vector (for r ed g reen b lue vector). </li></ul><ul><li>In a RGB vector, the numbers should be between 0.0 and 1.0. </li></ul><ul><li>For example, the color black, is described by the color vector <0,0,0>. And color white , is specified by the color vector <1,1,1>. </li></ul>
9. 9. Normal Vectors <ul><li>normal vectors are used to specify an orientation , not a distance. </li></ul>
10. 10. Normal Vector (cont.) <ul><li>POV-Ray is kind enough to automatically define three normal vectors for you </li></ul><ul><li>x (corresponding to <1,0,0>), the normal vector for a plane lying along the y and z axes </li></ul><ul><li>y (corresponding to <0, 1, 0>), the normal vector for a plane lying along the x and z axes, </li></ul><ul><li>z (corresponding to <0, 0, 1>), the normal vector for a plane lying along the x and y axes. </li></ul>
11. 11. POV-Ray Source Code <ul><li>There are three things you need to know about POV-Ray source code </li></ul><ul><ul><li>POV-Ray source code is case sensitive </li></ul></ul><ul><ul><li>POV-Ray ignores whitespace </li></ul></ul><ul><ul><li>Ordering is unimportant </li></ul></ul>
12. 12. Source Code (cont.) <ul><li>camera { </li></ul><ul><li>location <0, 2.25, -35> </li></ul><ul><li>direction <0, 0, 10> </li></ul><ul><li>up <0, 1, 0> </li></ul><ul><li>right <1, 0, 0> </li></ul><ul><li>look_at <0, 0, 90> </li></ul><ul><li>} </li></ul><ul><li>camera { location <0, 2.25, -35> direction <0, 0, 10> up <0, 1, 0> right <1, 0, 0> look_at <0, 0, 90>} </li></ul>
13. 13. Comments in POV-Ray Source Code <ul><li>Comments can be enclosed in /* and */, or, for single-line comments, can be prefixed with a //. </li></ul><ul><li>Example </li></ul><ul><li>// this is a single-line comment </li></ul><ul><li>/* this is </li></ul><ul><li>another comment. it can be as long as you want it to be */ </li></ul>
14. 14. Including files <ul><li>Including files is a feature of many languages that makes re-using code easier </li></ul><ul><li>Adding the string #include &quot; filename &quot; to the beginning of your file. </li></ul><ul><li>Example </li></ul><ul><li>#include &quot;colors.inc&quot; </li></ul>
15. 15. Creating simple objects <ul><li>The building blocks of all POV-Ray objects and scenes are called primitive s. Primitives are objects 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. </li></ul>
16. 16. Describing primitives <ul><li>Object_Name { Object_Parameters Some_Simple_Attribute Some_Other_Simple_Attribute Some_Complex_Attribute { Some_Attribute Some_Other_Attribute } </li></ul>
17. 17. Example <ul><li>sphere { </li></ul><ul><li><0, 0, 0>, 5 </li></ul><ul><li>pigment { </li></ul><ul><li>color rgb <1, 0, 0> </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
18. 18. The Camera <ul><li>This example defines a camera located at <2,5,-10> and pointing at the origin. </li></ul><ul><li>camera { </li></ul><ul><li>location <2,5,-10> </li></ul><ul><li>look_at <0,0,0> </li></ul><ul><li>} </li></ul>
19. 19. Light sources <ul><li>There are a few different types of light sources in POV-Ray. We will concentrate here on the most simple (and useful): the point light source . A point light source can be thought of as an infinitely small object that emits light. </li></ul><ul><li>light_source { </li></ul><ul><li> <0,10,-10> color rgb <1,1,1> } </li></ul>
20. 20. First POVRAY <ul><li>// Persistence of Vision RayTracer version 2 Scene description file </li></ul><ul><li>// File: Lesson_1.pov </li></ul><ul><li>// Description: Chrome Sphere on checkers </li></ul><ul><li>// Date: January 5, 2000 </li></ul><ul><li>// Author: Pradondet Nilagupta </li></ul><ul><li>// </li></ul><ul><li>#include &quot;shapes.inc&quot; </li></ul><ul><li>#include &quot;colors.inc&quot; </li></ul><ul><li>#include &quot;textures.inc&quot; </li></ul>camera { location <0, 2.25, -35> direction <0, 0, 10> up <0, 1, 0> right <1, 0, 0> look_at <0, 0, 90> } //Key Light light_source {<50, 100, -80> color White} //Back Light light_source {<100, 50, 80> color Blue}
21. 21. First POVRAY <ul><li>First we'll place our plane into the picture. At the end of your source file, type: </li></ul><ul><ul><ul><li>object { </li></ul></ul></ul><ul><ul><ul><li>plane {y, 0} </li></ul></ul></ul><ul><ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul></ul></ul><ul><ul><ul><li>} </li></ul></ul></ul>
22. 22. First POVRAY <ul><li>Now let's add the sphere. Type: </li></ul><ul><ul><ul><li>object { </li></ul></ul></ul><ul><ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul></ul></ul><ul><ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul></ul></ul><ul><ul><ul><li>} </li></ul></ul></ul>
23. 23. Camera Again <ul><li>The camera defines what you exactly you see when you render an image. </li></ul><ul><li>camera { </li></ul><ul><li>location <loc> </li></ul><ul><li>sky <sky vector> </li></ul><ul><li>up <up vector> </li></ul><ul><li>right <right vector> </li></ul><ul><li>direction <direction vector> </li></ul><ul><li>look_at <target> </li></ul><ul><li>/* translations , rotations , and scales */ </li></ul><ul><li>} </li></ul>
24. 24. Camera Again <ul><li>When declaring a camera, components that appear should do so in this order. This is because some later components modify previous ones, and putting them in the wrong order may result in your camera not doing exactly what you expect. </li></ul><ul><li>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. </li></ul>
25. 25. Camera Again <ul><li>Sky is used to tell the camera which way is up. Modifying this value can be used to roll the camera around its central axis. </li></ul><ul><li>Up, right, and direction are used to modify the field of view and aspect ratio of the image. </li></ul><ul><li>Direction and look_at are used to point the camera at a specific point in the scene. Direction is more typically used with up and right to define field of view then to position the camera, though. </li></ul>
26. 26. Location <ul><li>The location keyword tells POV-Ray where to position the camera. </li></ul><ul><li>This parameter must always be specified. </li></ul><ul><li>It takes an <x, y, z> vector which tells the location of the camera. </li></ul>
27. 27. Up Vector <ul><li>The up vector is used to define the height of the viewing pyramid </li></ul><ul><li>The default value of the up vector is &quot;up <0, 1, 0>&quot;. </li></ul><ul><li>This, together with the value &quot;right <4/3, 0, 0>&quot; (also default) defines the aspect ratio of the rendered image to be (4/3) / (1) = 4/3. </li></ul>
28. 28. Right Vector <ul><li>The right vector controls the width of the view. </li></ul><ul><li>The angular width of the viewing pyramid can be found with the following equation. </li></ul><ul><li>width = 2 * atan(|right| / |direction|) </li></ul>
29. 29. Direction <ul><li>The direction vector is primarily used in conjunction with up and right to define the field of view. </li></ul><ul><li>Increasing the magnitude of the direction vector &quot; stretches &quot; the viewing pyramid and creates a telephoto sort of effect. </li></ul><ul><li>Decreasing the magnitude of the direction vector &quot; compresses &quot; the viewing pyramid and gives the effect of a wide-angle camera. </li></ul>
30. 30. Direction direction <0, 0, 0.5> direction <0, 0, 1> direction <0, 0, 2> direction <0, 0, 4>
31. 31. Look At <ul><li>The look_at parameter controls the orientation of the camera. It is by far the easiest way to get the camera to point at the thing you want it to point at. </li></ul><ul><li>One thing to keep in mind when using look_at is that the location and look_at points should never be set so that the camera is looking directly down (parallel to the y-axis). </li></ul>
32. 32. Sky <ul><li>The vector tells the camera which way is up. </li></ul><ul><li>This is not to be confused with the up vector which defines the aspect ratio. </li></ul><ul><li>The default sky vector is <0, 1, 0>. By modifiying this value, you can roll the camera around its central axis. </li></ul><ul><li>The sky vector, if specified, must appear before the look_at point is specified. </li></ul>
33. 33. Sky <ul><li>The first image below is rendered with &quot;sky <2, 1, 0>&quot;, and the second with &quot;sky <0, -1, 0>&quot;. </li></ul>
34. 34. Common Object Types <ul><li>plane , sphere , torus , box , cylinder , cone , lathe , prism (extruded shape) , blob , and text . </li></ul>
35. 35. The Plane <ul><li>The plane consists of only two values; which of the 3 major axis it crosses, and it's position on that axis. The plane will be perpendicular to the axis declared </li></ul><ul><li>object { </li></ul><ul><li>plane {y, -1.5} //{axis, location} </li></ul><ul><li>pigment {color rgb <.5,.5,.5>} </li></ul><ul><li>} </li></ul>
36. 36. Sphere <ul><li>The sphere also consists of only two values; the location, and the radius. </li></ul><ul><li>The location defines the center of the sphere. </li></ul><ul><li>object { </li></ul><ul><li>sphere {<0, .5, 0> 1} //{<location> radius} </li></ul><ul><li>pigment {color rgb <1,1,1>} </li></ul><ul><li>//scale <2,1,1> //scale to make an elipse </li></ul><ul><li>} </li></ul>
37. 37. Torus <ul><li>The torus definition consists of two radius statements. The first, or major radius extends from the center of the torus to the mid-line of the rim. The second, or minor radius defines the radius of the cross section of the rim. </li></ul><ul><li>object { </li></ul><ul><li>torus {1.75, .5} //{outer radius, rad. of cross section} </li></ul><ul><li>pigment {color rgb <1,1,1>} </li></ul><ul><li>translate <0,.5,0> //must use translate to move </li></ul><ul><li>} //its location. </li></ul>
38. 38. Box <ul><li>POV defines boxes as two points. The points form opposite corners of the box such as lower back right and upper front left. </li></ul><ul><li>object { </li></ul><ul><li>box {<-1, -1, -1> // first corner position </li></ul><ul><li>< 1, 1, 1>} // second corner position </li></ul><ul><li>pigment {color rgb <1,1,1>} </li></ul><ul><li>} </li></ul>
39. 39. Cylinder <ul><li>A cylinder consists of 4 values. The first three, first point , second point , and radius are mandatory. The fourth, open , is optional. </li></ul><ul><li>object { </li></ul><ul><li>cylinder {<0,-1,0>, <0,1,0>, 1 //{<1st point>, <2nd point>, radius </li></ul><ul><li>//open //uncomment to make it a tube </li></ul><ul><li>} </li></ul><ul><li>pigment {color rgb <1,1,1>} </li></ul><ul><li>} </li></ul>
40. 40. Cone <ul><li>A cone is very similar to a cylinder; the difference being that you can define the radius of both ends. The first point defines one end of the cone. The first radius defines the radius of the cone at this point. The second point and its radius define the center of the other end of the cone </li></ul><ul><li>object{ </li></ul><ul><li>cone {<0,-1,0>, 1.0, //{<1st point>, 1st radius </li></ul><ul><li><0,1,0>, 0.0 //{<2nd point>, 2nd radius </li></ul><ul><li>//open //uncomment to make it open ended </li></ul><ul><li>} </li></ul><ul><li>pigment {color rgb <1,1,1>} </li></ul><ul><li>} </li></ul>
41. 41. Color and Texture <ul><li>object { sphere {<0, 1.5, 1> 1.5} pigment {color rgb <1, 1, 1>} } </li></ul><ul><li>object { sphere {<0, 1.5, 1> 1.5} texture {PinkAlabaster} } </li></ul>
42. 42. Pigment <ul><li>object { </li></ul><ul><li>plane {y, 0} </li></ul><ul><li>pigment {checker color rgb <0,0,1> color rgb <0,1,0>} </li></ul><ul><li>scale 2 </li></ul><ul><li>} </li></ul><ul><li>The pigment is defined as checker, and is given two colors. You could also use textures instead of colors to make, say, a black marble and white marble tile floor. </li></ul><ul><li>The statement scale 2 scales the size of the squares. </li></ul>
43. 43. Finish <ul><li>the term &quot;finish&quot; refers to the quality of the surface (shiny, dull, reflective, etc.). There are some pre-defined finishes in the colors.inc file. </li></ul><ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul><ul><li>finish { </li></ul><ul><li>ambient .2 </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>ambient has to do witht he amount of light on the &quot;shaddow&quot; side of the object. Is it completely dark (black) or slightly lit? .2 is pretty dark, but not black.
44. 44. Diffuse and Specular <ul><li>diffuse refers to the way the light changes from sark to light. A high number means the light changes from light to shaddow very gradually; conversely, a low number (like 0.1) would have a very abrupt change from light to shaddow. </li></ul><ul><li>specular is the small round highlight on the surface. A small number will create a tiny &quot;dot&quot; of &quot;pure&quot; light; a large number will create a larger highlight. </li></ul>
45. 45. Diffuse and Specular <ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul><ul><li>finish { </li></ul><ul><li> ambient .2 </li></ul><ul><li> diffuse .5 } </li></ul><ul><li>} </li></ul><ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul><ul><li>finish { </li></ul><ul><li> ambient .2 </li></ul><ul><li> diffuse .5 } </li></ul><ul><li> specular .25 </li></ul><ul><li>} </li></ul>
46. 46. Reflection <ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul><ul><li>finish { </li></ul><ul><li> ambient .2 </li></ul><ul><li> diffuse .5 } </li></ul><ul><li> specular .25 </li></ul><ul><li> reflection 1 </li></ul><ul><li>} </li></ul><ul><li>reflection is just that: re fle ction. 1 means the objects is 100% reflective (liek a mirror); 0 means there is no reflection. </li></ul>
47. 47. Transparency <ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul><ul><li>pigment {color rgbf <1,1,1,.75>} </li></ul><ul><li>finish { </li></ul><ul><li>ambient .1 </li></ul><ul><li>diffuse .5 </li></ul><ul><li>specular .5 </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
48. 48. Finish Reference <ul><li>finish { </li></ul><ul><li>ambient ambient lighting </li></ul><ul><li>brilliance brilliance </li></ul><ul><li>crand crand amount </li></ul><ul><li>diffuse diffuse lighting </li></ul><ul><li>ior index of refraction </li></ul><ul><li>metallic </li></ul><ul><li>phong phong highlighting </li></ul><ul><li>phong_size phong size </li></ul><ul><li>reflection reflected light </li></ul><ul><li>refraction refract toggle </li></ul><ul><li>roughness roughness </li></ul><ul><li>specular specular highlighting </li></ul><ul><li>} </li></ul>
49. 49. Finish <ul><li>The sum of the values of ambient, diffuse, and reflection should be about 1.0. Much higher, and your colors will saturate and look flat. Much lower, and your colors will appear dark. </li></ul><ul><li>Objects with reflection and refraction (actually, any object with a nonzero filter) will increase your rendering time. Reflection requires an extra ray to be traced to determine the reflected color, while with transparent objects, an extra ray must be traced to determine the color that is being filtered. </li></ul>
50. 50. Finish <ul><li>You usually don't need both phong and specular highlights. </li></ul><ul><li>The argument to refraction should be 1 or 0 only. </li></ul>
51. 51. Ambient <ul><li>Them ambient finish controls how much of the color of a surface comes from ambient lighting. </li></ul><ul><li>Its parameter is a float value in the range 0.0 to 1.0 (typically). </li></ul><ul><li>The default value is 0.1 </li></ul><ul><li>Low values mean that objects which are not directly lit will retain some of their color. </li></ul><ul><li>Higher values can make an object appear to glow </li></ul>
52. 52. Brilliance <ul><li>Brilliance modifies the behavior of diffuse lighting. </li></ul><ul><li>Brilliance takes a float parameter which modifies how diffuse light bounces off an object. The default value is 1.0. </li></ul><ul><li>The flatter this angle is, the less the surface is illuminated. Higher brilliance values make the light illuminate less at flat angles </li></ul><ul><li>The first image was rendered with the default, the second with brillance 5, and the third with brilliance 0.2. </li></ul>
53. 53. Crand <ul><li>Crand can be used to simulate very rough surfaces like concrete and sand which have grainy surfaces. </li></ul><ul><li>Crand takes a float parameter from 0.0 to 1.0. The default is 0.0 </li></ul><ul><li>You should not use crand in animations. </li></ul><ul><li>the first image is again the default, while the second has crand 0.1 thrown in </li></ul>
54. 54. Diffuse <ul><li>Diffuse light is basically light that comes from a light source and diffuses in all directions. </li></ul><ul><li>The value can range from 0.0 (no light from light sources) to 1.0 (very well lit). The default value is 0.6. </li></ul><ul><li>The first is the default, the second has diffuse 0.3, and the third has diffuse 0.9. </li></ul>
55. 55. Ior <ul><li>This value controls the index of refraction for transparent objects which refract. </li></ul>
56. 56. Metallic <ul><li>The metallic keyword is a modifier for the phong and specular highlights. </li></ul><ul><li>Metallic takes no parameter; either it's there or it's not. </li></ul><ul><li>The first was rendered with phong highlighting without metallic, and the second is with metallic </li></ul>
57. 57. Phong <ul><li>The phong keyword creates a highlight on an object that is the color of the light source . </li></ul><ul><li>Phong takes a float parameter which expresses how bright the highlight should be. </li></ul><ul><li>The size of the highlight can be controlled with the phong_size parameter. </li></ul><ul><li>First image: no highlights, second image: phong 0.9 </li></ul>
58. 58. Phong Size <ul><li>The 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). </li></ul><ul><li>The default is 40. </li></ul><ul><li>The images were rendered with &quot;phong_size 40&quot; (default), &quot;phong_size 4&quot;, and &quot;phong_size 180&quot;, respectively. </li></ul>
59. 59. Reflection <ul><li>The reflection finish gives an object a mirrored or partially mirrored surface. This object will then reflect other objects in the scene. </li></ul><ul><li>A value of 0 turns off reflection for the object, a value of 1 gives the object a perfectly mirrored surface (almost). </li></ul><ul><li>The first scene has no reflection, the second has reflection 0.3. </li></ul>
60. 60. Refraction <ul><li>Refraction only has meaning on objects that have at least a little bit of transparency. Refraction is the bending of light rays as they pass into a more dense or less dense medium </li></ul><ul><li>You can change the ior of a refracting object with the &quot;ior&quot; keyword. Some examples of indices of refraction are &quot;ior 1.000292&quot; (air) &quot;ior 1.33&quot; (water), and &quot;ior 1.5&quot; (glass). </li></ul><ul><li>The first image has no refraction, the second has &quot;ior 1.5&quot;, and the third has &quot;ior 2.0&quot;. </li></ul>
61. 61. Roughness <ul><li>The roughness parameter controls the size of the highlight produced by the specular keyword. Typical values range from 1.0 (sand paper) to 0.0005 (polished glass). The default roughness is 0.05. </li></ul><ul><li>High values give very a very soft, very large highlight. Small values give a very small, tight highlight. 0 is a very bad number for roughness. </li></ul><ul><li>All use &quot;specular 0.9&quot;. The first uses the default roughness, the second uses &quot;roughness 0.75&quot;, the third &quot;roughness 0.001&quot;. </li></ul>
62. 62. Specular <ul><li>The specular finish is similar to phong , but this one is more accurate as far as physical laws are concerned. It produces a highlight on the object where the reflection of the light source would be if the object were reflective </li></ul><ul><li>The size of the highlight can be controlled (to some extent) with the roughness parameter. Here's what specular (0.9) looks like. </li></ul>
63. 63. Normal Reference <ul><li>Here's the general syntax for a bump map. </li></ul><ul><li>normal { </li></ul><ul><li>bump_map { </li></ul><ul><li>type &quot; filename &quot; </li></ul><ul><li>[bump_size size ] </li></ul><ul><li>[interpolate mode ] </li></ul><ul><li>[use_color] </li></ul><ul><li>[use_index] </li></ul><ul><li>[once] </li></ul><ul><li>[map_type map mode ] </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
64. 64. Normal <ul><li>The normal component of a texture allows you to create effects on the surface of an object </li></ul><ul><li>Normals have three parts, the type, the modifiers, and then transformations. </li></ul><ul><li>A normal can only have one type, and that is one of bumps , dents , ripples , waves , or wrinkles . They each take a depth parameter between 0.0 (Flat) and 1.0 (Violent). </li></ul>
65. 65. Normal <ul><li>here's a standard ripples normal and another with &quot;turbulence 0.7&quot;. Note the ripples have been translated to put their center on the top of the sphere. </li></ul>
66. 66. Bumps <ul><li>The bumps normal creates a random bumpy pattern on the object. </li></ul><ul><li>The bumps normal takes a float parameter from 0.0 (Flat) to 1.0 (Mountainous) that describes the depth of the bumps. </li></ul>
67. 67. Dents <ul><li>The surface appears to have dents (naturally enough) beaten into it. Dents takes a float parameter from 0.0 (Brand New) to 1.0 </li></ul>
68. 68. Ripples <ul><li>The ripples normal creates evenly space, smooth ripples which originate from 10 random locations inside the box with corners <0, 0, 0>, <1, 1, 1>. All the waves have the same frequency, so the ripple effect is smooth at a significant distance from the center. </li></ul>
69. 69. Waves <ul><li>Waves are similar to ripples , except instead of creating smooth, even ripples, it creates more rough and tumble waves. Theoretically these look more like deep ocean waves. The waves normal takes the standard 0.0 (Becalmed) to 1.0 (Tsunami) parameter. </li></ul>
70. 70. Wrinkles <ul><li>This normal specifier basically makes the object look like it had been wadded up and then stretched back out again. </li></ul>
71. 71. Declarations (variables) <ul><li>Variables are a way to store and recall frequently used items. In POV variables (declarations) can store a number, a word, an entire object, or even an ent ire scene. </li></ul><ul><li>Example </li></ul><ul><li>#declare sizeOfSphere = 1.5 </li></ul><ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> sizeOfSphere} </li></ul><ul><li>pigment {color rgb <1, 1, 1>} </li></ul><ul><li>} </li></ul>
72. 72. Declarations <ul><li>Example </li></ul><ul><li>#declare MyPrettyWhite = rgb <1,1,1> </li></ul><ul><li>object { </li></ul><ul><li>sphere {<0, 1.5, 1> 1.5} </li></ul><ul><li>pigment {MyPrettyWhite} </li></ul><ul><li>} </li></ul>
73. 73. Declarations <ul><li>#declare XPosition = 0 </li></ul><ul><li>#declare ZPosition = 1 </li></ul><ul><li>#declare MyPrettyWhite = rgb <1,1,1> </li></ul><ul><li>#declare MyRadius = .5 </li></ul><ul><li>object { </li></ul><ul><li> sphere {< XPosition, .5, ZPosition > MyRadius} </li></ul><ul><li> pigment {MyPrettyWhite} </li></ul><ul><li>} </li></ul>
74. 74. Declarations <ul><li>#declare WhiteBall = sphere { </li></ul><ul><li>< XPosition, MyRadius, ZPosition > MyRadius </li></ul><ul><li>pigment {MyPrettyWhite} </li></ul><ul><li>} </li></ul><ul><li>Now replace the code for each of the objects so that it looks like this: </li></ul><ul><li>object {WhiteBall} </li></ul>
75. 75. Declarations <ul><li>#declare MyPrettyWhite = rgb <1,1,1> </li></ul><ul><li>#declare MyRadius = .5 </li></ul><ul><li>#declare XPosition = 0 </li></ul><ul><li>#declare ZPosition = 1 </li></ul><ul><li>#include &quot;shapes.inc&quot; </li></ul><ul><li>#declare WhiteBall = sphere { < XPosition, MyRadius, ZPosition > MyRadius </li></ul><ul><li>pigment {MyPrettyWhite} } </li></ul><ul><li>camera { location <0, 2.25, -35> direction <0, 0, 10> up <0, 1, 0> right <1.25, 0, 0> look_at <0, 0, 90> } </li></ul><ul><li>//Key Light </li></ul><ul><li>light_source {<50, 100, -80> color MyPrettyWhite} </li></ul><ul><li>//Back Light </li></ul><ul><li>light_source {<100, 50, 80> color rgb <0,0,1>} </li></ul><ul><li>object { plane {y, 0} pigment {MyPrettyWhite} scale 2 } </li></ul><ul><li>#declare BallCount = 1 </li></ul><ul><li>#while (BallCount < 21) </li></ul><ul><li>object {WhiteBall} </li></ul><ul><li>#declare MyRadius = MyRadius + .1 </li></ul><ul><li>#declare XPosition = XPosition + .1 </li></ul><ul><li>#declare ZPosition = ZPosition + 4 </li></ul><ul><li>#declare WhiteBall = sphere { < XPosition, MyRadius, ZPosition > MyRadius pigment {MyPrettyWhite}} </li></ul><ul><li>#declare BallCount = BallCount + 1 </li></ul><ul><li>#end </li></ul>
76. 76. Declarations
77. 77. Transformations <ul><li>Transformations, in ray-tracing terms, are attributes that change the position, size or orientation of objects (and of the various attributes of the objects). </li></ul><ul><li>The most common types of transformations, and the ones that POV-Ray supports, are translations , rotations and scalings . </li></ul>
78. 78. Translation <ul><li>A translation is a transformation that moves an object relative to its current position. </li></ul><ul><li>A translation of <-1,4,2> results in the cube being moved left one unit, up four, and back two. </li></ul>
79. 79. Rotation <ul><li>A rotation is a transformation that changes the orientation of an object (the way that it's facing). </li></ul><ul><li>A rotation of <0,0,45> rotates the cube 45 degrees around the z axis, </li></ul>
80. 80. Rotation <ul><li>if we translated the cube first, and then rotated it </li></ul><ul><li>if we rotated the cube first, and then translated it </li></ul>
81. 81. Scaling <ul><li>Scaling changes the size of the object with respect to its current size. </li></ul><ul><li>If we scaled the object with the string scale <1,4,1>, we would get a result like this </li></ul>
82. 82. Example <ul><li>torus { </li></ul><ul><li>3, 11 </li></ul><ul><li>pigment { color Yellow } </li></ul><ul><li>scale <1.5,1,1> </li></ul><ul><li>rotate <-45,0,0> </li></ul><ul><li>translate <0,2,0> </li></ul><ul><li>} </li></ul><ul><li>This code makes a yellow torus, slightly widened around the x axis, rotated -45 degrees around the x axis and with its center at <0,2,0>. </li></ul>
83. 83. Constructive Solid Geometry <ul><li>The five types of CSG are: Union Merge Intersection Difference Inverse </li></ul>
84. 84. Union <ul><li>Union is a way of joining objects together. </li></ul><ul><li>union{ </li></ul><ul><li>object{greenBox} </li></ul><ul><li>object{redTorus} </li></ul><ul><li>rotate <20, -65, 0> </li></ul><ul><li>} </li></ul>
85. 85. Merge <ul><li>#declare greenBox = </li></ul><ul><li>box{ </li></ul><ul><li><-2, 1, -2>, <2, -1, 2> </li></ul><ul><li>pigment{color rgbf <0, 1, 0, .5>} </li></ul><ul><li>} </li></ul><ul><li>#declare redTorus = </li></ul><ul><li>torus{ </li></ul><ul><li>1.25, // MAJOR radius (0,0,0 to mid-line of ring </li></ul><ul><li>0.5 // MINOR radius (radius of cross section of ring </li></ul><ul><li>pigment{color rgbf <1, 0, 0, .5>} </li></ul><ul><li>translate 1*y </li></ul><ul><li>} </li></ul><ul><li>merge{ </li></ul><ul><li>object{greenBox} </li></ul><ul><li>object{redTorus} </li></ul><ul><li>rotate <20, -65, 0> </li></ul><ul><li>} </li></ul>Render the image and you'll see that the torus now does not extend inside the box.
86. 86. Union and Merge Union Merge
87. 87. Intersection <ul><li>Intersection renders only the areas where the objects in the CSG intersect, or overlap. </li></ul><ul><li>intersection{ </li></ul><ul><li>object{greenBox} </li></ul><ul><li>object{redTorus} </li></ul><ul><li>rotate <20, -65, 0> </li></ul><ul><li>} </li></ul>
88. 88. Difference <ul><li>POV will render the first object minus any following objects. </li></ul><ul><li>difference{ </li></ul><ul><li>object{greenBox} </li></ul><ul><li>object{redTorus} </li></ul><ul><li>rotate <20, -65, 0> </li></ul><ul><li>} </li></ul>
89. 89. Troubleshooting <ul><li>CSG has one major flaw that you should be aware of. When surfaces of CSG objects are identical, strange artifacts can appear. </li></ul><ul><li>difference{ </li></ul><ul><li>object{greenBox} </li></ul><ul><li>box{ </li></ul><ul><li><-1, 1, -1>, <1, -1, 1> </li></ul><ul><li>pigment{color rgb <1, 0, 0>} </li></ul><ul><li>} </li></ul><ul><li>rotate <20, -65, 0> </li></ul><ul><li>} </li></ul>
90. 90. Troubleshooting <ul><li>That is because as rays from the light source(s) reach the two objects, sometimes they hit the red box first, and other times they hit the green box first. </li></ul><ul><li>The problem is eliminated by ensuring the objects in a CSG have &quot;clearance&quot; from each other. Stretching the y values of the red box beyond those of the green box alleviates the problem. </li></ul>
91. 91. Troubleshooting <ul><li>difference{ </li></ul><ul><li>object{greenBox} </li></ul><ul><li>box{ </li></ul><ul><li><-1, 1.5, -1>, <1, -1.5, 1> </li></ul><ul><li>pigment{color rgb <1, 0, 0>} </li></ul><ul><li>} </li></ul><ul><li>rotate <20, -65, 0> </li></ul><ul><li>} </li></ul><ul><li>Rendered without the difference to show the overlap or &quot;clearance.&quot; </li></ul>
92. 92. END