Tuesday, February 12, 2013

SVG Cave: Beginnings

/*
The point of this file is to create something in POV-Ray that would be too hard to make in SVG. I want something that looks artistic and impresses me more than the lighthouse I lost.

Challenge is to compleete it within a year.

Components:
a crystal that can make prisms of light and seperates the spectra a little.
For this I think may need a narrow light beam.

Shadows, to that end I think I'll place asome fire

movement, I dont understand smil programmed image movies so I'll do it here.

General idea:
a cave scene with a black shillouette of a man infrount of a flickering fire, with a crystal growing from the wall to the left.
Then if the fire actually looks OK, movement of the camera, still looking at the fire. then once you see the fire, start to look at the man. He then moves quickly towards the camera, so the scene ends all black.

I'm intending to blog the progress, sort of like a turorial. This will require a little more organization in the beginning and a lot more comments. But then I also get to be a better programmer.

#
Fist need the cave, then a light souce, make it so that it looks like an orb and is in the center. Plus the all important camera. With this I should have a visible scene.

#
Then add some texture to the walls, probably some ovoid bolders too.

#
Crystal to the side, now there should  be somewhere for the light to play, may need to be slightly irridesent to make sure it is always visible itself.
Possibly also need to use photon mapping, needs more research.

#
Locate the silhouette, just a simple shape. 3 sphears and a rectangle or two.
Detemine a possible camera path.
Here I may also be able to test out the movie generation. For for the following I'll need to not have the silhouette.

#
make a log ember:
will need to have some light surfaces that phase red and yellow. then overlay a black cracked texture onto a cylnder.
Probably need sinewaves and rand here, but the seed must be consistant if I use a movie
Duplicate, rotate and translate the log under the orb to form a fireplace a few times.
the timing here will be a simple cycle, offset for each log and constantly repeating.

#
Make a flickering flame:
replace the light orb with a new shape, still using the looks like function.
A teardrop of white, possibly an ovoid with cone and covered by the blob function. This can be the center that always remains.
on top of this i'd like a series of possible shapes of which 2 are always visible.
Hopefully then the light output will act both as a point light source and as an area light.
This will require a lot of testing to see if it is beleivable. May need a rock embedded in the floor to watch the shadows as well as the crystal. If the flame is too odd, then I'll have the camera never look at it directly.
Say I have ~3 fundamental shapes of each size, the colours can vary blue>white and red>yellow. Size can pulse a little and the shape can be rotated about the y axis and be translated a small ammount onthe x and z axis's.

#
Re-place the shillouette and run the movie;
1 stationary, to see the shadows and crystal
2 have the camera path bob up and down, and move in an arc around the figgure, looking at the fire.
3 Stop at the fire, with the crystal behind the shiluette.
4 Look towards the shilluette. At that time have the shiluette grow and evelope everything in darkness as it moves closer to the camera.
Save the photon map on the first scene?

*/


#include "colors.inc"
#include "finish.inc"
#include "math.inc"

//what will become a flame
light_source
{
    <0,0,0> rgb <1,1,1>
    looks_like
    {
            sphere
        {
            <0,0,0>, 20//to just be touching the ground
            texture {pigment{rgb <1.1,1>} }
            }
            finish { ambient 1 }
    }
    shadowless
    fade_distance 700
    fade_power 1
}

//what will eventually move
camera {
   location <0, 145, -700>//units in centimeters, so I am 1.50m tall and 7m from the fire (lowwered the height by 5cm to correct the location of my eyes :)
   look_at <0,10,0>//10cm above the ground
}

//the ground
plane {y,-100 texture {pigment{rgb <0.2,0.7,0.5> } }}// will pretty this up later

//the outside shell of the scene, may need modifiers to be an inside shape.
sphere
{
    <0,0,0>, 1000// ten meter diammeter
    inverse
    pigment { Grey }//again will have to pretty this up, probably both texture and colour
}

#declare MossyOvoid =
difference
{
        blob
        {
                threshold 0.99
                sphere { <-15,0,0>,15, 1.5 pigment {Blue} }
                sphere { < 15,0,0>,30, 1.5 pigment {Pink} }
                //moss covering here
            finish { phong 1 }
        }
          sphere { < 15,0,0>,15 }

}

object
{
    MossyOvoid
    scale 15
    rotate z*45
    translate <300,0,60>
}

object
{
    MossyOvoid
    scale 15
    translate <0,0,1000>
    rotate <30,0,60>//this orbits the ovoid around the origen, ensuring it remains on the edge of the cave.
}
object
{
    MossyOvoid
    scale 200
    translate <-100,0,0>
    rotate <30,0,60>
}



/*
OK so this is a start, the ovoid while egglike is not centered properly
only one object is viible
the cave is rather small

*/