POV-Ray : Newsgroups : povray.general : Can't get light_source to work properly (extremely simple scene) Server Time
26 Nov 2024 07:38:00 EST (-0500)
  Can't get light_source to work properly (extremely simple scene) (Message 1 to 4 of 4)  
From: MagicMojo
Subject: Can't get light_source to work properly (extremely simple scene)
Date: 23 Apr 2011 07:15:01
Message: <web.4db2b3ebd06940e624c275de0@news.povray.org>
I get nearly the same result regardless of whether I set the cam at z=-35 or
z=-50. Worse, I cannot get the arrows to be illuminated properly, leaving the
arrows as black objects against the white background.
I copied the light source from the woodbox.pov sample scene. There must be
an obvious blunder that I made.

I use PoVRay 3.62

//updownarrows.pov

#include "colors.inc"

background { White }

camera {
   location <14 0, -35> //-35 or -50, nearly same result (too close)
   direction <14, 0,  2.25>
   right x*1.33
   look_at <0,0,0>
}
#declare Dist=180.0;
light_source {< 0, 2.5, -10> color White //-50, 25, -50
     fade_distance Dist fade_power 2}

#declare downarrow = union
{
   cylinder
   {
       <0,0,0>,<0,4,0>,2
       color Green
   }
   cone //hollow?
   {
       <0,0,0>3,<0,-2,0>,0.3
       color Green
   }
}

object {downarrow
        color Green
}
object {downarrow
        color Blue
        translate x*6
        rotate x*180
        translate y*2
}


Post a reply to this message

From: Stephen
Subject: Re: Can't get light_source to work properly (extremely simple scene)
Date: 23 Apr 2011 07:39:06
Message: <4db2ba5a@news.povray.org>
On 23/04/2011 12:14 PM, MagicMojo wrote:
Hi, If you look in the message pane you will get a hint to what is 
wrong. "color" must be in a pigment which must be in a texture. Sp try this:

//updownarrows.pov

#include "colors.inc"

background { White }

camera {
    location <14 0, -235> //-35 or -50, nearly same result (too close)
    direction <14, 0,  2.25>
    right x*1.33
    look_at <0,0,0>
}
#declare Dist=180.0;
light_source {< 0, 2.5, -10> color White //-50, 25, -50
      fade_distance Dist fade_power 2}

#declare downarrow = union
{
    cylinder
    {
        <0,0,0>,<0,4,0>,2
texture { pigment  {    color Green     } }


    }
    cone //hollow?
    {
        <0,0,0>3,<0,-2,0>,0.3
texture {   pigment  {       color Green   }   }
    }
}

object {downarrow
  texture {   pigment  {       color Green     }  }
}
object {downarrow
  texture {   pigment  {       color Blue      }  }
         translate x*6
         rotate x*180
         translate y*2
}


-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Can't get light_source to work properly (extremely simple scene)
Date: 23 Apr 2011 23:36:46
Message: <4db39ace$1@news.povray.org>

>
> I get nearly the same result regardless of whether I set the cam at z=-35 or
> z=-50. Worse, I cannot get the arrows to be illuminated properly, leaving the
> arrows as black objects against the white background.
> I copied the light source from the woodbox.pov sample scene. There must be
> an obvious blunder that I made.
>
> I use PoVRay 3.62
In this case, there is no real difference between version 3.0 and 3.7.
>
>

>

This:
direction<14, 0,  2.25>
can causes some problem.

The direction of your camera is rather large, making it act like a 
telephoto with a narrow field of view. You have an horizontal field of 
view of 1.33 units (center to right side) at about 14.18 unit from the 
camera location. This explains why moving the camera from -35 to -50 
don't causes much change.

The use of look_at make the orientation of the direction vector 
unimportant, only it's lenght mathers.

Beter to use "direction z" or "direction<0,0,1>". Once everything is 
correctly placed, you can zoom by changing the lenght of the direction 
vector or by using the "angle" keyword.



As you apply you colours when you use your object, why do you set it to 
Green when you declare it? In your original code, both arrows will have 
the same colour, that applied in the #declare, not the one applyed in 
the object statement.

You don't need to use the keyword "color".
Instead, you should use "pigment{...}"

#declare downarrow = union
{
    cylinder
    {
        <0,0,0>,<0,4,0>,2
    }
    cone
    {
        <0,0,0>3,<0,-2,0>,0.3 pigment{Red}
    }// this makes the tip red independently of the rest
}// NO pigment in the declare itself

object {downarrow
         pigment{ Green}
}//Green shaft and red tip arrow.

When using fading light, you are beter using shorter fade_distance and 
increase the intensity of the light correspondingly.

Change Dist to 18 or even 1.
With a Dist = 18, use White*100 in your light_source.
If you use Dist = 1, then you should use White*32400.


Alain


Post a reply to this message

From: Alain
Subject: Re: Can't get light_source to work properly (extremely simple scene)
Date: 23 Apr 2011 23:45:56
Message: <4db39cf4$1@news.povray.org>

> On 23/04/2011 12:14 PM, MagicMojo wrote:
> Hi, If you look in the message pane you will get a hint to what is
> wrong. "color" must be in a pigment which must be in a texture. Sp try
> this:
>
> //updownarrows.pov
>
> #include "colors.inc"
>
> background { White }
>
> camera {
> location <14 0, -235> //-35 or -50, nearly same result (too close)
> direction <14, 0, 2.25>
> right x*1.33
> look_at <0,0,0>
> }
> #declare Dist=180.0;
> light_source {< 0, 2.5, -10> color White //-50, 25, -50
> fade_distance Dist fade_power 2}
>
> #declare downarrow = union
> {
> cylinder
> {
> <0,0,0>,<0,4,0>,2
> texture { pigment { color Green } }
>
>
> }
> cone //hollow?
> {
> <0,0,0>3,<0,-2,0>,0.3
> texture { pigment { color Green } }
> }
> }
And now, the arrows will ALWAYS be green!

>
> object {downarrow
> texture { pigment { color Green } }
> }
> object {downarrow
> texture { pigment { color Blue } }
> translate x*6
> rotate x*180
> translate y*2
> }
>
>
You should rotate before you relocate. Otherwise, it will orbitate 
around the origin.
In this case, I'd rather use this construct:

union{// create a double pointed arrow
object{downarrow pigment{Green}}
oblect{downarrow pigment{Blue} scale<1, -1, 1> //mirror it verticaly
// add some transpate if needed
}// you can move it as one unit
}

The name and the 180 degree rotation seems to imply that you want a 
double pointed arrow.



Alain


Post a reply to this message

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