|
![](/i/fill.gif) |
Hi,
I have a script where I load an Object and try to render it. The question is
that every object loaded has its own dimensions. I place it on the center of the
scene but I need to place a light_source at a certain distance.
My code is:
#declare maxcorner = 0;
#declare mincorner = 0;
#declare max_x = 0;
#declare min_x = 0;
#declare max_y = 0;
#declare min_y = 0;
#declare max_z = 0;
#declare min_z = 0;
background {color rgb 0.1}
global_settings {
assumed_gamma 2
ambient_light rgb<1, 0, 0>
}
camera {
orthographic
location <0,200,0>
rotate <23,0,-135>
look_at <0,0,0>
}
sky_sphere
{
pigment
{
gradient y
color_map
{
[0.0 rgb <1.0,1.0,1.0>] //153, 178.5, 255 //150, 240, 192
[0.7 rgb <0.9,0.9,0.9>] // 0, 25.5, 204 //155, 240, 96
}
scale 2
translate 1
}
}
union {
object {
{{MODELNAME}}
Center_Trans({{MODELNAME}}, x+y+z)
texture {
pigment { Red }
finish { ambient 0.1
diffuse 0.9
phong 1 }
}
#declare maxcorner = max_extent({{MODELNAME}});
#declare mincorner = min_extent({{MODELNAME}});
#declare max_x = max(maxcorner.x,mincorner.x);
#declare min_x = min(maxcorner.x,mincorner.x);
#declare max_y = max(maxcorner.y,mincorner.y);
#declare min_y = min(maxcorner.y,mincorner.y);
#declare max_z = max(maxcorner.z,mincorner.z);
#declare min_z = min(maxcorner.z,mincorner.z);
#debug concat("dX: ", str(max_x-min_x, 0, 2), "\n")
#debug concat("dY: ", str(max_y-min_y, 0, 2), "\n")
#debug concat("dZ: ", str(max_z-min_z, 0, 2), "\n")
scale 140 / max3( max_x-min_x, max_y-min_y, max_z-min_z)
FindObjectCenter( {{MODELNAME}} )
}
light_source {
<max_x+100, (max_y-min_y)/2, (max_z-min_z)/2>
color White
}
light_source {
<(max_x-min_x)/2, max_y+500, (max_z-min_z)/2>
color White
}
light_source {
<(max_x-min_x)/2, (max_y-min_y)/2, max_z+100>
color White
}
}
I want to illuminate the three visible planes ( XY, YZ, ZX) and my issue is
that light_source need to get the bounds of the object to be placed accordingly.
What's wrong in my code?
Post a reply to this message
|
![](/i/fill.gif) |