 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 17-12-15 à 15:57, dick balaska a écrit :
> On 12/15/2017 07:50 AM, Bald Eagle wrote:
>> argh.
>>
>> So, just so I fully understand what you want,
>> 1. You want to have a flashlight that always points at "Lookat"
>> 2. You want it offset by a certain amount from the camera position
>>
>> 3. ... ? (if any)
>
> Yes, like in Doom, where the gun is in a fixed position relative to the
> game window.
>
> (Wait, isn't there a text thingy in the object library that draws text
> in a fixed position on the screen? ...)
>
>
Locate your light at the same location as the camera, with a slight
offset if you want.
Make it a spot_light.
Spotlight have a point_at parameter, make it the same as your look_at.
point_at default to <0,0,0> if you don't set it.
#declare Light_Offset = <0, -0.5, 0>;
Camera{Cam_Location look_at Somewhere}
light_source{Cam_location + Light_Offset
rgb 1
spotlight
radius 5
tightness 40
point_at Somewhere
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 12/15/2017 07:50 AM, Bald Eagle wrote:
> dick balaska <dic### [at] buckosoft com> wrote:
>> On 05/29/2017 03:42 PM, dick balaska wrote:
>>
>> > Help, Math wizards, you're my only hope.
>>
>> I have started again to try to tackle this problem.
>>
>> Scott's solution gave me a vector, which is not what I need. :( I need
>> an angle.
>>
http://www.buckosoft.com/tteoac/video/testRenders/test3.mp4
Eureka!
The solution is to rotate it with the Cartesian result and then
translate it with scott's vcross-ish solution. i.e.
object {
myCyl
#local flOfs = <-0.4,-0.3,0.7>; // flashlight offset from camera
rotate VtoA(Lookat-Camera)
translate Camera+ssOffset(flOfs)
}
// Convert this vector into its angle
#macro VtoA(V)
#local _V=vnormalize(V);
#local rZ=degrees(acos(_V.z));
#local rY=0;
#local rX=0;
#if (_V.y != 0)
#local rY=degrees(atan2(_V.x,_V.y));
#else
#local rX=rZ;
#local rZ=0;
#end
<-rZ,rX,-rY>
#end
#macro ssOffset(bar)
#local newZ = vnormalize( Lookat-Camera );
#local newY = y;
#local newX = vnormalize(vcross(newY,newZ));
#local newY = vnormalize(vcross(newZ,newX));
#local barOut = bar.x * newX + bar.y * newY + bar.z * newZ;
barOut
#end
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
dick balaska <dic### [at] buckosoft com> wrote:
> On 12/15/2017 07:50 AM, Bald Eagle wrote:
> > dick balaska <dic### [at] buckosoft com> wrote:
> >> On 05/29/2017 03:42 PM, dick balaska wrote:
> >>
> >> > Help, Math wizards, you're my only hope.
> >>
> >> I have started again to try to tackle this problem.
> >>
> >> Scott's solution gave me a vector, which is not what I need. :( I need
> >> an angle.
> >>
>
> http://www.buckosoft.com/tteoac/video/testRenders/test3.mp4
>
> Eureka!
>
> The solution is to rotate it with the Cartesian result and then
> translate it with scott's vcross-ish solution. i.e.
> ...
See this post for an alternative solution:
From: Tor Olav Kristensen
Subject: Reorienting a flashlight along with the camera
Date: 17 Dec 2017 15:00:00
http://news.povray.org/povray.text.scene-files/thread/%3Cweb.5a36860f8dfaa90bb572bd120%40news.povray.org%3E/
It's interesting that no trigonometric functions are needed for this.
--
Tor Olav
http://subcube.com
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 5/31/2017 2:06 AM, dick balaska wrote:
> Am 2017-05-29 15:42, also sprach dick balaska:
>> I'm trying to master converting a vector to an angle in 3D with no luck
>
> Help, Math wizards, you're my only hope.
>
> Ok. I'm stuck. I'm missing something.
>
> My goal is to position an object in a fixed position on the screen, like
> carrying a flashlight. Or a gun, like in a video game.
You could create the flashlight and camera, and then apply the same
transformations to both.
Mike
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |