Hello POV-Ray

End-of-summer draft postings cleanup time! I found this piece of code I wanted to share but never had the time to. The code is in the POV-Ray programming language. "POV-what?" you might think. Well, from the hourse's mouth:

http://www.povray.org:
--
The Persistence of Vision Raytracer is a high-quality, totally free tool for creating stunning three-dimensional graphics. It is available in official versions for Windows, Mac OS/Mac OS X and i86 Linux. The source code is available for those wanting to do their own ports.

Maybe a year or so ago, I played with it, and here's the result.

teardrop2.png

Funny, isn't it? But don't judge me too harsh, I'm the first to admit my design and color matching abilities as trully very limited.

Anyway, here's the code, I hope you can make sense from the limitted amount of comments.

#include "shapes.inc"
#include "colors.inc"
#include "textures.inc"
#include "shapesq.inc"
#include "metals.inc"
#include "skies.inc"

// drop definition
#declare drop = object {
   Piriform
   sturm
   rotate -90*z
   translate 0.5*y
   
   scale <0.5, 2, 1>
   texture {
      pigment { P_Cloud1 }
      finish { F_MetalB }
   }
}

// add 5 drops
object {
    drop
    //pigment { Col_Fluorite_01 }
    translate -1.5*x
}
object {
    drop
    //pigment { Col_Fluorite_02 }
    translate 0.8*y
    translate 15.5*z
    translate 0.5*x
}
object {
    drop
    translate .5*z
    translate 1.9*x
}
object {
    drop
    translate 2.5*z
    translate 1.5*y
    translate -0.8*x
}
object {
    drop
    translate -1.5*z
    translate 1.8*y
    translate 2.5*x
}
 

// some clouds
O_Cloud1

// this is the sky 
sky_sphere {
    pigment {
        gradient y
        color_map {
            [0 color Blue]
            [1 color Brown]
        }
    scale 1.5
    translate -11
    }  

}

// the ground
plane { 
    y, -1.5
    pigment { checker pigment{Jade}, pigment{Yellow} }   
    //finish { reflection {1.0} ambient 0 diffuse 0 }  
    finish { reflection { 0.03, 0.81 }}
}

// camera, light ... shoot!
camera {
    location <0, 1, -8>
    look_at 0
    angle 43
}

light_source { 
    <200, 150, 100> White    
    //projected_through {O_Cloud2}
}

Warning before anyone dives into POV-Ray: It's a time killer! Once you get hooked you might suffer from sudden lapse of sleep. ;) BTW, in the pov-ray programming manual there are some clever bits that start with "You know you have been raytracing too long when ...". I can totally relate to this one:

You know you have been raytracing too long when ...
... You want to cheat and look at nature's source code.
-- Mark Stock

In case you thought JavaScript could be tough...

This entry was posted on Thursday, August 31st, 2006 and is filed under 3d, pov-ray, tools. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

2 Responses to “Hello POV-Ray”

  1. Boštjan Says:

    JavaScript raytracer also exists :) http://slimeland.com/raytrace/. I have also written a modification for it, wich renders image on canvas instead of writing colored table cells 1×1 px.

  2. Mike Edward Moras (e-sushi™) Says:

    Actually, you might want to take a look at WebGL and create your 3D world(s) in an web-compatible OpenGL environment. Adding a few pinches of javascript, you’ll be running through your own landscapes… and it’s sure faster than “raytracing” a canvas.

    Why am I writing this? You might not be aware of it yet, but sooner or later you’ll desperately want to animate things fluently and even create a game or two. ;)

Leave a Reply