View Full Version : Convert noise animation to keyframes
avolution 09-22-2010, 07:23 PM Is there any way to flatten a collection of objects animated with
noise position, so that it removes the noise controller and just
leaves x.y.z. keyframes
|
|
scrimski
09-22-2010, 07:41 PM
There's a transform collapse function in the motion tab, try that.
avolution
09-22-2010, 07:45 PM
First thing I tried, it still leaves the noise on top.
If I create a point helper
add a noise animation to the y pos
and then collapse it in motion tab
If I turn off noise I get no y motion
There's a transform collapse function in the motion tab, try that.
scrimski
09-22-2010, 07:48 PM
Maybe that one
http://scripts.breidt.net/#mbCollapse
ivanisavich
09-22-2010, 07:51 PM
Here you go. Just select the object and run the script.
obj = $
max create mode
transArr = #()
count = 1
for q in 0 to 100 do
(
at time q
(
transArr[count] = obj.transform
)
count += 1
)
obj.position.controller = position_xyz()
obj.rotation.controller = euler_xyz()
obj.scale.controller = scalexyz()
count = 1
for q in 0 to 100 do
(
at time q
(
with animate on
(
obj.transform = transArr[count]
)
)
count += 1
)
avolution
09-22-2010, 07:56 PM
I.m afraid not, using the exact test scene as above,
if you turn off the noise, you lose the animation
Maybe that one
http://scripts.breidt.net/#mbCollapse
avolution
09-22-2010, 07:59 PM
If you run this script on the test scene above, it still needs the
noise mod or the point helper will not move
it creates keyframes however. but if you disable the noise,
it will not move
Here you go. Just select the object and run the script.
obj = $
max create mode
transArr = #()
count = 1
for q in 0 to 100 do
(
at time q
(
transArr[count] = obj.transform
)
count += 1
)
obj.position.controller = position_xyz()
obj.rotation.controller = euler_xyz()
obj.scale.controller = scalexyz()
count = 1
for q in 0 to 100 do
(
at time q
(
with animate on
(
obj.transform = transArr[count]
)
)
count += 1
)
ivanisavich
09-22-2010, 08:02 PM
If you run this script on the test scene above, it still needs the
noise mod or the point helper will not move
it creates keyframes however. but if you disable the noise,
it will not move
Oh well I opened your scene and you're not even using a noise controller. You're using a noise modifier which is not what you want to do because it won't affect the point's transform at all.
Take off the noise modifier, and instead add a position noise controller (in the motion panel), then use any one of the solutions already posted in this thread and you'll see they all work.
avolution
09-22-2010, 08:17 PM
I can try that; but it seems strange that there is no way to bake such things as
noise modifier, or flex down to a base object with keyframes.
Oh and I have a real hate-on for the noise controller, because if you apply
a noise controller to say 25 point objects, randomize the seed via script
you will find that on frame zero the offset are identical on all objects at
frame zero.
If a niose controller was truly random then each and every y would be different
for each and every randomized clone.
Oh well I opened your scene and you're not even using a noise controller. You're using a noise modifier which is not what you want to do because it won't affect the point's transform at all.
Take off the noise modifier, and instead add a position noise controller (in the motion panel), then use any one of the solutions already posted in this thread and you'll see they all work.
scrimski
09-22-2010, 08:24 PM
I can try that; but it seems strange that there is no way to bake such things as
noise modifier, or flex down to a base object with keyframes.Actually there is. Try scripspot.com, there should be a few scripts available for baking vertex animation or whatever it is you try to achieve.
How about point cache? Or do you specifically need the animation to be in the base object?
-Johan
ivanisavich
09-23-2010, 01:20 AM
I can try that; but it seems strange that there is no way to bake such things as
noise modifier, or flex down to a base object with keyframes.
You can use point cache to bake deformations but it does not create keyframes or bake transforms, which is what you requested in your first post.
Also, point helpers do not have vertices so point cache will not work on them.
avolution
09-23-2010, 03:24 AM
Certain effects, such as ky_trail require that the objects pivot point be moving.
So if I animate a bunch of point helpers whether with a noise modifier or a noise
controller, unless you bake the keyframes, it will not be interpreted as motion.
I have found another way to animate the point helpers in pflow.
I create a random vector and store it in matrixrow1 and another random
vector and store it in matrix row2. By alternating between target vector and source
vector I use find target to move to and from to seemingly random points.
All point helpers are then moved to the locations over time.
I hoped to do it with noise controllers OR noise modifiers but they suffer from
a tragic flaw that all the numbers are the same on frame zero and other various
frames, and real random numbers do not suffer this problem.
But with pCont.randSpherePoint() you can be sure of a new RANDOM x,y,z
number of each proceed call in pflow.
Hopefully this explains my situation!
How about point cache? Or do you specifically need the animation to be in the base object?
-Johan
All point helpers are then moved to the locations over time.
I hoped to do it with noise controllers OR noise modifiers but they suffer from
a tragic flaw that all the numbers are the same on frame zero and other various
frames, and real random numbers do not suffer this problem.
That's where the seed setting come in play. Have all objects a different seed and all motion is different:
pseudo code = for n in getClassInstances NoiseController do n.seed = random -1000 1000
Not behind max, but that should make all controllers have unique animation.
-Johan
avolution
09-23-2010, 01:04 PM
Regardless of seed settings, they all have the same y displacement on frame zero.
I do not consider this to be mathematically "random"
That's where the seed setting come in play. Have all objects a different seed and all motion is different:
pseudo code = for n in getClassInstances NoiseController do n.seed = random -1000 1000
Not behind max, but that should make all controllers have unique animation.
-Johan
labbejason
09-23-2010, 05:59 PM
Yeah, there should really be some offset value for the noise controller. Something to actually shift the curve so it doesn't all start with the same value. It looks like the noise is always a value of 0 on frame 0, so a cheap hack would be to start your scene on a later frame.
avolution
09-23-2010, 06:37 PM
I have done that as a cheap hack before, but what if I offset a random frame offset.
On these small test scenes it can be done manually, but there are lots of times I may have
2000+ point helpers.
Thanks for the suggestion.
Yeah, there should really be some offset value for the noise controller. Something to actually shift the curve so it doesn't all start with the same value. It looks like the noise is always a value of 0 on frame 0, so a cheap hack would be to start your scene on a later frame.
Have to admit, never knew all noise starts at zero, but here's a script to go around that.
Simply make the noise controller with zero weight in the list controller, then add a bezier (for manual offset) and a script controller to time sample the noise controller.
for i = 1 to 200 do
(
local p = point name:(uniqueName "slave_")
p.pos.controller = position_list()
p.pos.controller[1].controller = noise_position frequency:0.05 fractal:false seed:(random 0 10000) noise_strength:[0,150,0]
p.pos.controller.available.controller = position_script()
p.pos.controller.available.controller = bezier_position()
p.pos.controller.weight = #(0,100,100)
p.pos.controller.setActive 3
p.pos.controller[3].value = [10*i,0,0]
p.pos.controller[2].AddConstant "offset" (random 0 50)
p.pos.controller[2].AddNode "self" p
p.pos.controller[2].script = ("at time (currentTime.frame + offset) self.pos.controller[1].value")
)
-Johan
avolution
09-23-2010, 10:52 PM
Will have to try this tommorow, looks cool!:beer:
Have to admit, never knew all noise starts at zero, but here's a script to go around that.
Simply make the noise controller with zero weight in the list controller, then add a bezier (for manual offset) and a script controller to time sample the noise controller.
for i = 1 to 200 do
(
local p = point name:(uniqueName "slave_")
p.pos.controller = position_list()
p.pos.controller[1].controller = noise_position frequency:0.05 fractal:false seed:(random 0 10000) noise_strength:[0,150,0]
p.pos.controller.available.controller = position_script()
p.pos.controller.available.controller = bezier_position()
p.pos.controller.weight = #(0,100,100)
p.pos.controller.setActive 3
p.pos.controller[3].value = [10*i,0,0]
p.pos.controller[2].AddConstant "offset" (random 0 50)
p.pos.controller[2].AddNode "self" p
p.pos.controller[2].script = ("at time (currentTime.frame + offset) self.pos.controller[1].value")
)
-Johan
labbejason
09-23-2010, 10:57 PM
There you go, Johan is all over it :)
floopyb
09-24-2010, 01:50 AM
Yeah, there should really be some offset value for the noise controller. Something to actually shift the curve so it doesn't all start with the same value. It looks like the noise is always a value of 0 on frame 0, so a cheap hack would be to start your scene on a later frame.
Apply an Ease curve on top of your noise then shif the keys on the ease curve to create the offset.
That would be an even better/faster solution indeed. And there I was messing about with list controllers ;)
-Johan
avolution
09-24-2010, 01:17 PM
I guess my max is too old?
When I run this I get this in the listener
[/CODE]
-- Error occurred in i loop
-- Frame:
-- i: 1
-- p: $Point_Helper:slave_01 @ [10.000000,0.000000,0.000000]
-- Unknown property: "AddConstant" in SubAnim:Position_Script
OK
[/CODE]
Have to admit, never knew all noise starts at zero, but here's a script to go around that.
Simply make the noise controller with zero weight in the list controller, then add a bezier (for manual offset) and a script controller to time sample the noise controller.
for i = 1 to 200 do
(
local p = point name:(uniqueName "slave_")
p.pos.controller = position_list()
p.pos.controller[1].controller = noise_position frequency:0.05 fractal:false seed:(random 0 10000) noise_strength:[0,150,0]
p.pos.controller.available.controller = position_script()
p.pos.controller.available.controller = bezier_position()
p.pos.controller.weight = #(0,100,100)
p.pos.controller.setActive 3
p.pos.controller[3].value = [10*i,0,0]
p.pos.controller[2].AddConstant "offset" (random 0 50)
p.pos.controller[2].AddNode "self" p
p.pos.controller[2].script = ("at time (currentTime.frame + offset) self.pos.controller[1].value")
)
-Johan
Yeah I think it doesn't have the new script controller in that version of max.
Here's a variant based on what floopyb said, with the ease curve
for i = 1 to 200 do
(
local p = point name:(uniqueName "slave_")
p.pos.controller = position_list()
p.pos.controller.available.controller = noise_position frequency:0.05 fractal:false seed:(random 0 10000) noise_strength:[0,150,0]
-- Add ease curve to the noise controller
addEaseCurve p.pos.controller[2].controller
p.pos.controller[2].controller.Ease_Curve.controller
-- Add actual keyframes to the easecurve
for i = 0 to 100 by 50 do
(
local sKey = addNewKey p.pos.controller[2].controller.Ease_Curve.controller i
sKey.Value = i
sKey.inTangentType = #linear
sKey.outTangentType = #linear
)
-- set out of range types
setBeforeORT p.pos.controller[2].controller.Ease_Curve.controller #linear
setAfterORT p.pos.controller[2].controller.Ease_Curve.controller #linear
-- delete randomly somewhere between 0 and 100 frames to make the shift
deleteTime p.pos.controller[2].controller.Ease_Curve.controller (interval -3000f (-3000f + random 0f 100f ))
-- list controller set right
p.pos.controller.weight = #(100,100)
p.pos.controller.setActive 1
-- offset the point helper
p.pos.controller[1].value = [10*i,0,0]
)
I think this should work in max 9.
-Johan
CGTalk Moderation
09-24-2010, 02:45 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.