POV-Ray : Newsgroups : povray.newusers : Light. Point_at ??? Server Time
9 Jun 2024 02:45:07 EDT (-0400)
  Light. Point_at ??? (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
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

From: LanuHum
Subject: Re: Light. Point_at ???
Date: 17 Jun 2013 12:45:01
Message: <web.51bf3cb5127956147a3e03fe0@news.povray.org>
Stephen <mca### [at] aolcom> wrote:

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

> Regards
>      Stephen

Stephen, Alain, thank you very much!


LanuHum


Post a reply to this message

From: LanuHum
Subject: Re: Light. Point_at ???
Date: 17 Jun 2013 14:10:00
Message: <web.51bf5013127956147a3e03fe0@news.povray.org>
Alain <kua### [at] videotronca> wrote:

>
> #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}}///////ERROR!!!!!!!
>

> Alain

media{scattering{1 rgb 0.1}}///////ERROR!!!!!!! Scattering in light source??????


Post a reply to this message

From: Alain
Subject: Re: Light. Point_at ???
Date: 17 Jun 2013 16:44:47
Message: <51bf753f$1@news.povray.org>

> Alain <kua### [at] videotronca> wrote:
>
>>
>> #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}}///////ERROR!!!!!!!
>>
>
>> Alain
>
> media{scattering{1 rgb 0.1}}///////ERROR!!!!!!! Scattering in light source??????
>
>
>

In the sample scene I made, I forgot to close the light_source block.
Put the missing closing brace "}" between "#if(Middle=0)translate 10*x 
#end " and "#declare L_Num=L_Num-1;".

The media should be defined by itself or in a transparent object with 
the "hollow" option.
The purpose of "hollow" is strictly to enable an object to contain some 
media and to allow fog to exist within.

The media is proposed to make the light beams visible.

This is a minimal athmospheric scattering media block placed by itself 
outside of any object or scene element:

media{scattering{1 rgb 0.1 } }

This create an isotropic scattering media filling your entire scene.


Sample media box with the same media (usualy prefered):

box{<-50,0,0><50,100,100> pigment{rgbt 1} hollow
interior{media{scattering{1 rgb 0.1}} }
}

This create a minimal scattering media within the box. This usualy 
renders faster.

By minimal, I mean using all default parameters and without any density 
variation.



Alain


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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