Jump to content

Export Crowd Agent to FBX

Recommended Posts

Hey guys !

I have a simple crowd agent that I put some anim onto in SOPs
What I do on the agent doesn't really matter, what I need is to export the agent with the animation to FBX

I tried simply exporting it with the FBX ROP, but the result was a point cache with no bones

How is one supposed to export a Crowd Agent to FBX ? I searched online, and haven't found a working solution

Attached is the simple setup in Apprentice
(I know Apprentice can't export FBX. That's just an example scene from my home - at work we have the FX version)


Link to comment
Share on other sites

  • 1 month later...

Hi Alain

To my knowledge there is no such option, You have to hack such yourself. I have made a set-up which requires re-rigging in houdini. It's cumbersome but it opens a whole range of possibilities. If you're interested i can elaborate further on it.



Link to comment
Share on other sites

Hello Michiel,
thanks for the answer !

Yeap, that's what I figured

I would love to know what sort of a setup you made !

In the meantime, I did a proof-of-concept HDA (non-commercial, so we can't export the result to FBX) for this, following your advice to "hack it"
(I actually meant to do the tool earlier, but my attention diverted to other things. Your answer made me come back to it and actually make the tool)

It is by no mean flawless, but seems to work quite well with the three tests I did


Link to comment
Share on other sites

I agree, why isn't it possible straight away ?..

Anyways, I've just tried the tool with Houdini FX, and exporting the result to FBX and importing in Maya works almost as intended
Sure, I need to set the Units to Millimeters in the Import Dialog in Maya to have a sensible scale, and sure, if the first bone has been scaled it will be huge in Maya, but the animation is there


The first bone is scaled because of the initial import in Houdini with the Agent SOP. It seems to automatically scale down (or up) the first bone to account for the unit difference. That makes this issue down the line, and I'd like to fix it.
I've actually got a fix (for every bones, starting from the root, transfer the scale factor down the line and accumulate it, and finally scale the local translate of every bone by the scale factor. This way I won't have to actually scale the bone)
It seems to work with my test case (the one seen above), but there are a few things I need to tweak for it to really work

Edited by Alain2131
Link to comment
Share on other sites


Hi Alain

Thank you for having a look at your setup.
Mine is a bit less vex-y. Please take a look at my link:
The subnetwork "Bone" is a regular import of an fbx-structure. In my experience, this is quite useful to keep, to be able to re-export fbx-es again. Sometimes the lack of such a layout causes exports to fail. Within the network there sits a geo-node "Pointcloud" with an agent setup in it. Here it is important that the agent has the same bonestructure and names as the original fbx. To output stuff you do to agents back to fbx I unpack them to pointtransforms, make normals and ups. The object-level-transforms all get a pointconstraint, based on the point-name-attribute. All you have to do now is rop-FBX-export the scene to have a new fbx animation of your character.
The constraint stuff i automated through a python script. Doing that a couple of times by hand forced me to choose between learning some Python or pull slowly all my hairs out.
I have extensive knowledge about using motionbuilder and fbx-caveats. This, until now, proves for me to be the most robust way. Scaling issues should be easily solved at sop-, agent, or object-level.
I hope this might be of help, I will definitely study your examples as well better also. This is great stuff, it allows one to mis-use the agent workflow for layout, animation clip libraries, sequencing and all kind of other super lightweight stuff. 

Link to comment
Share on other sites

Interesting file !

It took me a little while to understand where the Constraint Network was.. Or should I say "Constraint Networks", one inside each "bone"
I don't know if doing a setup with only one constraint network for all the bones would be faster. That would be a nice thing to investigate

The huge advantage with your method is that it doesn't require any baking, you have real-time result on the "real" mesh
There also seem to be no fuss at all for scaling non-uniformly (even though I would try to never do that, it's still nice to have the possibility)
Looks indeed robust.

You pretty much pointed out my intended use case
Let's say I have an FBX of a tree that is rigged and skinned for simulation. What I need is an idle animation of it in the wind, possibly at different wind strength. The idea would be to import it as an agent, create a polyline rig from the actual bones, and plug it into a Vellum simulation for the dynamics.
Now, normally, we would just transfer the animation back into the mesh with pointdeform (I assume, I've never done it myself), but that doesn't help me - I need to export this animation to a game engine. A point cache won't work, I need animated bones.
Right then, a good thing to note is that agents has a suite of handy dandy VEX functions to modify them, even when they're still packed (see manual_anim - it's the same, but a simulated input is used instead of transforming manually). So I just transfer the animation from the simulation back onto the agent, and BAM. It's "baked" onto a "real" bone hierarchy.
The problem was then the question of this thread... How am I supposed to get it out of Houdini now ? Which has been answered - hack it.

My intent from the start was to abuse the agent workflow for this use (these VEX functions were all I needed)

Using your setup, this exact idea I mentioned is even easier - no need to transfer it back onto the agent at all, the constraint network takes care of that. Neat !

As for my setup, I intend to eventually be able to export more than one agent at a time (so it could be used to actually export a simulated crowd) - although it will surely get pretty slow when exporting tens or hundreds of agents at once (generating a skeleton for each of them, then baking the animation individually).
But I foresee some kind of setup using TOPS that just imports the mesh, generate the polyline necessary for the simulation, simulates it, and then export it back into FBX.... The completion of this idea will depend of my needs. There is sure to be a HEAP of issues with this. It's just an idea.

In the meantime, I fixed the scaling issue - but it is nowhere as convenient as yours on this point. It just gets rid of any scaling in SOP by applying it directly on the points' position before handing off the geometry to the script. And it uses only the X component, so only Uniform Scaling. And no scale animation.
But eh, when is it that there is animated scale on a rig ? Especially in-game, it is often not supported. So I don't feel too bad about this.

I attached only the HDAnc, since it's the only thing that changed. The only change is that scaling thing.


Link to comment
Share on other sites

Hi Alain

Indeed my setup is brute force python-showering al the 'bones' with constraints with proper settings. I also use a script to clean/strip those bones again, to avoid clutter. Can share, if interested. Yours is more procedural, nice to see. Would be more the way to go, especially for batching, indeed. What I send you is a lighter-weight version of a more complete setup, in which I actually was also able to re-animate. So a complete rigging system, where the animation can be send to controllers and edited/created. And exported again to agents or pointclouds or fbx-es. Next on my list is investigating agentfullbodyik-vex, for making this round-trip even more smooth.
About your thing to put all constraints in one network: It is nicer for maintenance and clarity, of course. In terms of performance my hunch is it will not matter. These constraints get read once into memory and from there on they will evaluate, regardless of their location.

And speaking about your 'manual' user case: Yes! Also I have flushed this through vellum. Very cool for secondary/dynamic character effects. The rigging bypass I just mentioned renormalizes the output again, so all animation fits nicely on the skeleton (aka no bone-stretching). Your unpacking-of-agents or my separate-rig-network might be completely obsolete with the agentfullbodyik tool set. Obscure stuff, but Matt Ebb made a talk about this at Siggraph Asia.

Regarding scaling: Scale animation could be recorded in these pointclouds/manipulated agents. In my setup I would python-send it to bone length and scale parameters through scale-constraints or hscript point-expressions. Scale in fbx-structures, especially when send over to different applications, is highly unpredictable. Sending these values as translation to the proper sibling would generate more reliable stretching.

Anyway, since we both seem to be chasing the same idea, I would like to exchange ideas/techniques more often about this. It gives a fresh look at a murky area. Please let me know if you'd be interested.





Link to comment
Share on other sites

Hey Michiel,

Funny you mentioned that video, since this is where I got the idea to try and use agents to solve my problem !
He showed at 21:32 that he modified the animation manually, and transferred it back onto the rig using some IK function from the agent suite of VEX functions. I thought "Hey, I could do the same !". And indeed I could.

I'm curious about the "renormalisation of the output" you mentioned.. An example would be appreciated.
My guess is that it would make the normalized animation not fit 100% the original, but I would like to see it for myself

I personally don't need the fullbodyik for my current needs, but I might investigate it to know how I could (ab)use it

For the scaling, I might allow for an option to bake it onto the points (as I am doing) but with the addition of using the animated scale, that way there won't be any issues importing and exporting it around, since it's just positions (so as you said, "recording" it onto the point cloud).

I would appreciate to get in touch with you ! Discussing this with someone would be awesome ^_^

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...