PDA

View Full Version : PFlow and 3dsmax lights


gaga
03-31-2010, 04:11 PM
Hi, im pretty new to Pflow and im trying to do an animation of flying lightbulbs with Pflow. I got pflow to produce instances of the lightbulb but the lightbulb is grouped with a few photometric lights and Pflow doesn't instance these. Any ideas how i can get the lights instanced toghether with the lightbulb?

Bobo
03-31-2010, 04:19 PM
Hi, im pretty new to Pflow and im trying to do an animation of flying lightbulbs with Pflow. I got pflow to produce instances of the lightbulb but the lightbulb is grouped with a few photometric lights and Pflow doesn't instance these. Any ideas how i can get the lights instanced toghether with the lightbulb?

For various technical reasons, PFlow can use only Meshes as particles.
The typical solution is to create a bunch of instanced objects and use a Script Operator to drive these objects around indirectly (by setting their position, rotation and scale to the ones from the particles).

Here is an example where the particles drive Volumetric Gizmo Helpers to create a Smoke-like effect. (the same tutorial is included in the MAXScript Help)

http://www.scriptspot.com/bobo/mxs5/pflow/pflow__MovingObjects.htm

scrimski
03-31-2010, 04:23 PM
By instancing the photometric lights too? You do need to script a bit to get PFlow use the lights+the bulbs.
http://www.scriptspot.com/bobo/mxs5/pflow/pflow__MovingObjects.htm

hotknife
04-05-2010, 01:50 PM
Just looking at the tutorial of this in the help file and playing with it. I've noticed that the Gizmos follow the particle by a delay of one frame. Is there a way to stop this happening and have the object absolutely follow the particle. I can't work out where the delay is coming from...cheers.

scrimski
04-05-2010, 02:48 PM
Reduce the integration step size.
The delay can be eliminated by using a script in the Final Update Step of the PFlow source.
This is covered in Bobo's Pflow Scripting DVD.

Bobo
04-05-2010, 02:57 PM
Just looking at the tutorial of this in the help file and playing with it. I've noticed that the Gizmos follow the particle by a delay of one frame. Is there a way to stop this happening and have the object absolutely follow the particle. I can't work out where the delay is coming from...cheers.

The delay comes from the fact that the Script is evaluated before the PFlow Integrator has calculated the final positions of the particles for the current frame.

In general, PFlow runs all operators in order. Operators modify particle channels like Position, Velocity, Spin etc. Then it takes the position and velocity channels and moves the particles one step ahead (based on the Integration step for the current viewport or render state) and changes the position channel to reflect the velocity channel. As result, the particles advance to their final position for the current frame. But the Script was run as part of the Operators that modify channels, thus the position used is the position calculated on the previous frame, not the final one.

There are two solutions to this - you can use the Every Step Update or Final Step Update scripts found in the PF Source which are run AFTER each step or after the last step, or try to itegrate your light positions yourself.

In the former case, you can have access to some but not all particle channels, but it is enough to get to the transformations and put the lights at the right places. In the latter case, you would have to figure out the integration step for the current state of the system and add a fraction of the velocity channel to the position of the particle to find out where the particle might be on the next frame. Unfortunately, this might not handle collisions that change the direction of the velocity and modify the position in more subtle ways.

So if the offset of one frame is a problem for you, look at the Update scripts in the PF Source.

I could recommend my "PFlow Script Show" DVDs which discuss this exact matter (moving lights with particles) and a lot more interesting topics, but it would be a shameless plug and probably a bad idea in this recession...

hotknife
04-05-2010, 05:44 PM
Brilliant thanks fellas, the Final Update Script was enough to get me where I needed to go. 17 years and I'd never even seen that ! :D

but it would be a shameless plug and probably a bad idea in this recession... :) think this recession is a very good reason for a shameless plug. I shall look into it and if it's as good as your Matrix DVD buy it !

CGTalk Moderation
04-05-2010, 05:44 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.