Exporting a simulated cloth model to source doesn't work

Started by tempUser, August 24, 2014, 02:30:23 PM

Previous topic - Next topic

tempUser

Hey.
First of all: Thanks for your WW plugin.
I started with 3ds Max 2015 two days ago so I'm pretty much a total noob when it's about modelling.
Your plugin helps a ton, tho.

Here is my situation/problem:
I'm trying to model an animated waving flag and export the model to Counter-Strike: Source.
So I created a rectangle shape and added the Garment Maker + Cloth modifier to it.
Then I made a wind force, added a little pole to hold the flag in place and simulated the cloth model.

This is my result:
https://www.youtube.com/watch?v=7yk4xsaEJkk

Now I want to export it to source, but it doesn't work.
I selected the pole as rootmodel and added the waving flag to the helper (with the button "Add Sel" in WWMT).
Then I added a new sequence called "waving", set the timeline to 0-300 and compiled it.
After that I exported the VMT and model.
When I take a look at it in HLModelViewer and select a sequence I just have a model which doesn't move.
The frame bar at the bottom scrolls from 0 to 300, but the model doesn't do anything.

I did another test and placed a single sphere in the room, moved it around and created keyframes for it.
After I exported it, it is animated just fine. So my export settings are ok.

So my guess was, that you can't just export simulated models ?
Because when you simulate a cloth model there are no keyframes at the bottom of 3ds max.
I think you have to select the cloth modifier and click "create keys" to make the keyframes, but it that doesn't work either (or I made something wrong ?).



Do you have any ideas ?

Thanks in advance!

Joris Ceoen

#1
Hello tempUser,

As you said, simulated meshes cannot be read by Source. All animated models must work with bones and keyframes. I'm not sure if there is a plugin that automates a waving process with bones, but if there is one (and it may be as waving flags are a popular item) you should probably use it that way. Much like any movement of vertices seperatly or scaling in an animation, it won't work for good old Hammer.

The only way I can think of is moving a whole object without assigning it a bone, but that's not what you need. Maybe Shawn knows a better workaround for this.

Another way I can think of is having a lower poly model (always better for performance anyways) and then simulate the cloth, get the amount of frames you need, and then put a bone on each vertice and at each frame adapt the bones to the corresponding position of each frame... A bit tricky and probably tiresome to do, but works.

wallworm

I was wondering when I'd see this question pop up again :) (It is brought up on occasion but it's been a while.)

Joris' answer is pretty solid.

There are some ways to do this, however... but are expensive and may not be worth the effort.

Anyway, here are the two options for CS:

1) Use Flex animations.

2) Render the Animation to animated texture and use the animated texture on a single low-poly mesh.

Both have pros and cons.

If using your own MOD, you could probably program a shader that works with the best results (kind of like $treesway in CS:GO or plants in Dear Esther).

I will elaborate more on possibilities but am away again for a couple hours at least.


tempUser

Thanks for your answers.
Well, that's a pity  :-\

I'm currently working on a Capture the Flag mod and that's why I need a good flag model.
It should be animated to make it look more real.
My idea was to make them look like this (probably the bottom model):


I guess they would be easier to animate, because they are hanging down (compared to the example in my first post).
So I just need to make it wave a bit to the side and to the front.

Joris Ceoen

Quote from: tempUser on August 24, 2014, 08:00:36 PM
Thanks for your answers.
Well, that's a pity  :-\

I'm currently working on a Capture the Flag mod and that's why I need a good flag model.
It should be animated to make it look more real.

I guess they would be easier to animate, because they are hanging down (compared to the example in my first post).
So I just need to make it wave a bit to the side and to the front.
Well if that is the one, you can easily animate a model like that, with bones and low-poly result. CS:GO like Shawn says has the treesway but I doubt it would be smart to use a shader like that on a physical object, or one that needs to be carried around. Besides, CS:GO has flags that are neatly animated, and yet are low-poly as well :)

tempUser

Could you be a bit more precise about the bones and low-poly thingy ?

This is my model so far:


(The flag should hang over the pole later. Don't even know how to do that  :-[)

I tried a rectangle shape + animated noisy modifier for the waving effect which looks quite ok, but it's too simple.
So I guess I have to go with the bones (as you said).

Should I use a Standard Primitive Box and make it very thin or should I use a rectangle spline shape for the flag?
And what do you think how many bones will I need ?

Thanks.

wallworm

A simple plane or box won't work unless there is enough geometry on the flag to accommodate the folding/waving. Also, the Noise modifier can help for the static shape, but animations to the noise modifier will not translate into Source unless you export it as an animated texture or as Flex animations... which are unlikely to be what you want for this.

You will need to add a few bones to your rig and a skin modifier to the flag itself. Then you need to animate the bones such that it creates the effect you want. The more bones, the more realistic but more costly (in time to make and for system resources in-game).

Once you get a grasp on that, you could experiment with Jigglebones to create dynamic motions. But again this can become costly.

Joris Ceoen

Quote from: wallworm on August 27, 2014, 12:50:01 PMyou could experiment with Jigglebones to create dynamic motions. But again this can become costly.
Actually why haven't I thought about this in the first place. Personally if it needs to be carried around, jigglebones are pretty cool and will move based on how you walk/run. However, it is costly only if you have like more than 5 jigglebones (for one model). Yet, I still think it wouldn't be so costly if the flags are the only models with jiggles. It's tricky to get working, but it's sure worth the try.

Mamorex


plantonly

#9
Hey there folks! Just wondering if anyone has since come up with an easy way to mimic a realistic cloth like simulation? It seems like from previous answers on this topic, that either using a flex animation (didn't work for me), or animated texture (not right for my situation), or jiggle bones (seems a tad noob unfriendly and expensive), or just moving the damn polys/object yourself, are the only ways to get an animation in source.

Surely there are other ways...how about snapping your mesh/skin/bones to a fake mesh/cloth/wind simulation, to generate keyframes for a source friendly animation? Why does source have to make it so difficult...

wallworm

The only way to do vertex animations in Source is via Flex animations. Cloth sims from Max won't be coming to Source any time soon (and probably never).

I'd investigate using $treesway shader animations.

plantonly

Thank you! I did try adding the flex mod to my animation, but only the original movement transferred to source. Please could you recommend how to transfer the flex animation too? Also, if you know of any links to anything related to treesway, that would be awesome! All i've seen is some vmt code, but I'm baffled as to how that makes a static prop move in a very wind/cloth-like simulation.

Cheers, Shawn!

Joris Ceoen

Go to your CS:GO VPK, open up the materials folder, go to foliage, and open the vmt's for any of the big detailed trees that all CS:GO maps use. They have the $treesway command. You'll have to experiment with it. I think env_wind also affects the strength of this effect. Currently there are no articles on the SDK Docs wiki, which is sad and surprising imo.

plantonly

Thanks, Joris! I'll check it out. Can't wait to see the magic behind materials manipulating the animation of static props!

plantonly

Figured it out! But it wasn't easy, having to decipher between many files and values before I could get the required effect. Does anyone know if it's expensive? Thanks!

SMF spam blocked by CleanTalk