Hello
I want to be able to extract animations out of individual agents simulated in a crowd-setup. How can this be done? If I use an unpack on the crowd-sim I can see some bonecapture info but nothing which I seem to be able to (re-)use. Preferably I would want to write out the unpacked agent in a fbx file with bones, skins and animation.
Thank you
Agent unpacking for the purpose of extracting their skeletal animations?
3111 4 3-
- mackerBaehr
- Member
- 86 posts
- Joined: Feb. 2014
- Offline
-
- cwhite
- Staff
- 761 posts
- Joined: Oct. 2012
- Offline
-
- doctorbob
- Member
- 30 posts
- Joined:
- Offline
you don't need to unpack agents to access their bones. there's a few vex functions for looking at their animation.
for example, this will make a single point with a transform from an agent bone called “r_wrist_01”:
you get the general idea. extrapolate to multiple bones, use python HOM, whatever.
cheers,
chrisg
for example, this will make a single point with a transform from an agent bone called “r_wrist_01”:
// extract a named bone transform from agents p@orient = 0; i@agentId = @ptnum; s@boneName = 'None'; //get agents rig transforms and names matrix agent_transforms[] = agentworldtransforms(0, @ptnum); string agent_transform_names[] = agenttransformnames(0, @ptnum); //get agent transform matrix agent_xform = primintrinsic(0, 'packedfulltransform', @ptnum); string bone = "r_wrist_01"; int idx = agentrigfind(0, @primnum, bone); if (idx >= 0) { matrix boneMat = agentworldtransform(0, @primnum, idx); //get pos vector pos = {0,0,0} * boneMat; //add point at joint position + add agent xform int virtual_pointnum = addpoint(0 , pos *=agent_xform); //get orient + add agent xform matrix3 rotmat = polardecomp(matrix3(boneMat*agent_xform)); vector4 qrot = quaternion(rotmat); int set_bonename = setpointattrib(0,'boneName', virtual_pointnum , bone); int set_orient = setpointattrib(0,'orient', virtual_pointnum , qrot); int set_charId = setpointattrib(0,'agentId', virtual_pointnum , @ptnum); } removepoint(0, @ptnum);
you get the general idea. extrapolate to multiple bones, use python HOM, whatever.
cheers,
chrisg
-
- mackerBaehr
- Member
- 86 posts
- Joined: Feb. 2014
- Offline
-
- mackerBaehr
- Member
- 86 posts
- Joined: Feb. 2014
- Offline
Update: It seems to work indeed as guessed: pointwrangle after ‘crowd_sim_import’. Fascinating!
A follow up question, trying to insert multiple bone-names in the vex code generates immediately errors (to the Gods of VEX; i am learning). How can this be done? A single wrangle per bone sounds a bit tedious. Could these bone-names be queried automatically and applied afterwards to the newly created point as attribute?
In Python I can't do nothing, complete and utter noobness. Though once more comfortable with VEX it is on my list
A follow up question, trying to insert multiple bone-names in the vex code generates immediately errors (to the Gods of VEX; i am learning). How can this be done? A single wrangle per bone sounds a bit tedious. Could these bone-names be queried automatically and applied afterwards to the newly created point as attribute?
In Python I can't do nothing, complete and utter noobness. Though once more comfortable with VEX it is on my list
Edited by mackerBaehr - Aug. 2, 2018 03:59:54
-
- Quick Links