I'm writing a plugin that moves particles through a phoenix grid (sort of like Thinkbox's 'Stoke', or even pflow's 'PhoenixFX force').
The grid I'm using for testing purposes is located at the scene origin, is 50x50x50 with a cell size of 1.0. It has some smoke emitting from a ball inside of it. I emit my custom particles over the surface of the ball and then move them using the phoenix grid values returned by the IPhoenixFD* interface.
I'm trying to understand Phoenix velocities and how I should be using them to move my particles properly. So far I can successfully convert particle positions to grid coordinates, and query the velocity channel's x/y/z float values without issue.
However, the velocities I get seem to be too big, and when I move my particles with the velocities returned by the grid...they all move way too fast and go flying off into oblivion. I've found that multiplying the velocities by .03 and using that value to push my particles instead, seems to get motion closer to what I'd expect. For reference: my simulation runs like this:
1) get particle position
2) query phoenix cell at that position and get its velocity
3) set particle position to [current particle position + cell velocity]
4) move to the next frame and repeat for all particles....
I can't imagine .03 is some magic number, therefore I'm sure there's some velocity conversion I'm missing. I'm assuming that the velocities returned by the grid are in cell size units, not world units? That shouldn't affect my current setup though since my cell size is 1.0...but I figured I'd ask anyways.
Also, should I be interpolating between nearby cell velocities, based on the proximity of the query point to those neighbor cells? Or is just getting the velocity of the target cell good enough?
The SDK samples don't include any info about how to work with grid velocities (other than simply querying them)...so I'm feeling around in the dark here and would appreciate help!
tl;dr: I have particles and a phoenix grid. How do I use the velocities from the grid to move the particles around, so their motion matches the motion of the smoke in my phoenix sim?
The grid I'm using for testing purposes is located at the scene origin, is 50x50x50 with a cell size of 1.0. It has some smoke emitting from a ball inside of it. I emit my custom particles over the surface of the ball and then move them using the phoenix grid values returned by the IPhoenixFD* interface.
I'm trying to understand Phoenix velocities and how I should be using them to move my particles properly. So far I can successfully convert particle positions to grid coordinates, and query the velocity channel's x/y/z float values without issue.
However, the velocities I get seem to be too big, and when I move my particles with the velocities returned by the grid...they all move way too fast and go flying off into oblivion. I've found that multiplying the velocities by .03 and using that value to push my particles instead, seems to get motion closer to what I'd expect. For reference: my simulation runs like this:
1) get particle position
2) query phoenix cell at that position and get its velocity
3) set particle position to [current particle position + cell velocity]
4) move to the next frame and repeat for all particles....
I can't imagine .03 is some magic number, therefore I'm sure there's some velocity conversion I'm missing. I'm assuming that the velocities returned by the grid are in cell size units, not world units? That shouldn't affect my current setup though since my cell size is 1.0...but I figured I'd ask anyways.
Also, should I be interpolating between nearby cell velocities, based on the proximity of the query point to those neighbor cells? Or is just getting the velocity of the target cell good enough?
The SDK samples don't include any info about how to work with grid velocities (other than simply querying them)...so I'm feeling around in the dark here and would appreciate help!
tl;dr: I have particles and a phoenix grid. How do I use the velocities from the grid to move the particles around, so their motion matches the motion of the smoke in my phoenix sim?
Comment