rdg
04-18-2007, 02:01 PM
Hello,
after reading [1] and [2] I slowly started to think about interpolation.
I'd like to hear some comment from you about this approach:
The following script creates a bezier_float in the globaltracks and uses it as some kind of Lookup Table. An dummy holds global scale and offsets to post-process the LUT.
As a sampe a row of spheres is created, whose radii are controlled by the LUT.
You can adjust the curve in the Trackview to modify the size of the spheres.
The global controlls can be used to offset an scale this curve.
-- interpolation fragment
-- 2007 Georg Duemlein
-- http://www.preset.de/
-- create a bezierfloat and add it to globaltracks:
bc = bezier_float()
defaultKeys = #(#(0,.5),#(100,3))
addTrackViewController Globaltracks bc "sampleLUT"
for i = 1 to defaultKeys.count do (
k = addNewKey bc (defaultKeys[i][1])
at time defaultKeys[i][1] animate on k.value = defaultKeys[i][2]
k.inTangentType = #custom
k.inTangent = 0
k.outTangentType = #custom
k.outTangent = 0
)
-- set out-of-range-keys
setBeforeORT bc #cycle
setAfterORT bc #cycle
-- create a dummy to hold offset and scale slider
dm = dummy()
em = emptymodifier()
the_cadef = attributes sampleValues (
parameters main rollout:params (
thego type:#float ui:uigo default:0
thegs type:#float ui:uigs default:1
)
rollout params "Globals" (
spinner uigo "Offset" range:[-100, 100, 0] type:#float
spinner uigs "Scale" range:[0.1, 10, 1] type:#float
)
)
custAttributes.add em the_cadef
addmodifier dm em
em.sampleValues.thego.controller = bezier_float()
em.sampleValues.thegs.controller = bezier_float()
dm.name = "sample_global"
-- create some spheres and controll their radius through the LUT
spaceing = 3
for sc = 1 to 50 do (
s = sphere pos:[(spaceing * (sc - 1)), 0, 0] radius:1
scont = float_script()
--scont.addTarget "ref" globalTracks.sampleLUT
scont.addConstant "me" (sc * 2)
scont.addTarget "go" $sample_global.modifiers[#Attribute_Holder].sampleValues.thego.controller
scont.addTarget "gs" $sample_global.modifiers[#Attribute_Holder].sampleValues.thegs.controller
scont.addConstant "ref" globalTracks.sampleLUT
scont.script = "rt = (me + go) * gs\nat time rt ref.value"
s.radius.controller = scont
s.wirecolor = [255, 255, 255] * (at time (sc * 2) globalTracks.sampleLUT.value)/3
)
-- open trackview
trackview.open "rdg sample"
Georg
[1] http://forums.cgsociety.org/showthread.php?f=98&t=470089
[2] http://forums.cgsociety.org/showthread.php?f=98&t=475669&highlight=ease
after reading [1] and [2] I slowly started to think about interpolation.
I'd like to hear some comment from you about this approach:
The following script creates a bezier_float in the globaltracks and uses it as some kind of Lookup Table. An dummy holds global scale and offsets to post-process the LUT.
As a sampe a row of spheres is created, whose radii are controlled by the LUT.
You can adjust the curve in the Trackview to modify the size of the spheres.
The global controlls can be used to offset an scale this curve.
-- interpolation fragment
-- 2007 Georg Duemlein
-- http://www.preset.de/
-- create a bezierfloat and add it to globaltracks:
bc = bezier_float()
defaultKeys = #(#(0,.5),#(100,3))
addTrackViewController Globaltracks bc "sampleLUT"
for i = 1 to defaultKeys.count do (
k = addNewKey bc (defaultKeys[i][1])
at time defaultKeys[i][1] animate on k.value = defaultKeys[i][2]
k.inTangentType = #custom
k.inTangent = 0
k.outTangentType = #custom
k.outTangent = 0
)
-- set out-of-range-keys
setBeforeORT bc #cycle
setAfterORT bc #cycle
-- create a dummy to hold offset and scale slider
dm = dummy()
em = emptymodifier()
the_cadef = attributes sampleValues (
parameters main rollout:params (
thego type:#float ui:uigo default:0
thegs type:#float ui:uigs default:1
)
rollout params "Globals" (
spinner uigo "Offset" range:[-100, 100, 0] type:#float
spinner uigs "Scale" range:[0.1, 10, 1] type:#float
)
)
custAttributes.add em the_cadef
addmodifier dm em
em.sampleValues.thego.controller = bezier_float()
em.sampleValues.thegs.controller = bezier_float()
dm.name = "sample_global"
-- create some spheres and controll their radius through the LUT
spaceing = 3
for sc = 1 to 50 do (
s = sphere pos:[(spaceing * (sc - 1)), 0, 0] radius:1
scont = float_script()
--scont.addTarget "ref" globalTracks.sampleLUT
scont.addConstant "me" (sc * 2)
scont.addTarget "go" $sample_global.modifiers[#Attribute_Holder].sampleValues.thego.controller
scont.addTarget "gs" $sample_global.modifiers[#Attribute_Holder].sampleValues.thegs.controller
scont.addConstant "ref" globalTracks.sampleLUT
scont.script = "rt = (me + go) * gs\nat time rt ref.value"
s.radius.controller = scont
s.wirecolor = [255, 255, 255] * (at time (sc * 2) globalTracks.sampleLUT.value)/3
)
-- open trackview
trackview.open "rdg sample"
Georg
[1] http://forums.cgsociety.org/showthread.php?f=98&t=470089
[2] http://forums.cgsociety.org/showthread.php?f=98&t=475669&highlight=ease
