|
![](/i/fill.gif) |
Source code to the above post.
(Also - I know this has been solved a bunch of times before, but this code
should also be useful to anyone wanting to create stereo pairs - just cut out
the random iris sampling stuff, and just set rx to +some_value the -some_value
(and ry to zero), and your got the two stereo render pairs you need.)
#include "transforms.inc"
#declare s = seed( frame_number );
#declare lens_shape =
function {
pigment {
image_map {
png "pentagon-outlined.png"
once
}
}
}
#declare found = false;
#while ( found = false )
#declare test_pos = <rand(s), rand(s), 0>;
#declare test_value = lens_shape( test_pos.x, test_pos.y, test_pos.z ).red;
#if ( pow( rand(s), .333 ) <= test_value )
#declare lens_offset = test_pos - <0.5,0.5,0>;
#declare found = true;
#end
#end
#declare rx = lens_offset.x * 0.05;
#declare ry = lens_offset.y * 0.05;
#declare cam_location = <-10, 8, -15>;
#declare look_location =<3, 3, 3>;
#declare eye_direction = look_location - cam_location;
camera {
perspective
transform {
translate look_location * -1
Reorient_Trans( eye_direction, z )
matrix <1, 0, 0, 0, 1, 0, rx, ry, 1, 0, 0, 0>
Reorient_Trans( z, eye_direction )
translate look_location
}
location cam_location
look_at look_location
angle 60
right x * 1
up y * image_height/image_width
}
light_source {
< -20, 15, -5>
rgb 1
}
plane {
<0.0, 1.0, 0.0>, 0.0
material {
texture {
pigment {
checker
rgb <0.123476, 0.000000, 0.998413>,
rgb <0.107591, 0.993164, 0.000000>
}
finish {
diffuse 0.6
brilliance 1.0
}
}
}
}
sphere {
<0, 6, 0>, 0.5
pigment { rgb 1 }
finish { specular 50 roughness 0.001 }
}
sphere {
<-3, 9, -3>, 0.5
pigment { rgb 1 }
finish { specular 50 roughness 0.001 }
}
sphere {
<3, 3, 3>, 0.5
pigment { rgb 1 }
finish { specular 50 roughness 0.001 }
}
union {
cylinder {
<-5, -5, -5>, <-5, -5, 5>, 0.1
}
cylinder {
<5, -5, -5>, <5, -5, 5>, 0.1
}
cylinder {
<-5, 5, -5>, <-5, 5, 5>, 0.1
}
cylinder {
<5, 5, -5>, <5, 5, 5>, 0.1
}
cylinder {
<-5, -5, -5>, <-5, 5, -5>, 0.1
}
cylinder {
<-5, -5, 5>, <-5, 5, 5>, 0.1
}
cylinder {
<5, -5, -5>, <5, 5, -5>, 0.1
}
cylinder {
<5, -5, 5>, <5, 5, 5>, 0.1
}
cylinder {
<-5, -5, -5>, <5, -5, -5>, 0.1
}
cylinder {
<-5, 5, -5>, <5, 5, -5>, 0.1
}
cylinder {
<-5, -5, 5>, <5, -5, 5>, 0.1
}
cylinder {
<-5, 5, 5>, <5, 5, 5>, 0.1
}
translate y*6
pigment { rgb 1 }
}
Post a reply to this message
|
![](/i/fill.gif) |