Script request: change light intensity through a script

Forum for OctaneRender Lua scripting examples, discussion and support.
Rikk The Gaijin
Licensed Customer
Posts: 1528
Joined: Tue Sep 20, 2011 2:28 pm
Location: Japan

Hi, I would like to being able to change the intensity of my HDR texture through a script, for example:
frame 1245 --> intensity 1.00
frame 1259 --> intensity 0.30

Is it possible?

Thank you
Rikk The Gaijin
Licensed Customer
Posts: 1528
Joined: Tue Sep 20, 2011 2:28 pm
Location: Japan

Anyone? :(
User avatar
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Yes, I think it could be done. :) It would probably be best to modify Roeland's animation render script and add this functionality to it.

Jason
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
User avatar
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Hey Rikk,

Try this out and see if it works for you. You need to have a texture environment node connect to the render target and have the target selected for it to work. Let me know if you have any problems.

Jason
Animation_with_hdri_intensity.lua
(19.86 KiB) Downloaded 292 times
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
Tugpsx
Licensed Customer
Posts: 1150
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL
Contact:

Thanks, this should come in handy. Maybe you could add an option to add the texture Environment if a node does not exist and connect it to the render target.

Code: Select all

local settings =
{
["renderTargets"]   = octane.project.getSceneGraph():findNodes(octane.NT_RENDERTARGET),
}
-- no render targets available -> error out
if #settings.renderTargets == 0 then
    error("no render targets to render in project:", projectPath)
else

-- create a texture environment node
texNode = octane.node.create{ type=octane.NT_ENV_TEXTURE, name="HDRI intensity" }

-- evaluate the texture node
texNode:evaluate()
Win 11 64GB | NVIDIA RTX3060 12GB
Rikk The Gaijin
Licensed Customer
Posts: 1528
Joined: Tue Sep 20, 2011 2:28 pm
Location: Japan

Hey grimm, this looks sweet! But I would like to see the result before start rendering, the script Roeland made changed the scene so I could see the result by just moving the marker on the animation bar, can you do that?
User avatar
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Thanks Tugpsx,

That would be a good addition.

Rikk,

Ah, I see, so you need the script to modify the animation and then get out of the way? I will look into it.

Jason
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
Rikk The Gaijin
Licensed Customer
Posts: 1528
Joined: Tue Sep 20, 2011 2:28 pm
Location: Japan

grimm wrote:Thanks Tugpsx,

That would be a good addition.

Rikk,

Ah, I see, so you need the script to modify the animation and then get out of the way? I will look into it.

Jason
Thank you, I really appreciate it. :)
User avatar
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Hi Rikk,

Ok, here is a really rough script that should work. As always let me know if you have any problems with it. You need to have a texture environment node with a float value node connected to the power input pin. The script needs a lot of work still to make it easier to use and more reliable. Right now the start and end time is in frame numbers. When you set the start and end values for the power, every frame before the start will have the same power as the start value, and every frame after the end will equal the end value. The values between the start and end will be smoothly interpolated. Hopefully that isn't too confusing, it's easy to see when you run the script and look at the results. Once you pick the settings you want and select the "build animator" button, close the script and you should be able to scrub the animation and see the effect.

Jason
animator_builder.zip
(5.19 KiB) Downloaded 271 times
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
Rikk The Gaijin
Licensed Customer
Posts: 1528
Joined: Tue Sep 20, 2011 2:28 pm
Location: Japan

Thanks a lot grimm, you rock! 8-)
Post Reply

Return to “Lua Scripting”