View Full Version : Emitting omni lights from a particle system

03 March 2008, 07:11 PM
anyone have any ideas on how to achieve this?

03 March 2008, 10:08 PM
Psychosilence has a cool script operator that assigns an already created lights to each particle.

IE if you have ten omni lights it will assign those ten omni lights to the first ten particles.


You'll have to either rename your lights or modify the script.

03 March 2008, 10:57 PM
Awesome, that's exactly what I wanted to do.

However, now I have a follow-up question.

When I try to export the position of the light, it's showing up at the same starting position for every frame, ( which happens to be where the PF emitter is located). Now, I'm assuming this is the case because the position of the light is being handled through Particle Flow.

So my next question is how do I get the world XYZ position of the light to export properly?

Thanks guys.

03 March 2008, 11:34 PM
I am a little dense today, So I am having a little difficulty understanding what you are asking.

Not sure what you mean by "export the position". Do you want the position data for use in a scripted operator?

Or a different birth position for each light? As in you change you position icon to a box or sphere and change the location to volume. Or use a non-renderable position object and select verts, edges, or faces.

03 March 2008, 03:41 PM
Well, I want to export the position data of the lights to use in After Effects. I've tried it using the plug-in Max2Ae. Using the export function, as well as the save to .txt file, where it just saves out the position data for every frame of an object.

In both scenarios, it has the birth position for every frame, and not the actual position of the lights. I guess it's just because it's looking at the position of the emitter, and doesnt keep track of each particles true position in world space.

Hope that kinda clears things up, and thanks for your help so far.

03 March 2008, 07:37 PM
Sorry I have never used Max2ae. You may want to ask the developer.

If it gathers all of the object position data per frame, then the lights positions per frame should be recorded to, I would think. The Omni light is still an Omni light as far as max sees it.

Playing around: THis will print each omni lights position, each frame to the listener window.
rollout LightPos "Print Light Position"
button doit "Process Scene"

progressbar doit_prog color:yellow

on doit pressed do
t = animationRange.end + 1f
a = t.frame as integer
light_array = lights as array
sliderTime = animationRange.start
format "Current Frame:% \n" currentTime
Print light_array
select lights
for i = 1 to a do
doit_prog.value = 100.*i/a
sliderTime = currentTime + 1f
p = light_array
format "Current Frame:% \n" currentTime
print p


createDialog LightPos 200 60

03 March 2008, 04:46 PM
I'm having a little trouble getting this script to work. I'll admit I'm not that fmailiar with scripting and programming, so forgive me.

I inserted a new Script Operater in the particle flow and pasted that script in there. Was that the correct way to do that?

I'm also getting an error

-- MaxScript Error
-- Syntax error: at rollout, expected tool clause:
-- In line: rollout L

I don't really know waht that means, or how to fix it.

03 March 2008, 05:30 PM
The script I posted is just a regular maxscript. Go the maxscript menu and create a new maxscript, then copy/paste the what I posted to the blank maxscript. Then just evaluate the script (maxscript window, tools menu>evaluate) or save/run it.

A little dialog should popup and have a button on it that says "process scene" when you hit the button it will evaulate each lights position, print the frame number and the result in the maxscript listener window (hit the F11 key to open the listener then you must enable the maxscript listener via macrorecorder menu>enable)

03 March 2008, 06:28 PM
oh wow, yeah that worked great. it displayed all the correct position data for the lights. Now I just have to get it in a format that Ae can read.

Thanks for all the help!

CGTalk Moderation
03 March 2008, 06:28 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.