View Full Version : 1 material, 5000 objects+random selfIllum?

05 May 2008, 07:10 PM
Hey There,

I have 5000 instanced objects. What would be the best way of animating their "Self-Illum" randomly?

I was about to try a scripted controller but thought I would pose the question. Initial I had a material being assigned to each object as it was created. Max didn't seem to like the 5000 different materials with there own animation keys. So that didn't work. Any Ideas?


05 May 2008, 09:01 PM
Do you really need 5000 seperate animation curves? Could like 15 do instead, randomly assigned to your objects to avoid any obvious patterns?

You could assign your self illum to be a multiIDMap

Make 15 different animating colors, then apply seperate material modifiers to your objects with a random value between 1 and 15, so each one gets one of your animating patterns. You can assign the random Material ID using the materialIDRandomizer script...

- Neil

05 May 2008, 12:08 AM
Hey Soulburn,

I've been using a number of your burn scripts for some time now. Great work!

Your suggestion will work for an overall randomized look but what I need is a progressive change from non-selfilluminating to fully selfilluminating. So, imagine a form comprised of thousands of objects and starting from the bottom heading to the top the individual objects slowly start to glow. It's important that each object changes otherwise I would just uvw map the whole lot with a gradient to control the illum level. But that wouldn't give the same look. So if I could make the material modifier method fade then I'd have something.

05 May 2008, 12:30 AM
Well, I may still be misunderstanding what you're doing, but the plan I mentionned I still think could work for your situatrion. While each object would have a fixed material ID, say 1 to 15, each of those IDs would actually be driving an animated curve. Say for ID 1 you make a checkered pattern. You then turn both color to black (this step is necessary because max still doesn't have a built-in single color map.) You then animate both black colors slowly fading to white (since the multiIDmap is hooked up the self illumination, this is the same thing as animating the self illum value from 0 to 100%). Now do the same with a checkered map in ID 2, except change the timing of the animation. Then keep doing this until you have 15 different animated checkered maps, then apply those randomly to your objects using the technique I mentionned.

- Neil

05 May 2008, 07:03 PM
this sounds like a job for PFlow. Two events.

Event 1: positions the non glowing objects where ever you want them. there are several birth scripts floating around that will place one particle at every vert. They can easily be converted to center of Polygon if you want. Assign your basic material with no self illumination to an object. Use Shape Instance for this object. Add a collision op and create several colliders that will act as triggers for the next event.

Event 2: simply has a Dynamic Material with the animated map in the SelfIllum. slot. Unless I'm wrong, you do need an IFL or avi or whatever. It needs to be an animated bitmap.

Then all you need to do is get creative with the collider's motion. create several and apply noise controllers to their transforms... the possiblities are endless.

05 May 2008, 09:49 PM
Hey Jonah,

Pflow could work. Currently I am using a script I made that generates random forms from a selected object. I suppose I could find a way to convert that to a birth script then Pflow could handle dynamic material change as you suggested. Thanks for the input!

Alex Morris
06 June 2008, 10:56 AM
the way I normally do this is attach all the objects into one object then assign a multi-sub material with say 10 slots - I then use a script to randomise the selfillumination for each slot (each slot is a copy of the original material) and then use the material by element modifier which has a random seed built in. You can then just animate the random seed of the modifier.

06 June 2008, 08:00 PM
That works for a static scene. but if you want to control the timing of the illumination, from 0 to 100, per element, this method would become very complex. You would need hundreds of submaterials.

With the particle method you really only need one material with animated illum. The timing of the illum process from 0-100 starts when the second particle event is triggered for each individual particle.

There are plenty of birth scripts around this forum.

06 June 2008, 09:51 PM
My work around for now is this:

Run random object generator script.
Run MatId animation script. (This assigns a material id modifier to each objects and then key-frames from 1-15 over 15 frames. This creates a half second fade)
Create my 15 slot sub-mat and assign self-illum values as to fade from ID 1 to 15. So slot 1 is 0 slot 2 is 6 or 7 etc...

Apply this material all the objects and I now have my fade. They way it is setup now each object fades in in the order it was created. A new fade starting every frame. With 5000 objects this still takes a while to get all the objects fading in but it works for now.

I started playing with a birth script version but didn't get very far.

Say, can you not use fn myFunction = () stuff in a birth script? My functions didn't seem to want to work.

CGTalk Moderation
06 June 2008, 09:51 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.