Ray Tracing with POV-Ray: 25 scenes in 25 days (2013)

93
Ray Tracing with POV-Ray: 25 scenes in 25 days (2013)

Four years ago, I wrote a truly uncomplicated ray tracer in Java to render a
scene laborious-coded in the provision code. After writing this ray tracer, I
came to grab about subtle ray tracing engines on hand without cost
on the fetch. POV-Ray perceived to be one of many most customary engines
and I definite to study to utilize it. Alternatively, I in no contrivance managed to commit
time to studying it in the ideal four years. Lastly, in Can also merely 2013, I
decided to educate myself to enact ray tracing with POV-Ray. This job
consisted of studying the ideas required to jot down scene descriptions
for POV-Ray, and writing a recent scene day after day for 25 days in the month
of Can also merely 2013.

Contents

A scene a day

  1. Balls and containers

    Balls and boxes

    This scene contains three spheres and three containers. The scene is
    illuminated by three level light sources.

    One light offer is bright from the stop upright corner of the scene.
    This light offer is in the attend of the digicam. This casts the shadow of the
    inexperienced field on the blue ball and that of the blue ball on the yellow
    one.

    One other one is bright from the left facet of the scene. This light
    offer is furthermore in the attend of the digicam. This casts the smaller shadow of
    the crimson field on the blue ball, that of the inexperienced field on the orange
    ball and that of the blue ball on the pale crimson field.

    There is a third light offer on the bottom upright corner of the
    scene. This light offer is impart a exiguous in entrance of the digicam.
    This casts the longer shadow of the crimson field on the blue ball.

  2. Transformed Boxes

    Transformed Boxes

    The white field is centred on the birth put. The digicam is placed 10
    devices in the attend of the starting up put. One light offer is placed 10 devices in the attend of
    the starting up put, i.e. on the identical pickle the put the digicam is. There may perchance be
    any other light offer bright from the stop left corner of the scene.

    All containers with the exception of the three containers in the bottom-upright quadrant of
    this characterize have the identical dimensions as that of the white field.

    The crimson field is translated to <2, 2, 2>, i.e. 2 devices left from
    the starting up put, 2 devices above the starting up put and a pair of devices extra away from
    the starting up put in the direction perpendicular to the characterize.

    The inexperienced field is translated to <5, 5, 2>, i.e. it has been
    shifted extra skill against the stop upright corner. As a consequence we’re going to have the option to
    stare more of its left and bottom faces.

    The blue field is translated to <5, 5, 5>, i.e. it is miles placed 3
    devices in the attend of the inexperienced field. As a consequence it appears smaller than the
    inexperienced field.

    The yellow field is first circled around z axis by 45° after which
    shifted left by 5 devices

    The cyan field is first shifted left by 5 devices after which the sphere is
    circled around z axis by 45°. In the rendered characterize, it’ll
    be considered that the total field as a total orbits around the z axis due
    to the rotation and occupies a recent pickle 45° away from the
    yellow field in this orbit.

    The scale of the brown field is first doubled alongside x axis, then it
    is circled 45° around y axis. As a consequence, the elongated face
    is circled against left. Then it is miles translated to a recent pickle
    beneath the starting up put, a exiguous extra away against the upright.

    The crimson field is first circled 45° around y axis. Then it is miles
    scaled by a component of 2 alongside x axis. As a consequence, the diagonal of
    the sphere working alongside x axis appears to be elongated. Lastly, this
    field is translated and placed upright beneath the brown field.

    The maroon field is first circled alongside y axis by 45°. Then it
    is translated to a recent pickle upright beneath the crimson field. Lastly,
    it is miles scaled by a component of 2 alongside the x axis. As a consequence, the sphere
    appears to have moved extra alongside the x axis. Furthermore, its diagonal
    alongside the x axis appears to be stretched.

  3. Marble Sphere in Rubber Torus

    Marble Sphere in Rubber Torus

    There are two light sources in this scene: one the put the digicam is
    situated, and any other on the left facet of the scene.

    The sphere and the torus appear to be specular as a consequence of Phong
    highlighting. As a consequence, two bright bright spots may perchance perchance also furthermore be considered on the
    sphere as smartly. One pickle is closer to the digicam while the assorted one
    is on the left facet of the sphere. These spots are as a consequence of the 2
    light sources. An identical but fainter bright spots may perchance perchance also furthermore be considered on the
    torus as smartly. The specular highlights on the torus seem fainter
    on legend of a less saturation mark used to be used for the Phong highlighting
    used to be used for the torus.

    To boot to to making the sphere specular, it has furthermore been made
    a exiguous reflective. As a consequence, a faint reflection of the torus
    may perchance perchance also furthermore be considered in the bottom hemisphere of the sphere.

  4. Crystal Ball

    Crystal Ball

    There are two light sources in this scene: one on the centre of the
    ceiling and any other on the stop of the wall opposite to the digicam.
    The walls are bright, and thus deem the scene a exiguous.

    There is a deem on the wall opposite to the digicam. The deem has
    a wooden body. The reflection of a door in the wall in the attend of the
    digicam may perchance perchance also furthermore be considered in the wall opposite to the digicam.

    There is a crystal ball placed on a wooden block. There are two
    varied coloured balls lying on the floor.

  5. Prisms

    Prisms

    The room in this scene is expounded to the room in the outdated scene.
    Alternatively, in this scene the floor is reflective in pickle of the walls.
    The balls are missing from this scene and there are two prisms
    as a change on the wooden block. The reflection of the door in the attend of the
    digicam may perchance perchance also furthermore be considered in the deem on the wall opposite to the digicam.

  6. Ripples

    Ripples

    This scene incorporates a rubber tube floating on water. There are
    ripples on the surface of water. The ripples had been made a exiguous
    turbulent in show to rating it stare a exiguous pure.

  7. Textures

    Textures

    This scene incorporates a wooden block and spheres with varied textures
    placed on the floor of a room. The block is manufactured from pine wood. There
    is a ruby glass sphere placed on the block. There is a crimson granite
    sphere placed between the deem and the wooden block. The leftmost
    sphere is manufactured from white marble. The one to its upright is manufactured from
    brown agate. The following sphere that appears dark is manufactured from blue agate.
    The reflective sphere on the floor is manufactured from aluminium. The
    rightmost sphere is manufactured from crimson marble. The deem on the attend reveals
    a reflection of the scene.

  8. Window

    Window

    This scene reveals light entering a room thru a window. Isotropic
    scattering makes the light beam coming thru the window considered.

  9. Sky and Water

    Sky and Water

    This scene incorporates water and sky. The sky incorporates clouds and the
    water incorporates irregular ripples. The water shows the sky.

  10. Soft Shadows

    Soft Shadows

    This scene incorporates a pair of marble balls and metal rods placed on a
    wooden plank. The scene is illuminated by three pickle light sources.
    The pickle light sources solid gentle shadows. The sunshine sources depart
    away with distance. As a consequence, the scene on the stop left corner of
    the characterize appears to be darker than the relaxation of the scene. The gentle
    shadows and the fading light sources rating this characterize seem quite
    photorealistic.

  11. Focal Blur

    Focal Blur

    This scene incorporates six coloured balls lying on a tiled floor. The
    digicam is focussed on the white ball on the centre. The shallow
    depth of field causes varied balls to blurred.

  12. Pawns

    Pawns

    This scene incorporates a white pawn and a shaded pawn placed on a
    chessboard. There are two light sources bright on the chessboard:
    one from the left facet and one in the attend of the chessboard.

  13. Glass Pawns

    Glass Pawns

    This scene incorporates glass pawns placed on a tumbler chessboard.

  14. Globe

    Globe

    This scene incorporates a globe placed on a bright surface. The globe
    used to be created by wrapping a design of the earth around a sphere. The design
    used to assemble this globe may perchance perchance also furthermore be learned in the maps itemizing.

  15. Saturn

    Saturn

    This scene is an try to mannequin Saturn alongside with its five
    renowned rings. The planet and the rings are drawn to scale.

    The innermost ring is the D ring. The following ring that appears to be
    translucent is the C ring. The following opaque ring known because the B
    ring. Then there is a hole known as the Cassini Division. After this
    division, lies the A ring. The A ring incorporates a skinny hole known as the
    Encke Hole. The outermost thin ring is the F ring. The region between
    the A ring and the F ring known because the Roche Division.

    The shadow of the gas huge on the rings may perchance perchance also furthermore be considered in the upright
    facet of this characterize.

  16. Planets

    Planets

    This scene represents the devices of the eight planets of our solar
    system. The sizes of the planets are to scale in this scene. Names
    of the planets from left to upright: Jupiter, Saturn, Uranus, Neptune,
    Earth, Venus, Mars and Mercury.

  17. Moon

    Moon

    This scene incorporates a waxing half of moon. This scene used to be created by
    wrapping a design of the moon around a sphere and rotating the sphere
    in show to suppose the facet of the moon that’s considered from the
    Earth.

  18. Canoe

    Canoe

    This scene incorporates a white canoe floating on water. The hull of the
    canoe has been modelled the utilization of ellipsoids. The hollow half of the
    hull has been modelled by laying aside smaller ellipsoids from a smartly-organized
    ellipsoid that sorts the outer surface of the hull of the canoe. The
    canoe incorporates three wooden seats. The water is a exiguous reflective.
    The water shows the sky, and thus appears blue in coloration. A
    distorted reflection of the canoe may perchance perchance also furthermore be considered in the water.

  19. Eggs

    Eggs

    This scene incorporates half of a dozen eggs lying on a tiled surface. Every
    egg is modelled by combining halves of a prolate ellipsoid and a
    sphere. The ellipsoid is minimize into two halves on the equator. One
    half of is used to mannequin the exiguous conclude of each egg. The unheard of conclude of
    each egg is fashioned the utilization of a hemisphere minimize off from the sphere. The
    size of the semi-famous axis of the prolate ellipsoid is 1.6 times
    that of its semi-minor axis. The tiled surface on which the eggs are
    kept are a exiguous bright and reflective. Two fading pickle light
    sources had been used to light up the scene. One light offer
    shines from the left facet of the scene. The varied light offer
    shines from the digicam.

  20. Glass of Water

    Glass of Water

    This scene incorporates a tumbler of water. There may perchance be most efficient one level light
    offer in this scene bright from the left facet. The water has been
    modelled as a material with refractive index of 1.33. The reflection
    of light by the water has been modelled the utilization of Fresnel reflection.

  21. Glass Grid

    Glass Grid

    This scene incorporates a grid manufactured from glass nodes and edges. Every node
    in the grid is spherical. Every edge is cylindrical. The edges
    join adjacent nodes.

  22. Earth and Sky

    Earth and Sky

    This scene reveals the earth and sky meeting on the horizon. A faint
    fog may perchance perchance also furthermore be considered conclude to the horizon. The shadows of the clouds may perchance perchance also furthermore be
    considered on the ground. A viewing angle of 90° has been used to mannequin
    the digicam.

  23. Glasses

    Glasses

    This scene incorporates two glasses kept in a kitchen corner. The
    kitchen has tiled walls. A faint reflection of the window in the
    kitchen may perchance perchance also furthermore be considered on the wall in the attend of the wine glass. Gentle
    entering from this window illuminates the kitchen. There may perchance be any other
    yellow light offer connected to the stop of the wall in the attend of the
    glasses.

  24. Kaleidoscope

    Kaleidoscope

    This scene reveals the internal judge about of a kaleidoscope. The kaleidoscope
    is constructed the utilization of three rectangular mirrors placed at 60° angle
    to one any other so as that they assemble an equilateral triangle fashioned
    empty pickle between them. The triangular empty pickle between the
    mirrors may perchance perchance also furthermore be spotted by procuring for the orange disc on the centre
    of this characterize. The crimson, inexperienced and purple discs around this orange
    disc are placed at three corners of this triangle.

    There are a pair of more objects, reminiscent of colored grains, exiguous
    pyramids and pearls placed in this empty pickle. A pair of reflections
    of those objects may perchance perchance also furthermore be considered in the three mirrors surrounding the
    empty pickle. The reflection of the empty pickle may perchance perchance also furthermore be considered as faint
    dark triangles during this scene.

  25. Cube

    Dice

    This scene incorporates three glass dice placed on a wooden surface. The
    scene is illuminated by three fading pickle light sources.

Installation of POV-Ray

The scenes above were rendered the utilization of POV-Ray 3.6 on a Debian system. The
steps beneath characterize how POV-Ray 3.6 used to be attach in.

  1. Acquire POV-Ray 3.6 for Linux from
    http://www.povray.org/ftp/pub/povray/Smartly-behaved/Linux/povlinux-3.6.tgz.
    In case, the above URL turns into unavailable in future, a copy of the
    tarball may perchance perchance also furthermore be received from tgz/povlinux-3.6.tgz.

  2. Enter the next instructions to begin up installation.

     tar -xvzf povlinux-3.6.tgz
     cd povray-3.6
     bash set up -no-arch-take a look at
    
  3. Enter U to rating a particular person degree installation at a custom region.

  4. Enter ~/povray because the custom region to set up POV-Ray.

  5. Enter the next instructions to guage concerning the version and wait on message of
    povray and its man internet page.

     ~/povray/bin/povray
     man -M ~/povray/man/ povray
    
  6. Add the next line to ~/.bashrc.

     export PATH=$PATH:~/povray/bin
    

    Now povray may perchance perchance also furthermore be done and its man internet page may perchance perchance also furthermore be considered from any
    itemizing merely by entering the next instructions.

The following errors were faced for the interval of installation:

  1. On making an attempt to set up by executing ./set up, the next
    error used to be displayed:

     This machine doesn't appear to be a Linux PC.
    

    This error took place on legend of the script looks for i?86* or
    athlon* in the output of uname -m, but the output on my system
    used to be: x86_64.

  2. On executing ./set up -no-arch-take a look at, the next error
    used to be displayed:

     ./set up: 1094: study: Unlawful option -n
    

    This error took place on legend of the script is done by /bin/sh
    by default. This used to be resolved by executing the script with bash.

POV-Ray instructions

The following is a record of instructions that were done to render varied
scenes.

povray -W960 -H720 scene01.pov
povray -W960 -H720 scene02.pov
povray -W960 -H720 scene03.pov
povray -W960 -H720 +A0.0 scene04.pov
povray -W960 -H720 +Q9 +A0.0 +AM2 +R5 -J scene05.pov
povray -W960 -H720 +A0.0 +AM2 scene06.pov
povray -W960 -H720 +A0.0 +AM2 scene07.pov
povray -W960 -H720 +A0.0 scene08.pov
povray -W960 -H720 +A0.0 +AM2 scene09.pov
povray -W960 -H720 +A0.0 scene10.pov
povray -W960 -H720 scene11.pov
povray -W960 -H720 +A0.0 +AM2 scene12.pov
povray -W960 -H720 +A0.0 scene13.pov
povray -W960 -H720 +A0.0 +AM2 scene14.pov
povray -W960 -H720 +A0.0 +AM2 scene15.pov
povray -W960 -H720 +A0.0 +AM2 scene16.pov
povray -W960 -H720 +A0.0 +AM2 scene17.pov
povray -W960 -H720 +A0.0 +AM2 scene18.pov
povray -W960 -H720 +A0.0 scene19.pov
povray -W960 -H720 +A0.0 +AM2 +R5 -J scene20.pov
povray -W960 -H720 +A0.0 +AM2 -J scene21.pov
povray -W960 -H720 +A0.0 +AM2 scene22.pov
povray -W960 -H720 +A0.0 +AM2 -J scene23.pov
povray -W960 -H720 +A0.0 +AM2 scene24.pov
povray -W960 -H720 +A0.1 +AM2 scene25.pov

Respect URLs

The following is a record of tutorials and articles I studied to educate
myself some elementary ray tracing with POV-Ray.

  1. The Online POV-Ray Tutorial: Introduction to POV-Ray and Ray-tracing
  2. The Online POV-Ray Tutorial: POV-Ray Basics
  3. The Online POV-Ray Tutorial: Atmosphere up Easy Scenes
  4. The Online POV-Ray Tutorial: Evolved POV-Ray Functions
  5. 4 tricks to bolster a truly uncomplicated POV-Ray scene
  6. Slope design tutorial
  7. How one can Render Planets

Conclusion

Some prior details of coordinate geometry used to be priceless in describing
one of the scenes. I learned the POV-Ray scene description language
fairly uncomplicated and straightforward to study. In these 25 days, I managed to study a
number of precious points and tips from online tutorials, articles,
on hand offer code of POV-Ray scenes described by varied POV-Ray
users, and managed to characterize and render many uncomplicated scenes. Alternatively,
there were quite a lot of alternate solutions, points, language directives, effects,
and so forth. that I could perchance perchance also not fetch time for in these 25 days. This stuff can
be learnt in future by studying the legit POV-Ray documentation.

License

Right here’s free and originate offer system. That that you just may perchance perchance perchance utilize, replica, alter,
merge, submit, distribute, sublicense, and/or promote copies of it,
below the phrases of the MIT License. Locate LICENSE.md for minute print.

This method is supplied “AS IS”, WITHOUT WARRANTY OF ANY KIND,
say or implied. Locate LICENSE.md for minute print.

Knowasiak
WRITTEN BY

Knowasiak

Hey! look, i give tutorials to all my users and i help them!