Thinking Particles Banking/Align in 3ds Max

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2013
Thinking Particles Banking/Align in 3ds Max

I can't for the life of me figure out how to have an instanced geometry bank into a turn.

My setup is quite simple. I have one object that I want to follow another once it satisfies a "Distance Threshold". No problem. I then want it to Align to that object, which it does. The problem is that it snaps into the Alignment instantly. I understand why it is doing this as it is a Boolean.

How could I have the object over time rotate(align) and bank itself with the object that it is following?

Any help is greatly appreciated. I kept running into C4D answers, but they had blackboxes and features that TP in Max does not.
 
  01 January 2013
You could use an interpolation function between the current euler angle and its target euler angle.

Then by distance proximity you could weight it from from one to the other.
 
  01 January 2013
For some reason your formula is not showing up. But,

t*x + (1-t) *y

I'm assuming T is time? Just want to make sure, and could also be useful to someone looking for the same solution.
 
  01 January 2013
no its not time. Sorry T is confusing but it's your mix factor/range. T would be equal to anything between 0 and 1. So if t=.5 You have interpolated halfway. So a value of 1 would equal X and a value of 0 would equal Y.

Cheers,
Nick
 
  01 January 2013
You can use Follow node or make particles follows object by yourself. Then use Alignment node to constantly align particle to direction of travel (or to object).
And use Set Alignment node (use particle alignment data as Alignment input) and set amount of bank about Roll axis (your direction of travel axis)
 
  01 January 2013
I'm going to give this a try. I tried using the expression but it didn't really turn out too well. My biggest problem is just having the object ease into the turn instead of just snapping into the alignment on the next frame.

In fact this is my exact setup so far. Minus any sort of banking.
 
  01 January 2013
it is quite simple to align particle to velocity vector (direction of travel), calculate what is the yaw angle and then apply some roll angle to get banking. The problem is quite jerky movement, cause you get instantaneous angles and you need to smooth them over time.
You can try to store yaw angles in memory node for the last 3+ frames, calculate average (weighted average for example - (SumOfPrevYawAngles*weight + InstantYawAngle*(1-weight)) where weight is[0,1]) and then use averaged yaw angle to get banking.
 
  01 January 2013
***:::HALF SOLVED:::***

In my first setup I was using a "Set Alignment Operator" with the Leading Particle plugged into the Alignment and the following particle plugged into the Particle input.

By changing the Operator to just an "Alignment Operator" I was able to get it to sort of bank by choosing Direction of Travel and adding a bit of laziness to it. It's not 100% graceful but it does add a half banking motion.

I'm going to continue to try and solve it fully and report back if I find a perfect solution. Thanks for everyones help
 
  01 January 2013
Originally Posted by 3ak: it is quite simple to align particle to velocity vector (direction of travel), calculate what is the yaw angle and then apply some roll angle to get banking. The problem is quite jerky movement, cause you get instantaneous angles and you need to smooth them over time.
You can try to store yaw angles in memory node for the last 3+ frames, calculate average (weighted average for example - (SumOfPrevYawAngles*weight + InstantYawAngle*(1-weight)) where weight is[0,1]) and then use averaged yaw angle to get banking.


I'd hate to ask for a file, but if you ever have time is it possible to post an example? I only ask because I'm still new to TP - coming from Pflow, so the memory Operator is what throws me off still.
 
  01 January 2013
Ok. I attached example file. There are 3 boxes - 1st is the box object with [ath constraint, 2nd - particle with follow node and banking, 3rd - is the particle with smoothed banking ( check the differences between 2 and 3 at the turns)

I used straightforward approach to calculate the banking:
align particle to direction of travel where X axis is pointing forward, Y - side and Z - up. Then for every frame i store alignment in memory op and then find the current X axis in local space of that old alignment matrix. I get something like [0.95, 0.3, 0] or [0.95. -0.3, 0]. Sign of the Y component says me if it is right or left turn. Then i find angle between this vector and local X axis ([1,0,0]) and apply found sign. I used power func to emphasize angles (smaller power MULT node - more banking) float. And at last multiply result by multiplier (higher mult - more banking).

I store those angles for the last 5 frames and then every frame find the average and apply it as roll angle.

The last rule is a bit overcomplicated cause i check if it is 1st or 2nd particle to apply smoothed or non-smoothed roll angle.

It is just off the top of my head and a bit messy. So be gentle)
And there are of course other approaches.
Here is the video:
https://dl.dropbox.com/u/46208032/3...moothing%29.mp4
and scene file:

https://dl.dropbox.com/u/46208032/3...moothing%29.max
You need tp5 and 3ds max 2012+

Last edited by 3ak : 01 January 2013 at 03:37 AM.
 
  01 January 2013
This will take me a bit to pick apart, you weren't kidding! This is exactly what I'm looking for though. Despite all of the math involved, I understand the concept of what you did. Now I just have to dissect it to understand fully what you did.

Simply, it looks like you fed the first particle's angle into memory, and the following ones constantly check (every 4 frames because the iterator) what it's angle is and then the rest "smooths out" it's alignment.

Out of general curiosity, what are some math/TP resources you have used? I've been brushing up on my trig, but can always use more places to learn. Thank you for all of the help too, by the way.
 
  01 January 2013
Memory op allows you to store arrays of values under the one "variable" ("depth" in memory node).
When you create scalar "roll_angle" with depth 5 you can store 5 scalar so that every time you feed something into this input all older values are shifted. If all values are filled the oldest one erases. But when you read values from this array you need to provide depth - which element you want to read. Otherwise you'll get only the latest. That's why i use iterator to get all values, sum them in another memory variable and then find average.

And don't forget that every particle has it's own independent arrays. I have two particles (one with smoothing and one is not). So for every particle those arrays were created by memory node. Then i filled them with values and use to calculate banking independently and every frame.

As for the trig - i think all you need is dot, cross, length, normalize and vector&matrix&quaternion interaction. There are plenty of info on the internet.

As for the tp tutors - my favorite is the Joe Scarr's old one - TP for Production. Don't know if it is still available but it is worth every penny)
There is also tutorial by Hristo Velev (2 dvds), i don't have it personally but you may try it, cause i bet there is a lot of interesting in it)

p.s. Heard you guys has tp sdk at Pixomondo. Hope you'll make bunch of new nodes (houdini VOPS as inspiration)) and they will be available in next release)
 
  01 January 2013
This is a lot to take in at first glance. I do luckily have the Eat3D DVD's and Joe's too. I've run through Hristo's quite quickly. I think that one is very good for someone like me who is coming from Pflow exclusively. I haven't gotten to The TP for production but I soon will. When I skimmed through it, it seemed a bit more technical - which is good.

Particle Flow was fantastic at certain things, but I found out on our last show that at this point, it's not robust enough for HEAVY systems. I still love it for quick things such as my fume particle sources and even the typical Krakatoa things. But when it came down to just massive undertakings, I wanted to rip my hair out. For me I am a big fan of TP's expression node.

As far as the SDK, I'm at a different facility where that would take place, but something like the VOPS would be fantastic!

Last edited by mstarktv : 01 January 2013 at 10:36 PM.
 
  01 January 2013
Originally Posted by 3ak: p.s. Heard you guys has tp sdk at Pixomondo. Hope you'll make bunch of new nodes (houdini VOPS as inspiration)) and they will be available in next release)



I believe the new Math->Math helper and thew new Geometry helpers are what you are thinking of, and they are already available in TP5.
__________________
http://www.fx-td.com
 
  01 January 2013
Originally Posted by SoLiTuDe: I believe the new Math->Math helper and thew new Geometry helpers are what you are thinking of, and they are already available in TP5.


Yes, thanks, I widely use them (Math helper) even in example in this thread.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:33 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.