Page 1 of 4

Animate value with Lua scripted graph

PostPosted: Sun Jul 17, 2016 7:36 am
by bepeg4d
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

Re: Animate value with Lua scripted graph

PostPosted: Mon Jul 18, 2016 1:10 am
by grimm
Awesome, thanks Beppe! :)

Re: Animate value with Lua scripted graph

PostPosted: Tue Jun 06, 2017 11:08 pm
by Notiusweb
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

Re: Animate value with Lua scripted graph

PostPosted: Wed Jun 07, 2017 11:36 am
by Notiusweb
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 14594 times ]



Thanks Beppe!

Re: Animate value with Lua scripted graph

PostPosted: Wed Jun 07, 2017 1:42 pm
by Notiusweb
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!

Re: Animate value with Lua scripted graph

PostPosted: Thu Jun 08, 2017 6:04 am
by Notiusweb
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....

Re: Animate value with Lua scripted graph

PostPosted: Thu Jun 08, 2017 7:12 am
by Notiusweb
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

Re: Animate value with Lua scripted graph

PostPosted: Sun Jun 11, 2017 7:40 am
by bepeg4d
Hi Notiusweb,
well done, I have added your AnimateValue_FloatStations to the Lua repository ;)
ciao beppe

Re: Animate value with Lua scripted graph

PostPosted: Mon Jul 24, 2017 5:51 pm
by Notiusweb
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

Re: Animate value with Lua scripted graph

PostPosted: Mon Jul 31, 2017 3:00 pm
by bepeg4d
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