POV-Ray : Newsgroups : povray.general : Place light_source based on object bounds : Re: Place light_source based on object bounds Server Time
29 Jul 2024 00:35:23 EDT (-0400)
  Re: Place light_source based on object bounds  
From: Le Forgeron
Date: 3 Oct 2013 02:55:42
Message: <524d14ee@news.povray.org>
Le 02/10/2013 23:31, apalabrados a écrit :
> 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.
> 

> camera {
>         orthographic
>         location <0,200,0>
>         rotate <23,0,-135>
>         look_at <0,0,0>
> }
> 

> 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}});

> 
> 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?

1. minor: The camera use a rotate to be placed, so it's difficult to
know where it is actually.
2. you used 3 lights sources (good), but with the same intensity. Usual
three-lights settings have a frontal/side/fill approach, with huge
frontal, medium side for a bit of relief and low fill to avoid pitch
black shadows.
3. why does Y get +500 when other get only +100. And it does not scale
smoothly : the effect is not the same if the object is 10 unit wide, or
1000 unit wide (and the camera might then need adjustment too). What
about, instead +100, using +(max_*-min_*) (so light source is mirror of
farest plane by nearest plane)
4. Assuming the object is finite: if it is infinite, the return of
max_extent and min_extent are vectors of big size
5. The center of object is (max_*+min_*)/2 [NOT substraction]

-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.