Camera to be parent for a light source

Forums: Camera to be parent for a light source
Forum for OctaneRender Lua scripting examples, discussion and support.

Camera to be parent for a light source

Postby abzivid » Wed Oct 13, 2021 8:52 am

abzivid Wed Oct 13, 2021 8:52 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
abzivid
Licensed Customer
Licensed Customer
 
Posts: 15
Joined: Thu Sep 30, 2021 9:11 am

Re: Camera to be parent for a light source

Postby jobigoud » Wed Oct 13, 2021 11:51 am

jobigoud Wed Oct 13, 2021 11:51 am
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 235 times


lookatToTransform.orbx
(84.96 KiB) Downloaded 219 times
User avatar
jobigoud
OctaneRender Team
OctaneRender Team
 
Posts: 230
Joined: Sat Aug 15, 2015 1:28 pm

Re: Camera to be parent for a light source

Postby abzivid » Thu Oct 14, 2021 8:30 am

abzivid Thu Oct 14, 2021 8:30 am
Hi,

Many thanks. Having light at fixed position in camera space is indeed what I needed.
Will test the script.
abzivid
Licensed Customer
Licensed Customer
 
Posts: 15
Joined: Thu Sep 30, 2021 9:11 am

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 16 guests

Fri Apr 19, 2024 8:01 pm [ UTC ]