Author Topic: Exporting a simulated cloth model to source doesn't work  (Read 4287 times)

tempUser

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
  • Acolyte
    • View Profile
Exporting a simulated cloth model to source doesn't work
« on: August 24, 2014, 02:30:23 PM »
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:


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!
« Last Edit: August 24, 2014, 02:34:35 PM by tempUser »

Joris Ceoen

  • Global Moderator
  • Full Member
  • *****
  • Posts: 206
  • Karma: +22/-0
  • WallWorm Ambassador
    • View Profile
    • GamingReviews
Re: Exporting a simulated cloth model to source doesn't work
« Reply #1 on: August 24, 2014, 06:07:53 PM »
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.
« Last Edit: August 24, 2014, 06:13:33 PM by jorisceoen »
de_cathedral (WWMT map: http://csgo.gamebanana.com/maps/181217)
de_pontifici (WWMT map: http://www.wallworm.net/index.php/topic,1261.0.html)
space_marble_unlimited (WWMT map: http://csgo.gamebanana.com/maps/185591)
surf_greatriver_2015 (WWMT map: http://csgo.gamebanana.com/maps/187811)

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3335
  • Karma: +95/-1
  • Behind me?
    • View Profile
    • Wall Worm Tools
Re: Exporting a simulated cloth model to source doesn't work
« Reply #2 on: August 24, 2014, 06:23:31 PM »
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.

Shawn Olson
Author of the Wall Worm Model Tools

tempUser

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #3 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.
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

  • Global Moderator
  • Full Member
  • *****
  • Posts: 206
  • Karma: +22/-0
  • WallWorm Ambassador
    • View Profile
    • GamingReviews
Re: Exporting a simulated cloth model to source doesn't work
« Reply #4 on: August 25, 2014, 09:56:55 AM »
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 :)
de_cathedral (WWMT map: http://csgo.gamebanana.com/maps/181217)
de_pontifici (WWMT map: http://www.wallworm.net/index.php/topic,1261.0.html)
space_marble_unlimited (WWMT map: http://csgo.gamebanana.com/maps/185591)
surf_greatriver_2015 (WWMT map: http://csgo.gamebanana.com/maps/187811)

tempUser

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #5 on: August 26, 2014, 09:41:25 PM »
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.
« Last Edit: August 26, 2014, 09:43:34 PM by tempUser »

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3335
  • Karma: +95/-1
  • Behind me?
    • View Profile
    • Wall Worm Tools
Re: Exporting a simulated cloth model to source doesn't work
« Reply #6 on: August 27, 2014, 12:50:01 PM »
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.
Shawn Olson
Author of the Wall Worm Model Tools

Joris Ceoen

  • Global Moderator
  • Full Member
  • *****
  • Posts: 206
  • Karma: +22/-0
  • WallWorm Ambassador
    • View Profile
    • GamingReviews
Re: Exporting a simulated cloth model to source doesn't work
« Reply #7 on: August 27, 2014, 01:45:14 PM »
you 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.
de_cathedral (WWMT map: http://csgo.gamebanana.com/maps/181217)
de_pontifici (WWMT map: http://www.wallworm.net/index.php/topic,1261.0.html)
space_marble_unlimited (WWMT map: http://csgo.gamebanana.com/maps/185591)
surf_greatriver_2015 (WWMT map: http://csgo.gamebanana.com/maps/187811)

Mamorex

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #8 on: October 19, 2014, 06:46:39 PM »
Try this https://mega.co.nz/#!8l4V2ARZ!LLwYylUzatqmsFVjj42C_F-ksE27syDo85nEfcxU478 with 3DS Max. We have a 256 bones limit in Source engine games.

plantonly

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #9 on: January 07, 2017, 04:06:33 PM »
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...
« Last Edit: January 07, 2017, 04:12:04 PM by plantonly »

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3335
  • Karma: +95/-1
  • Behind me?
    • View Profile
    • Wall Worm Tools
Re: Exporting a simulated cloth model to source doesn't work
« Reply #10 on: January 07, 2017, 04:42:25 PM »
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.
Shawn Olson
Author of the Wall Worm Model Tools

plantonly

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #11 on: January 07, 2017, 04:48:50 PM »
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

  • Global Moderator
  • Full Member
  • *****
  • Posts: 206
  • Karma: +22/-0
  • WallWorm Ambassador
    • View Profile
    • GamingReviews
Re: Exporting a simulated cloth model to source doesn't work
« Reply #12 on: January 07, 2017, 04:53:55 PM »
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.
de_cathedral (WWMT map: http://csgo.gamebanana.com/maps/181217)
de_pontifici (WWMT map: http://www.wallworm.net/index.php/topic,1261.0.html)
space_marble_unlimited (WWMT map: http://csgo.gamebanana.com/maps/185591)
surf_greatriver_2015 (WWMT map: http://csgo.gamebanana.com/maps/187811)

plantonly

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #13 on: January 07, 2017, 10:17:03 PM »
Thanks, Joris! I'll check it out. Can't wait to see the magic behind materials manipulating the animation of static props!

plantonly

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
  • Acolyte
    • View Profile
Re: Exporting a simulated cloth model to source doesn't work
« Reply #14 on: January 08, 2017, 10:24:00 PM »
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!