Camera to be parent for a light source

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
abzivid
Licensed Customer
Posts: 15
Joined: Thu Sep 30, 2021 9:11 am

Hi,

Is it possible to bind a light source to a camera; the light then moves in same way as the camera?

I'm interested to know how this may be achieved by manually changing the graph and via scripting.

Many thanks
Aleksandar
User avatar
jobigoud
OctaneRender Team
Posts: 245
Joined: Sat Aug 15, 2015 1:28 pm

Hi,
Please test the following "Lookat to Transform" script.
If I understand correctly your goal is to have a light at a fixed position in camera space, so when the camera moves around, the light is always at the same position relative to the camera, correct?

To do this with the attached script (see ORBX):
  • Expand the Position, Target and Up-vector nodes from the camera, and plug them into the Lookat to Transform node.
  • Plug the resulting transform into a Placement node connected to the object.
  • Use another Placement node upstream of the camera transform to position the object relatively to the camera. (Or use the built-in transform on the object if it has one).
lookatToTransform.png
lookatToTransform.lua
(4.6 KiB) Downloaded 297 times
lookatToTransform.orbx
(84.96 KiB) Downloaded 276 times
abzivid
Licensed Customer
Posts: 15
Joined: Thu Sep 30, 2021 9:11 am

Hi,

Many thanks. Having light at fixed position in camera space is indeed what I needed.
Will test the script.
Post Reply

Return to “Lua Scripting”