Thanks. I will bear that in mind.
Any ideas on how one can generate numbered variant names? (like test01 test02 test03) etc in a loop?
I am currently looking at using selection.count to store the object’s initial position into numbered variants based on the obj’s number in the selection.
eg: object number 13 will store its initial position information in variant test13
Thanks ^^ for the support
Thanks rdg.
Transfering the pixel information from a bitmap to geometry color is definitely helpful, But theres much confusion for me in those scripts. Also, a difference is that those scripts creates new planes accordingly to the resolution of the image.
What I hope to achieve is to animate any group of objects simply by using an averaged value from a bitmap applied to it. if possible. This will allow the script to work on virtually any situation. (which for me will allow me to control visibility options and animations to create a flowing forming up effect)
I will definitely look into the pF forum as well.
Also, It seems I have found the number variable thingy… seems to be called Arrays
^^ Once again thanks much for all the support
Ok to add arrays, I have added this set before the animate part to store the initial position of all the objects in the selection.
Inpos = #()
for obj in selection do
( append Inpos obj.pos )
This creates a variant array called Inpos and the Loop command will store the initial positions into this array so I can call out the information via:
Inpos[2] – this recalls the pos store in the 2nd object in my selection.
Now…
Anyone knows the command to determine which obj number is being modified in a “for obj in selection command”?
Ok cant find the command… ><
Anyway, I have managed to use a single variant to perform the count.
As below :-
Inpos = #()
Ap = 0
for obj in selection do
( append Inpos obj.pos )
animate on
(
for i = tstart to tend by tinter do
(
at time i
for obj in selection do
(
Ap = Ap + 1 – Counts object number
obj.pos = Nnum[Ap] – Resets Object to initial position
Vchange = (StpV*Avalue)+LMin – Determine the amount to change within the limits
if anix = true do
( vx = Vchange) – to check user selection no which axis
if aniy = true do
( vy = Vchange) – to base animation on
if aniz = true do
( vz = Vchange) – and to apply change value accordingly
orix = obj.pos.x – preserves the original X axis based on the appended data
oriy = obj.pos.y – preserves the original Y axis ” ” “
oriz = obj.pos.z – preserves the original Z axis ” ” “
obj.pos = [(orix + vx), (oriy + vy), (oriz + vz)] – apply change to current cood.
If ap == selection.count do – resets counter on processing the last obj
(ap = 0)
)))
simply by using an averaged value from a bitmap applied to it
Either you roll your own “averaging algorithm”, wich is a nice execercise, or you scale the image to the desired size/resolution. This will cause the pixels to get averaged.
[HELP]
[left]copy <source_bitmap> <dest_bitmap>
[/left]
[left]Copies the source bitmap to the destination bitmap. If the size of the two bitmaps is different, the image will be scaled to fit the destination bitmap.
[/left]
[/HELP]
I have written my own mosaic function [1] – but I think the difference to scaling the image is neglectable.
Hi,
To create and populate arrays:
ObjList = for obj in selection collect obj
is the same as
ObjList=#()
for obj in selection do append ObjList obj
then to loop through the array
for obj in ObjList do (obj.pos=[0,0,0])
is the same as
for i=1 to ObjList.count do (ObjList[i].pos=[0,0,0])
so your code could be:
tstart = TimeS.value -- these are the values for the panels
tend = TimeE.value -- but for some reason they do not appear
tinter = TimeI.value -- so I have keyed in variables instead
LMax = Maxi.value -- for the purpose of testing
LMin = Mini.value -- and to move on forward
vx = 0.0 -- values determining the initial change in movement
vy = 0.0
vz = 0.0
Stp = LMax - LMin -- divides the color channel values
StpV = (255/Stp) -- and changes them to steps accoring to Lmax/min limits
objList = for obj in selection collect obj -- grab the selected objects in the objList array
Inpos = for obj in objList collect obj.pos -- grab the selected objects' position in the Inpos array
animate on
(
for t = tstart to tend by tinter do
(
at time t
for i=1 to objList.count do -- loop through the objects in the
(
objList[i].pos = Inpos[i] -- Resets Object to initial position
Vchange = (StpV*t)+LMin -- Determine the amount to change within the limits
-- check for selected Axis
if Axial.state==1 then (objList[i].pos.x+=Vchange) -- preserves the original X axis
if Axial.state==2 then (objList[i].pos.y+=Vchange) -- preserves the original Y axis
if Axial.state==3 then (objList[i].pos.z+=Vchange -- preserves the original Z axis
)
)
)
Note: in your code, Nnum and Avalue are never defined…
so I suppose Nnum is Inital pos Array
and that Avalue is the time …
You should read about arrays in the MAxScript help…
Oh thanks…
Hmm Yeah… Nnum was added for me to check on the values between the Array Inputed by Inpos and information recalled in the animated mode. – Forgot to remove them.
Avalue… its a replacement for the supposed average pixel value which I’m still seeking.
to rdg:
Reducing the image will definitely help with the processing time me thinks. But doing that simply to assign a pixel to each polygon will limit the kind of array i’m animating correct?
What if the boxes are of different sizes? lets say in a reduced image some box may occupy 1 pixel while some may occupy 4 or maybe 6… that kinda thing?
Averaging a set of bitmap pixel value on a geometry is real hard I guess… Sadly, I have no yet found a bypass means to that myself. It really is my real obstacle.
><
Still I really really appreciate all the support guys ^^
What if the boxes are of different sizes?
Who knows?
Having a 1:1 pixel:object relation certainly eases the task.
As soon as you get used to arrays, reading the help and the various concepts and ways of animating objects in max using maxscript you can extend your system.
If I understand you right you want to preparse the bitmap and then generate a set of object that react to that values. See the bitmap as the first 2d array. Iterate through it, collect values, do some calulations and create a second array.
If you want a box with the width of 3 to represent 3 pixels of the same color in a row and a box with the height of 5 for 5 pixels of same color below each other … then you might to do a lot of calculations and lookups … and maybe just a few … I don’t know.
but this is sure a not trivial task.
Hmm not trivial I definitely agree.
preparse the bitmap and then generate a set of object that react to that values
Not exactly generate I would say. Rather to put, I have a wall of uneven geometry (different sizes and maybe even different shapes) and I need a way to animate them accordingly in a random and fashionably uniform manner. But in a wave pattern with some noise. Just like some of those “stand up and wave your hands in a chain kinda cheer that organisers use in a stadium”
if you dont get the picture see below
ooooo
Ooooo
OOooo
oOOoo
ooOOo
So generally I need to assign that set of premodelled object with a Bitmap that tells it when to move up or down. Which is a reason why I choose the above methods over all others as… I cannot seek to modify the geometrys that I am animating. Unlike others in the forum where we prep the Bitmap and generate the geometry from there.
I know this effect can be easily generated in Houdini… But sadly I need the same to work in Max ><
I know this effect can be easily generated in Houdini… But sadly I need the same to work in Max
If you need to use a bitmap to controll the values, then maybe pflow is the better way.
It offers you the perPoint-scripts/Expression to drive instanced/copied geometry you might be looking for.
But you can also generate an array of objects and assign an script-operator that accesses a function the lookup an value in an image.
Still – I guess the pflow link I posted previously is 94% the solution to your task. you just need to change the rotation to scale/translation/whatever and replace the noisemap with you image/movie.