|
|
This silly little .pov script will make a random
colloge of images. Four images are stacked (as if they
were photoshop layers) and randomly faded.
Before running the script, add/edit the add_image()
calls to use your images. It is a work in progress so the
code is sort of haphazard. Still, it's neat enough that I
thought some of you would find it interesting.
--
/*
randomly composite pics, sort of like wasshinames "Picture Garden"
proggy on the miggy.
*/
#ifndef (rseed)
#declare rseed = seed(24875300);
#end
#declare amiga = true; // set to false for windows gamma
global_settings {
#if (amiga = true)
assumed_gamma 2.4
#else
assumed_gamma 2
#end
number_of_waves 10
max_trace_level 20
}
camera {
location 0
orthographic
right <1, 0, 0>
up <0, 1, 0>
translate <0, 0, -10>
}
#macro do_random_pure_color() // returns an RGB vector
#local xx = int(6 * rand(rseed));
#switch (xx)
#case (0)
#local rcolor = <1, rand(rseed), 0>;
#break
#case (1)
#local rcolor = <1, 0, rand(rseed)>;
#break
#case (2)
#local rcolor = <rand(rseed), 1, 0>;
#break
#case (3)
#local rcolor = <rand(rseed), 0, 1>;
#break
#case (4)
#local rcolor = <0, 1, rand(rseed)>;
#break
#else
#local rcolor = <0, rand(rseed), 1>;
#end
rcolor // return color
#end
// if you use png, add a png type.
#declare tga_type = 0;
#declare gif_type = 1;
#declare iff_type = 2;
#declare sys_type = 3;
#declare max_pics = 50;
#declare num_pics = 0;
#declare pic_list = array[max_pics]
#declare pic_type_list = array[max_pics]
#macro add_pic(pic_type, pic_name)
#declare pic_type_list[num_pics] = pic_type;
#declare pic_list[num_pics] = pic_name
#declare num_pics = num_pics + 1;
#end
/* Here is where you put in the name of your image files!
Have one "Add_pic" call per picture */
add_pic(tga_type, "ea1_big.tga")
add_pic(tga_type, "alexie-saile.tga")
add_pic(tga_type, "otrek_br_1.tga")
add_pic(gif_type, "pmk_tanker.gif")
add_pic(tga_type, "devo_control_room.tga")
add_pic(tga_type, "pipe_corridor.tga")
add_pic(tga_type, "otrek_br_1.tga")
add_pic(tga_type, "room_br.tga")
add_pic(tga_type, "trek_space2.tga")
add_pic(tga_type, "trek_space3.tga")
add_pic(tga_type, "trek_space4.tga")
// pick & make first layer
#declare which_pic = int(num_pics * rand(rseed));
#declare back_zone = pigment {
image_map {
#switch(pic_type_list[which_pic]) // bitmap type
#case (gif_type)
gif
#break
#case (iff_type)
iff
#break
#case (sys_type)
sys
#break
#else
tga
#end
pic_list[which_pic] // bitmap name
}
translate <-0.5, -0.5, 0>
}
// pick & make second layer
#declare which_pic = int(num_pics * rand(rseed));
#declare middle_zone = pigment {
image_map {
#switch(pic_type_list[which_pic]) // bitmap type
#case (gif_type)
gif
#break
#case (iff_type)
iff
#break
#case (sys_type)
sys
#break
#else
tga
#end
pic_list[which_pic] // bitmap name
}
translate <-0.5, -0.5, 0>
}
// pick & make top layer
#declare which_pic = int(num_pics * rand(rseed));
#declare top_zone = pigment {
image_map {
#switch(pic_type_list[which_pic]) // bitmap type
#case (gif_type)
gif
#break
#case (iff_type)
iff
#break
#case (sys_type)
sys
#break
#else
tga
#end
pic_list[which_pic] // bitmap name
}
translate <-0.5, -0.5, 0>
}
// pick & make layer above top layer
#declare which_pic = int(num_pics * rand(rseed));
#declare extra_top_zone = pigment {
image_map {
#switch(pic_type_list[which_pic]) // bitmap type
#case (gif_type)
gif
#break
#case (iff_type)
iff
#break
#case (sys_type)
sys
#break
#else
tga
#end
pic_list[which_pic] // bitmap name
}
translate <-0.5, -0.5, 0>
}
#declare clear = texture {
pigment { color rgbt <1, 1, 1, 1> }
finish { ambient 1 diffuse 0 }
}
#macro do_layer_sweep(pigm, z_off)
#if (rand(rseed) > 0.5)
#local which_dir = <1, 0, 0>;
#else
#local which_dir = <0, 1, 0>;
#end
polygon {
5,
<-0.5, 0.5, z_off>,
< 0.5, 0.5, z_off>,
< 0.5, -0.5, z_off>,
<-0.5, -0.5, z_off>,
<-0.5, 0.5, z_off>
texture {
gradient which_dir
#local g1 = 0.5 * rand(rseed);
#local g2 = (1 - g1) * rand(rseed);
#local g2 = max(0.2, g2);
#local g2 = g2 + g1;
texture_map {
[ g1 clear ]
[ g2
pigment { pigm translate 0.5 * which_dir }
finish { ambient 1 diffuse 0 }
]
} // end of texture map
translate -0.5 * which_dir
#if (rand(rseed) > 0.2)
scale <-1, 1, 1> // reverse (flip) picture left-right
#end
} // end of texture
} // end of box
#end
#macro do_layer_frame(pigm, z_off)
#local g1 = 0.2 + 0.2 * rand(rseed);
#local t1 = texture {
gradient <0, 1, 0>
frequency 2
texture_map {
[ 1 - g1 clear ]
[ 1
pigment { pigm }
finish { ambient 1 diffuse 0 }
]
} // end of texture map
} // end of texture local
polygon {
5,
<-0.5, 0.5, z_off>,
< 0.5, 0.5, z_off>,
< 0.5, -0.5, z_off>,
<-0.5, -0.5, z_off>,
<-0.5, 0.5, z_off>
texture {
gradient <1, 0, 0>
frequency 2
texture_map {
[ 1 - g1 t1 ]
[ 1 pigment { pigm } finish { ambient 1 diffuse 0 } ]
}
}
} // end of box
#end
#macro do_layer_spot(pigm, z_off)
#render "\ndo layer spot\n"
#local which_offset = int(5 * rand(rseed));
#switch (which_offset)
#case (0)
#local poffset = <-1/6, -1/6, 0>;
#break
#case (1)
#local poffset = <-1/6, 1/6, 0>;
#break
#case (2)
#local poffset = < 1/6, -1/6, 0>;
#break
#case (2)
#local poffset = < 1/6, 1/6, 0>;
#break
#else
#local poffset = <0, 0, 0>;
#end
#local t1 = texture {
spherical
translate poffset
texture_map {
[ 0.75 clear ]
[ 0.9
pigment { pigm translate -poffset }
finish { ambient 1 diffuse 0 }
]
} // end of texture map
} // end of texture local
polygon {
5,
<-0.5, 0.5, z_off>,
< 0.5, 0.5, z_off>,
< 0.5, -0.5, z_off>,
<-0.5, -0.5, z_off>,
<-0.5, 0.5, z_off>
texture {
t1
}
} // end of box
#end
#macro do_layer_mix(pigm, z_off)
polygon {
5,
<-0.5, 0.5, z_off>,
< 0.5, 0.5, z_off>,
< 0.5, -0.5, z_off>,
<-0.5, -0.5, z_off>,
<-0.5, 0.5, z_off>
texture {
average
texture_map {
[ 2 clear ]
[ 1 pigment { pigm } finish { ambient 1 diffuse 0 } ]
}
}
} // end of box
#end
#macro do_layer(pigm, z_off)
#local which_method = int(5 * rand(rseed));
#switch (which_method)
#case (0)
do_layer_frame(pigm, z_off)
#break
#case (1)
#case (2)
do_layer_spot(pigm, z_off)
#break
#case (3)
do_layer_mix(pigm, z_off)
#break
#else
do_layer_sweep(pigm, z_off)
#end
#end
polygon {
5,
<-0.5, 0.5, 0>,
< 0.5, 0.5, 0>,
< 0.5, -0.5, 0>,
<-0.5, -0.5, 0>,
<-0.5, 0.5, 0>
// do back layer
texture {
pigment { back_zone }
finish { ambient 1 diffuse 0 }
}
}
// do middle layer
do_layer(middle_zone, -0.01)
// do top layer
do_layer(top_zone, -0.02)
// do extra top layer
do_layer(extra_top_zone, -0.02)
/* actual end of this file */
Post a reply to this message
|
|