phizikl
November 17, 2011, 1:20am
#1
i am trying to come up with a workaround for the PRT Hair modifier, since it doesnt work with multiple splines (which could be animated) i have to attach all of them to one spline (losing the animation)
and i was going to animate the curve editor that im using to color the particles based on “hair distance”, so all curve points would be at 0 just one point with some higher values this makes the color only appear in a small section of the strand, animating these 3 points would theoretically create the appearance of the fiber growing or moving, but i just noticed i cannot keyframe the curve editor points
any suggestions or workarounds?
thanks
Bobo
November 17, 2011, 3:08am
#2
I see these workarounds:
*Use a Gradient Ramp and keyframe the positions of its flags to get the color flow you want. Use the Distance of the particle to the root divided by the hair length as the U mapping coordinate.
*Try to express the same procedurally as a function of time.
Bobo
November 17, 2011, 4:01am
#3
Here is another solution for “growing” a color on a PRT Hair:
[code](–MAGMAFLOW2–
global MagmaFlowEditor_EditBLOPHistory = #()
magmaNode.note=""
node0 = magmaNode.createNode “Output”
magmaNode.setNumNodeInputs node0 1
magmaNode.setNumNodeOutputs node0 0
magmaNode.setNodeProperty node0 “channelName” “Color”
magmaNode.setNodeProperty node0 “channelType” “float16[3]”
magmaNode.DeclareExtensionProperty node0 “Position”
magmaNode.SetNodeProperty node0 “Position” [100,100]
node1 = magmaNode.createNode “InputChannel”
magmaNode.setNumNodeInputs node1 0
magmaNode.setNumNodeOutputs node1 1
magmaNode.setNodeProperty node1 “channelName” “Distance”
magmaNode.setNodeProperty node1 “channelType” “”
magmaNode.DeclareExtensionProperty node1 “Position”
magmaNode.SetNodeProperty node1 “Position” [194,155]
node2 = magmaNode.createNode “Divide”
magmaNode.setNumNodeInputs node2 2
magmaNode.setNumNodeOutputs node2 1
magmaNode.setNodeInputDefaultValue node2 1 1.0
magmaNode.setNodeInputDefaultValue node2 2 1.0
magmaNode.DeclareExtensionProperty node2 “Position”
magmaNode.SetNodeProperty node2 “Position” [334,140]
node3 = magmaNode.createNode “InputChannel”
magmaNode.setNumNodeInputs node3 0
magmaNode.setNumNodeOutputs node3 1
magmaNode.setNodeProperty node3 “channelName” “HairLength”
magmaNode.setNodeProperty node3 “channelType” “”
magmaNode.DeclareExtensionProperty node3 “Position”
magmaNode.SetNodeProperty node3 “Position” [194,210]
node7 = magmaNode.createNode “Switch”
magmaNode.setNumNodeInputs node7 3
magmaNode.setNumNodeOutputs node7 1
magmaNode.DeclareExtensionProperty node7 “Name”
magmaNode.SetNodeProperty node7 “Name” “Switch”
magmaNode.DeclareExtensionProperty node7 “Position”
magmaNode.SetNodeProperty node7 “Position” [614,0]
node5 = magmaNode.createNode “LessOrEqual”
magmaNode.setNumNodeInputs node5 2
magmaNode.setNumNodeOutputs node5 1
magmaNode.setNodeInputDefaultValue node5 2 0.0
magmaNode.DeclareExtensionProperty node5 “Name”
magmaNode.SetNodeProperty node5 “Name” “LessOrEqual”
magmaNode.DeclareExtensionProperty node5 “Position”
magmaNode.SetNodeProperty node5 “Position” [470,130]
node6 = magmaNode.createNode “InputValue”
magmaNode.setNumNodeInputs node6 0
magmaNode.setNumNodeOutputs node6 1
magmaNode.setNodeProperty node6 “forceInteger” false
ctrl=bezier_float(); ctrl.value = 1.0
magmaNode.setNodeProperty node6 “controller” ctrl
fn applyKeysToController controller keys = (for k in keys do (newKey = addNewKey controller k[1]; newKey.value = k[2]; newKey.inTangent = k[3]; newKey.outTangent = k[4]; newKey.inTangentType = k[5]; newKey.outTangentType = k[6]; newKey.inTangentLength = k[7]; newKey.outTangentLength = k[8]; newKey.freeHandle = k[9]; newKey.x_locked = k[10]; newKey.y_locked = k[11]; newKey.z_locked = k[12]; newKey.constantVelocity = k[13]))
applyKeysToController ctrl #(#(0f, 0.0, 0.0, 0.0, #custom , #custom , -1.0, 0.3333, false, true, true, true, false), #(100f, 1.0, 0.0, 0.0, #custom , #custom , 0.3333, -1.0, false, true, true, true, false))
magmaNode.DeclareExtensionProperty node6 “Position”
magmaNode.SetNodeProperty node6 “Position” [334,225]
node8 = magmaNode.createNode “InputValue”
magmaNode.setNumNodeInputs node8 0
magmaNode.setNumNodeOutputs node8 1
magmaNode.setNodeProperty node8 “forceInteger” false
ctrl=Point3_XYZ(); ctrl.value = [1,0,0]
magmaNode.setNodeProperty node8 “controller” ctrl
magmaNode.DeclareExtensionProperty node8 “Position”
magmaNode.SetNodeProperty node8 “Position” [474,15]
node9 = magmaNode.createNode “InputValue”
magmaNode.setNumNodeInputs node9 0
magmaNode.setNumNodeOutputs node9 1
magmaNode.setNodeProperty node9 “forceInteger” false
ctrl=Point3_XYZ(); ctrl.value = [0,0,1]
magmaNode.setNodeProperty node9 “controller” ctrl
magmaNode.DeclareExtensionProperty node9 “Position”
magmaNode.SetNodeProperty node9 “Position” [474,70]
try(magmaNode.setNodeInput node0 1 node7 1)catch()
try(magmaNode.setNodeInput node2 1 node1 1)catch()
try(magmaNode.setNodeInput node2 2 node3 1)catch()
try(magmaNode.setNodeInput node7 1 node8 1)catch()
try(magmaNode.setNodeInput node7 2 node9 1)catch()
try(magmaNode.setNodeInput node7 3 node5 1)catch()
try(magmaNode.setNodeInput node5 1 node2 1)catch()
try(magmaNode.setNodeInput node5 2 node6 1)catch()
)
[/code]
Bobo
November 17, 2011, 8:24am
#5
Obviously, you could also change it to output 0.0 and 1.0 into the Density channel to completely remove the particles while keeping the growing part fully visible…