POV-Ray : Newsgroups : povray.newusers : Light. Point_at ??? Server Time
23 Nov 2024 14:47:02 EST (-0500)
  Light. Point_at ??? (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: LanuHum
Subject: Light. Point_at ???
Date: 29 May 2013 13:15:00
Message: <web.51a636fc5d41de5a7a3e03fe0@news.povray.org>
Hello! Sorry!
I on the former don't speak in English :)

//----Blender Object Name:Plane----
object {
    Plane
    matrix <4.580214, 0.000000, 0.000000,  0.000000, -0.000000, -4.580214,
0.000000, 4.580214, -0.000000,  0.000000, 0.000000, 0.000000>

light_source {
    < 0,0,0 >
    color rgb<0.6, 0.6, 0.6>
    spotlight
    falloff 37.50
    radius 31.874999
    tightness 0
    point_at  <?????????????????????????>
    fade_distance 14.999991
    fade_power 2
    matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
-0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>

How to send light to object center?
Help me! Please!


Post a reply to this message

From: Stephen
Subject: Re: Light. Point_at ???
Date: 29 May 2013 14:17:56
Message: <51a64654$1@news.povray.org>
On 29/05/2013 6:12 PM, LanuHum wrote:
> Hello! Sorry!
> I on the former don't speak in English :)
>
> //----Blender Object Name:Plane----
> object {
>      Plane
>      matrix <4.580214, 0.000000, 0.000000,  0.000000, -0.000000, -4.580214,
> 0.000000, 4.580214, -0.000000,  0.000000, 0.000000, 0.000000>
>
> light_source {
>      < 0,0,0 >
>      color rgb<0.6, 0.6, 0.6>
>      spotlight
>      falloff 37.50
>      radius 31.874999
>      tightness 0
>      point_at  <?????????????????????????>
>      fade_distance 14.999991
>      fade_power 2
>      matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
> -0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>
>
> How to send light to object center?
> Help me! Please!
>

Hi and welcome.

There is an international news group where you can ask in languages 
other than English.

You can find the co-ordinates of the bounding box of your object using, 
the functions min_extent and max_extent. Search for them in PovRay help.
The centre of your object should be at the centre of the bounding box.
(Roughly speaking)

But since you are using Blender can you not point it at your object in 
Blender?

-- 
Regards
     Stephen


Post a reply to this message

From: LanuHum
Subject: Re: Light. Point_at ???
Date: 29 May 2013 15:00:00
Message: <web.51a64f7c127956147a3e03fe0@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 29/05/2013 6:12 PM, LanuHum wrote:
> > Hello! Sorry!
> > I on the former don't speak in English :)
> >
> > //----Blender Object Name:Plane----
> > object {
> >      Plane
> >      matrix <4.580214, 0.000000, 0.000000,  0.000000, -0.000000, -4.580214,
> > 0.000000, 4.580214, -0.000000,  0.000000, 0.000000, 0.000000>
> >
> > light_source {
> >      < 0,0,0 >
> >      color rgb<0.6, 0.6, 0.6>
> >      spotlight
> >      falloff 37.50
> >      radius 31.874999
> >      tightness 0
> >      point_at  <?????????????????????????>
> >      fade_distance 14.999991
> >      fade_power 2
> >      matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
> > -0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>
> >
> > How to send light to object center?
> > Help me! Please!
> >
>
> Hi and welcome.
>
> There is an international news group where you can ask in languages
> other than English.
>
> You can find the co-ordinates of the bounding box of your object using,
> the functions min_extent and max_extent. Search for them in PovRay help.
> The centre of your object should be at the centre of the bounding box.
> (Roughly speaking)
>
> But since you are using Blender can you not point it at your object in
> Blender?
>
> --
> Regards
>      Stephen

in official povray addons:

            elif lamp.type == 'SPOT':
                tabWrite("spotlight\n")

                # Falloff is the main radius from the centre line
                tabWrite("falloff %.2f\n" % (degrees(lamp.spot_size) / 2.0))  #
1 TO 179 FOR BOTH
                tabWrite("radius %.6f\n" % \
                         ((degrees(lamp.spot_size) / 2.0) * (1.0 -
lamp.spot_blend)))

                # Blender does not have a tightness equivilent, 0 is most like
blender default.
                tabWrite("tightness 0\n")  # 0:10f

                tabWrite("point_at  <0, 0, -1>\n")

I rewrite:
tabWrite("point_at  <%.3g, %.3g, %.3g>\n"%ob.constraints["Track
To"].target.location[:])
It doesn't yield the necessary result as it is necessary to consider a matrix


Post a reply to this message

From: Alain
Subject: Re: Light. Point_at ???
Date: 29 May 2013 17:35:08
Message: <51a6748c@news.povray.org>

> Hello! Sorry!
> I on the former don't speak in English :)
>
> //----Blender Object Name:Plane----
> object {
>      Plane
>      matrix <4.580214, 0.000000, 0.000000,  0.000000, -0.000000, -4.580214,
> 0.000000, 4.580214, -0.000000,  0.000000, 0.000000, 0.000000>
>
> light_source {
>      < 0,0,0 >
>      color rgb<0.6, 0.6, 0.6>
>      spotlight
>      falloff 37.50
>      radius 31.874999
>      tightness 0
>      point_at  <?????????????????????????>
>      fade_distance 14.999991
>      fade_power 2
>      matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
> -0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>
>
> How to send light to object center?
> Help me! Please!
>
>
>
>

Use #declare to define your object.
#declare Object_name= ...
Replace "..." by the definition of your object.

Now, you can use
#declare Center=(min_extent(Object_name)+max_extent(Object_name))/2;
to get the center point of it's bounding box.
Use that value as your point_at location: point_at Center

Alternatively, if you create your object around the origin and translate 
it into location, use the same coordinates for the translate and 
point_at location.



Alain


Post a reply to this message

From: LanuHum
Subject: Re: Light. Point_at ???
Date: 30 May 2013 13:10:00
Message: <web.51a78675127956147a3e03fe0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

>
> Use #declare to define your object.
> #declare Object_name= ...
> Replace "..." by the definition of your object.
>
> Now, you can use
> #declare Center=(min_extent(Object_name)+max_extent(Object_name))/2;
> to get the center point of it's bounding box.
> Use that value as your point_at location: point_at Center
>
> Alternatively, if you create your object around the origin and translate
> it into location, use the same coordinates for the translate and
> point_at location.
>
>
>
> Alain

object {
    Sphere_001
    matrix <1.000000, 0.000000, 0.000000,  0.000000, -0.000000, -1.000000,
0.000000, 1.000000, -0.000000,  3.060443, 0.988657, -0.000000>

}
#declare Center=(min_extent(Sphere_001)+max_extent(Sphere_001))/2;
//--Lamps--

light_source {
    < 0,0,0 >
    color rgb<0.6, 0.6, 0.6>
    spotlight
    falloff 37.50
    radius 31.874999
    tightness 0
    point_at  Center
    fade_distance 14.999991
    fade_power 2
    matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
-0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>
}

Doesn't work. All black. Light doesn't fall on the Sphere_001


Post a reply to this message

From: Stephen
Subject: Re: Light. Point_at ???
Date: 30 May 2013 16:25:18
Message: <51a7b5ae$1@news.povray.org>
On 30/05/2013 6:05 PM, LanuHum wrote:
> Alain <kua### [at] videotronca> wrote:
>
>>
>> Use #declare to define your object.
>> #declare Object_name= ...
>> Replace "..." by the definition of your object.
>>
>> Now, you can use
>> #declare Center=(min_extent(Object_name)+max_extent(Object_name))/2;
>> to get the center point of it's bounding box.
>> Use that value as your point_at location: point_at Center
>>
>> Alternatively, if you create your object around the origin and translate
>> it into location, use the same coordinates for the translate and
>> point_at location.
>>
>>
>>
>> Alain
>
> object {
>      Sphere_001
>      matrix <1.000000, 0.000000, 0.000000,  0.000000, -0.000000, -1.000000,
> 0.000000, 1.000000, -0.000000,  3.060443, 0.988657, -0.000000>
>
> }
> #declare Center=(min_extent(Sphere_001)+max_extent(Sphere_001))/2;
> //--Lamps--
>
> light_source {
>      < 0,0,0 >
>      color rgb<0.6, 0.6, 0.6>
>      spotlight
>      falloff 37.50
>      radius 31.874999
>      tightness 0
>      point_at  Center
>      fade_distance 14.999991
>      fade_power 2
>      matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
> -0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>
> }
>
> Doesn't work. All black. Light doesn't fall on the Sphere_001
>
>

I think that what is going wrong is that you are creating the spotlight 
at the origin, pointing it at the sphere then transposing it with your 
matrix function. So the spotlight ends up not pointing at the sphere.

Try this:

object {
      Sphere_001
      matrix <1.000000, 0.000000, 0.000000,  0.000000, -0.000000, -1.000000,
0.000000, 1.000000, -0.000000,  3.060443, 0.988657, -0.000000>

}
#declare Center=(min_extent(Sphere_001)+max_extent(Sphere_001))/2;
//--Lamps--

light_source {

           matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 
0.757034,
-0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>

      color rgb<0.6, 0.6, 0.6>
      spotlight
      falloff 37.50
      radius 31.874999
      tightness 0
      point_at  Center
      fade_distance 14.999991
      fade_power 2
}





-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Light. Point_at ???
Date: 31 May 2013 01:43:53
Message: <51a83899@news.povray.org>

> Alain <kua### [at] videotronca> wrote:
>
>>
>> Use #declare to define your object.
>> #declare Object_name= ...
>> Replace "..." by the definition of your object.
>>
>> Now, you can use
>> #declare Center=(min_extent(Object_name)+max_extent(Object_name))/2;
>> to get the center point of it's bounding box.
>> Use that value as your point_at location: point_at Center
>>
>> Alternatively, if you create your object around the origin and translate
>> it into location, use the same coordinates for the translate and
>> point_at location.
>>
>>
>>
>> Alain
>
> object {
>      Sphere_001
>      matrix <1.000000, 0.000000, 0.000000,  0.000000, -0.000000, -1.000000,
> 0.000000, 1.000000, -0.000000,  3.060443, 0.988657, -0.000000>
>
> }
> #declare Center=(min_extent(Sphere_001)+max_extent(Sphere_001))/2;
> //--Lamps--
>
> light_source {
>      < 0,0,0 >
>      color rgb<0.6, 0.6, 0.6>
>      spotlight
>      falloff 37.50
>      radius 31.874999
>      tightness 0
>      point_at  Center
>      fade_distance 14.999991
>      fade_power 2
>      matrix <-0.942444, 0.000000, 0.334364,  0.268584, 0.595619, 0.757034,
> -0.199154, 0.803267, -0.561337,  3.196899, 5.407235, -3.778671>
> }
>
> Doesn't work. All black. Light doesn't fall on the Sphere_001
>
>
>
>
>
Your matrix transform is applied to both the origin of your light and to 
the point_at coordinate.

You need to transform the location of your light BEFORE you set the 
point_at location.


Alain


Post a reply to this message

From: LanuHum
Subject: Re: Light. Point_at ???
Date: 31 May 2013 09:10:01
Message: <web.51a89fe1127956147a3e03fe0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> Your matrix transform is applied to both the origin of your light and to
> the point_at coordinate.
>
> You need to transform the location of your light BEFORE you set the
> point_at location.
>
>
> Alain

Alain, Thanks, but I don't understand your idea
Each object has own matrix. If I transform one, it will be necessary to
transform all remaining
The response is found in Povray documentation: matrix
Users of Blender prompted that my problem was that axes of coordinates are
various in Blender and in Povray

// location 3.0604 0.0000 0.9887
// x=1.000000*3.060443+0.000000*0.988657+0.000000*0.000000+3.060443=6.12
// y=0.000000*3.060443+0.000000*0.988657+0.000000*0.000000+0.988657=1.96
// z=0.000000*3.060443+1.000000*0.988657+0.000000*0.000000+0.000000=0.99

point_at  <-0.99,-1.96,-6.12>   (-z, -y, -x)    :)


Post a reply to this message

From: Stephen
Subject: Re: Light. Point_at ???
Date: 31 May 2013 15:14:27
Message: <51a8f693@news.povray.org>
On 31/05/2013 2:05 PM, LanuHum wrote:
> Alain, Thanks, but I don't understand your idea
> Each object has own matrix. If I transform one, it will be necessary to
> transform all remaining
> The response is found in Povray documentation: matrix
> Users of Blender prompted that my problem was that axes of coordinates are
> various in Blender and in Povray


Another way of saying what Alain said in non technical terms.

When you set the location of the spotlight (you set it to < 0,0,0 >) 
then set the point_at. PovRay will calculate the angles. If you then 
transpose the spotlight the point_at will still keep these angles and 
the light beam will miss your sphere.

An alternative method would be to take the spotlight coordinates from 
your Blender light and use them as the location in the PovRay Spotlight. 
Then the point_at will work as you want it to if you do not add any more 
translations or rotations.
Be aware if you do this then the centre of rotation of the spotlight 
will be at the origin.

Example:

#declare Sphere_001 =
sphere {
0.0, 0.500000
texture{ Non_Patterned_Texture }
rotate    <0.000000,0.000000,0.000000>
translate <3.000000,1.000000,0.000000>
}

#declare Light_Source1 =
light_source {
< 3.196899, 5.407235, -3.876671 >, colour rgb <0.600,0.600,0.600>
spotlight
point_at < 3.000000, 1.000000, 0.000000 >
radius 32.549
falloff 37.500
tightness 0
fade_power 2.000
fade_distance 14.900
media_attenuation off
media_interaction on
}

-- 
Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: Light. Point_at ???
Date: 31 May 2013 16:46:11
Message: <51a90c13$1@news.povray.org>

> Alain <kua### [at] videotronca> wrote:
>
>> Your matrix transform is applied to both the origin of your light and to
>> the point_at coordinate.
>>
>> You need to transform the location of your light BEFORE you set the
>> point_at location.
>>
>>
>> Alain
>
> Alain, Thanks, but I don't understand your idea
> Each object has own matrix. If I transform one, it will be necessary to
> transform all remaining
> The response is found in Povray documentation: matrix
> Users of Blender prompted that my problem was that axes of coordinates are
> various in Blender and in Povray
>
> // location 3.0604 0.0000 0.9887
> // x=1.000000*3.060443+0.000000*0.988657+0.000000*0.000000+3.060443=6.12
> // y=0.000000*3.060443+0.000000*0.988657+0.000000*0.000000+0.988657=1.96
> // z=0.000000*3.060443+1.000000*0.988657+0.000000*0.000000+0.000000=0.99
>
> point_at  <-0.99,-1.96,-6.12>   (-z, -y, -x)    :)
>
>
>
>
>

Yes, a given object only have one matrix... BUT...

The final matrix never need to be applied at once and, when applied in 
several steps, the part that are applied AFTER any transformation is 
never affected by any previous manipulation.
You can apply a matrix transformation, then scale, rotate or translate 
your object, add some elements like a point_at (for a light) or a 
texture (for an object), then apply another matrix transformation.

For a light source, I prefer to define it directly at it's intended 
location, not translating in any way unless it's part of some complexe 
object in an union.

Any and all transformation always apply to all elements that are defined 
previous to it's application, mever to those that follow.

Do this test:
Create a scene consisting only of a white plane and several spot lights 
like this:

#declare Middle=0;
//ground plane
plane{y,0 pigment{rgb 1/8}}

//a back plane to keep rays finite
plane{-z,-30 pigment{rgb 0}}
//the camera
camera{location<0,10,-30> look_at 0}
// setting the creation of 5 lights in a loop
#declare L_Num=5;
#while(L_Num>0)
light_source{<-25,90,0> rgb 8
spot_light radius 1 falloff 2
#if(Middle=1)translate 10*x #end
// this translate ONLY the light and NOT the point_at

point_at 0

#if(Middle=0)translate 10*x #end
// This translate BOTH the light and the point_at

#declare L_Num=L_Num-1;
#end // of the loop
media{scattering{1 rgb 0.1}}


This will create 5 tight spot lights.
If you render with Middle=0, you'll get 5 bright spots with beams that 
are parallel.
If you render with Middle=1, you'll get only 1 brighter spot with 
converging beams.
The media make the beams visible.





Alain


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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