Animate value with Lua scripted graph

Forums: Animate value with Lua scripted graph
Forum for OctaneRender Lua scripting examples, discussion and support.

Animate value with Lua scripted graph

Postby bepeg4d » Sun Jul 17, 2016 7:36 am

bepeg4d Sun Jul 17, 2016 7:36 am
Here is a solution for fastly animate a value via Lua scripted graph:
AnimateValue_SG.lua
(1.99 KiB) Downloaded 1383 times

Screen Shot 2016-07-17 at 09.34.32.jpg
Animated Y rotation in 2 seconds

Define a Start value, an End value and the duration expressed in seconds.
The total number of frames depends on the FPS value of the scene.
You can animate any kind of value, just connect the output of this scripted graph node to a blue (value) pin of a desire node.
For single value like Power value, use the first of the three fields in the Start value and End value node.
Happy rendering :)
ciao beppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: Animate value with Lua scripted graph

Postby grimm » Mon Jul 18, 2016 1:10 am

grimm Mon Jul 18, 2016 1:10 am
Awesome, thanks Beppe! :)
Linux Mint 20 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 460.56
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1321
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Re: Animate value with Lua scripted graph

Postby Notiusweb » Tue Jun 06, 2017 11:08 pm

Notiusweb Tue Jun 06, 2017 11:08 pm
Beppe, would it be possible to add a midpoint value as well ( to be applied to1/2 of whatever time value is used)?

ie

Total Time = 100 seconds
Start Vale = 1
Medium Value = 3 ( would be calculated by script @ 50 seconds)
End Value = 10

(My example showed medium could be any value, just would occur at the "mid-time")

Or even more advanced, could there be an option to add 'mid-stations', with a specific time interval the user could type in, as an associated "%"?
One mid-station could be used as a medium point as well...

ie

Total Time = 100 seconds
Start Vale = 1
End Value = 10
# Mid Stations = 3

Station (1) Value = 3,
Station (1) Time = .3 (30% of total time, or 30 seconds)
Station (2) Value = 5
Station (2) Time = .5 (50% of total time, or 50 seconds)
Station (3) Value = 9
Station (3) Time = .6 (60% of total time, or 60 seconds)

(My example shows any station value or station time could be of any value or time, independently)


I am going to have to learn LUA!
Whoo-ahh!

Thanks!
Notiusweb
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1285
Joined: Mon Nov 10, 2014 4:51 am

Re: Animate value with Lua scripted graph

Postby Notiusweb » Wed Jun 07, 2017 11:36 am

Notiusweb Wed Jun 07, 2017 11:36 am
FYI - Here is a Tri-Animated Value scene I threw together:
(1) boat - translation on Z value
(2) water - 2 planes, the one with displacement has translation on Z value
(3) camera - position, target, and up-vector values

I imported boat and geometric plane, but made all animation in standalone!
This rocks!!!
And I know the water looks bad, but that's not the point....
THAT'S NOT THE POINT!!!

Whoo-Ahhh for LUA!

[ Play Quicktime file ] TugboatWater1.mp4 [ 10.02 MiB | Viewed 14603 times ]



Thanks Beppe!
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1285
Joined: Mon Nov 10, 2014 4:51 am

Re: Animate value with Lua scripted graph

Postby Notiusweb » Wed Jun 07, 2017 1:42 pm

Notiusweb Wed Jun 07, 2017 1:42 pm
Oh, and a repeat function, like texture animation has...!
Once, Loop, and Ping Pong.

I know they say beggars can't be choosey, but I am going to think outside the box...
Beggars CAN be choosey...

Thanks!
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1285
Joined: Mon Nov 10, 2014 4:51 am

Re: Animate value with Lua scripted graph

Postby Notiusweb » Thu Jun 08, 2017 6:04 am

Notiusweb Thu Jun 08, 2017 6:04 am
Hi Notius, here is a Lua Script based of Beppe's that has 10 'Stations'. Think of it like a train ride, with an origin followed by 10 stops, with the 10th stop being the end stop.
The time value you enter will be the per-station trip time. So at the default, of 1 second, the animation runs at a total of 10 seconds. If you set at 6, it will run for 60 seconds.

So, with this you could manually plot out a float value's oscillation (ie rise and fall with 0, 1, 0...... a plateau with 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2.... a stairway with 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6....etc) amidst the total trip time, which is the per-trip time you specify *10. Each individual station will be exactly the same, but you could plot the same values repeatedly to get a different effect.

Or, instead of inputting #'s in to each station, you could just set the per-trip time to a longer time (ie 5) and then have just 1 or two stations > 0, for a 10 second animation let's say. Just keep in mind if you do this, the entire frame / time displayed in the Octane viewport will look large, but you can always batch render to any frame/time point you want, prior to the displayed last time or frame, thus capping where you want it to end.

Confused?
Great!

Here is the script and a pic:
AnimateValue_FloatStations.lua
(5.15 KiB) Downloaded 934 times

AnimatedValue Float Stations.jpg



Remember, in principal it works the same as the one Beppe gave us, his had 1 stop from the point of origin, which was called 'End'. The time was still a per-trip time, but as there was one it represented the entirety of the trip.
But this is neither here, nor there. I saw you had asked for a script with stations, and despite that I have no idea what I am doing with Lua, I edited the script for you.
Now, go and get to rendering...come on...Go...Go....
Last edited by Notiusweb on Thu Jun 08, 2017 7:15 am, edited 1 time in total.
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1285
Joined: Mon Nov 10, 2014 4:51 am

Re: Animate value with Lua scripted graph

Postby Notiusweb » Thu Jun 08, 2017 7:12 am

Notiusweb Thu Jun 08, 2017 7:12 am
Notiusweb wrote:Hi Notius, here is a Lua Script based of Beppe's that has 10 'Stations'. Think of it like a train ride, with an origin followed by 10 stops, with the 10th stop being the end stop.
The time value you enter will be the per-station trip time. So at the default, of 1 second, the animation runs at a total of 10 seconds. If you set at 6, it will run for 60 seconds.

So, with this you could manually plot out a float value's oscillation (ie rise and fall with 0, 1, 0...... a plateau with 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2.... a stairway with 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6....etc) amidst the total trip time, which is the per-trip time you specify *10. Each individual station will be exactly the same, but you could plot the same values repeatedly to get a different effect.

Or, instead of inputting #'s in to each station, you could just set the per-trip time to a longer time (ie 5) and then have just 1 or two stations > 0, for a 10 second animation let's say. Just keep in mind if you do this, the entire frame / time displayed in the Octane viewport will look large, but you can always batch render to any frame/time point you want, prior to the displayed last time or frame, thus capping where you want it to end.

Confused?
Great!

Here is the script and a pic:
AnimateValue_FloatStations.lua

AnimatedValue Float Stations.jpg



Remember, in principle it works the same as the one Beppe gave us, his had 1 stop from the point of origin, which was called 'End'. The time was still a per-trip time, but as there was one it represented the entirety of the trip.
But this is neither here, nor there. I saw you had asked for a script with stations, and despite that I have no idea what I am doing with Lua, I edited the script for you.
Now, go and get to rendering...come on...Go...Go....


Hi Notius, thank you very much. I want to learn more about Lua now, seeing what you can do with it.
Most importantly, I want to recognize your generosity, and your wisdom as well...And your humility.
I wish many Octane coins to you.

PS - Thanks Beppe!

https://render.otoy.com/forum/viewtopic.php?f=5&t=61680&p=315529#p315529
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1285
Joined: Mon Nov 10, 2014 4:51 am

Re: Animate value with Lua scripted graph

Postby bepeg4d » Sun Jun 11, 2017 7:40 am

bepeg4d Sun Jun 11, 2017 7:40 am
Hi Notiusweb,
well done, I have added your AnimateValue_FloatStations to the Lua repository ;)
ciao beppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: Animate value with Lua scripted graph

Postby Notiusweb » Mon Jul 24, 2017 5:51 pm

Notiusweb Mon Jul 24, 2017 5:51 pm
Beppe,
I want to ask you, is it possible in your script to have a whole node, and all of its respective values, take the place of a single float value?
Such that you could have an animation from start to finish with every single value in the environment node, for example. So you could have a 'start environment node value set' travel to the 'end environment node value set'.
I just don't know how to reference, in lua, the entire range of values from an Octane node, as a collective set. I can do individual float value from your script, but I do not know how to instruct lua to refer to the the entire set of values in a node, which would be inputted into the table per the user's input, like you have for the single float value. Does this make sense, lua-wise, as it pertains to your script? ( I hope so....) I don't know... Does it involve a table of values? Is there such a command style or instruction for referencing an entire set of values, collectively, of an Octane node? (ie Environment)

Anyway, thanks for any info you can give to help me understand how to lua-code reference the entire set of values in a node, as opposed to a single value type, of the node.

-Notiusweb
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1285
Joined: Mon Nov 10, 2014 4:51 am

Re: Animate value with Lua scripted graph

Postby bepeg4d » Mon Jul 31, 2017 3:00 pm

bepeg4d Mon Jul 31, 2017 3:00 pm
Hi Notiusweb,
if I have understood correctly your needs and your intentions, the issue is that, for example the Environment node, is composed of several nodes with different value types, and since OctaneRender Standalone does not have a proper animation timeline, it seems to me a bit difficult and complex to prepare and handle a complete scripted Environment node graph, at least for my skill :roll:
In my opinion it is better to have single animated values for each sub-node that needs to be animated.
best,
ciao beppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Next

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 5 guests

Thu Mar 28, 2024 8:29 pm [ UTC ]