Contents
HomePage


[POV RAY]

POV-Ray for Beginners - Part 2

By Adam Foster...

In the last tutorial, I showed you how to use the basics of the Persistence of Vision Raytracer, POV-Ray. You should now be able to place various shapes wherever you like in 3D, define their colours and the lighting, and finally raytrace it. In this tutorial, I will demonstrate the basics of a very powerful part of POV-Ray, the Construtive Solid Geometry (CSG), and how to use the supplied textures and colours.

What is CSG then? Basically it's a method of putting shapes together in order to make more complex ones. You can 'cut' a sphere out of a cube, in order to make a hemispherical depression, or 'add' it to the cube, making a hemispherical bulge. There's a lot you can do, as shown by the example file below. Type it out, render it and see what you get.


camera{
  location <0, 9, -15>
  look_at <0, 4, 0>
}

light_source { <20, 70, 0> color rgb <1.0, 1.0, 1.0> }
light_source { <-30, 30, -8> color rgb <1.0, 0.9, 0.9> }

object {
  difference {
    intersection {
      box { <-4, 0, -4>, <4, 8, 4> }
      sphere { <0, 4, 0> 5.1 }
    }
    sphere { <0, 4, 0> 4.6 }
  }
  pigment { rgb <0.9, 0.4, 0.5> }
}

plane { y, -1.0
  pigment { rgb <0.2, 0.2, 1.0> }
}

For those of you who can't wait, I've rendered it for you.

[Small example]

As you can see, it isn't an ordinary shape at all! You may be able to see what all these new commands do, such as intersection, difference and so on, but here's a quick explanation.

Union

This command is like digital 'glue', in that you can use it to stick objects together. It is possible to simply place the objects together without it, so you get the same results, but it should be noted that after using a union command, you can rotate, scale and move the resulting composite without any problems. Something else to note is that if a shape within the union is given a different colour, it stays that colour when rendered. An example of a union is shown below.

      union {
        sphere { <0, 0.5, 0> 1 pigment { Red } { rgb <{ Rnt }

plent { .2,; }


For those of you who can't wait, I've rendered it for you.

[Small example]

As you can see, it isn't an ordinary shape at all! You may be able to see what all these new commands do, such as intersection, difference and so on, but here's a quick explanation.

Union

This command is like digital 'glue', in that you can use it to stick objects togetheit ,e oe athe. Isunion command, you can rotate, scale and move the resulting composite without any problems. Something else to note is that if a shape within the union is given a different colour, it stays that colour when rendered. An example of a union is shown below.

      union {
        sphere { <0, 0.5, 0> 1 pigment { Red } { rgb <{ Rnt }

plentt5/possi th

plethe same
[Small example]

As you can see, it isn't an ordinary shape at all! You may be able to see what all these new commands do, such as intersection, difference and so on, but here's a quick explanation.

Union

This command is like digital 'glue', in that you can use it to stick objects togetheit ,e oe athe. Is, ikeect.o and so on, bu. Isn. ctse

U n

command, you can rotate, scale and move the resulting composite without any problems. Something else to note is that if a shape within the union is given a different colour, it stays that colour when rendered. An example of a union is shown below.

      union {
        sphere { <0, 0.5, 0> 1 pigment { Red } { rgb <{ Rnt }

plentt5/possi th

plethe same
< sr"po2_a.gif" ALT="[Smaane srALT ex>

As you can see, it isn't an ordinary shape at all! You may be able to see what all these new commands do, such as intersection, difference and so on, but here's a quick explan