Page 1 of 1

Questions on animating environmental props in source 2007

PostPosted: Sun Mar 17, 2013 3:23 am
by Hawke
I've got a couple of questions and I thought I would ask the repository of all Half Life 2 knowledge, the Gentlemen of Interlopers. If these topics have been covered elsewhere I apologise in advance.

Basically I'm heading up development on a mod based in Source 2007, and I'm wanting to update the graphics as much as I can. My main forte is modeling so that what I'm concentrating on for the moment. Specifically I've been plugging away on environmental models, trees, bushes etc.

Now the question. I want to be able to have trees swaying in a breeze. Nothing extreme since this is a multiplayer mod but some movement would be good. Now is this something that has to be animated, and if so would that involve bones? Or could I use a env_wind modifier in hammer?

Related to this is getting the detail sprites to move as well, to simulate wind blowing through grass. Any ideas on how that is done?

Thanks in advance.

Re: Questions on animating environmental props in source 200

PostPosted: Sun Mar 17, 2013 9:43 am
by ErikKiller
Hawke wrote:Now is this something that has to be animated, and if so would that involve bones?

Yes. I assume so.
Hawke wrote:Or could I use a env_wind modifier in hammer?

No.
Hawke wrote:Related to this is getting the detail sprites to move as well, to simulate wind blowing through grass. Any ideas on how that is done?

Not sure if it's ever been done in Source. Never seen anything like it.

Re: Questions on animating environmental props in source 200

PostPosted: Sun Mar 17, 2013 9:46 am
by Sathor
You might be able to use an animated texture on simple grass stuff to simulate some movement, but I have no idea if that would look any good.

Re: Questions on animating environmental props in source 200

PostPosted: Sun Mar 17, 2013 12:40 pm
by Mehis
You can make detail sprites sway from the whatever.vbsp in your gamefolder.
There's even a tutorial about: http://www.interlopers.net/tutorials/33402

Swaying props need to be animated. There are probably some modifiers for 3ds max and other modelling programs that mimic wind.

Re: Questions on animating environmental props in source 200

PostPosted: Sun Mar 17, 2013 4:10 pm
by Epifire
If I am correct though you could theoretically simulate realistic wind if you could toggle the wind animation to turn on and off from the actual wind entity in Hammer. Therefore you could combine a lot of your wind properties all into one controller, unifying your wind effects.

Now of course your trees need animations that would go accordingly but done right it should look pretty good when finished.

Re: Questions on animating environmental props in source 200

PostPosted: Mon Mar 18, 2013 3:54 am
by Plague
In terms of getting the model to react to the env_wind you can't do it straight up.
Your best bet is an idle swaying motion, which is just an animated model naturally.

If you wanted to get complex, you could potentially add the support for "wind physics" on top of the existing jigglebone system. I'd assume this would be difficult, although something could be taken from the rope entities which can interact with env_wind's if I recall right.

Depends on the situation I suppose.

Re: Questions on animating environmental props in source 200

PostPosted: Mon Mar 18, 2013 4:01 am
by Gary
CSGO used a shader to make their trees' leaves sway. That way they could move and still be a prop static.

Re: Questions on animating environmental props in source 200

PostPosted: Mon Mar 18, 2013 5:10 am
by Hawke
Thanks for the replies all, I can see I have my work cut out for me.

CSGO used a shader to make their trees' leaves sway. That way they could move and still be a prop static.


Any idea if that system would work in 2007? It seems like they added a few bells and whistles to CS:GO that aren't exactly doable elsewhere.

Re: Questions on animating environmental props in source 200

PostPosted: Wed Mar 20, 2013 8:41 am
by Black_Stormy
I think if you have access to the vertex shaders you should be able to make the leaves sway, it's not a particularly new feature. You may need to educate yourself on them a bit first though.

As for animating the tree, your best bet will be to rig and animate it in your modelling program and then export the animation as the idle animation. Try to use as few bones as possible, keyframing tends to get expensive AFAIK.

Re: Questions on animating environmental props in source 200

PostPosted: Thu Mar 21, 2013 7:32 am
by Hawke
Hmm, vertex shaders sounds the most promising. Am I correct in assuming that vertex shader animation, and flex animation is the same thing?

In any event I see I have my homework cut out for me. If I get any decent looking results I'll post them up here.

Re: Questions on animating environmental props in source 200

PostPosted: Thu Mar 21, 2013 11:30 am
by Black_Stormy
Negative. Vertex shaders that manipulate the vertexes are defined in code (in the vertex shader file) and flexes are defined by pre-set meshes. It's like cheese and chalk. Keyframing is yet another sort of animation, where meshes are rigged to bones and animated using keyframes. It's too much to explain right now but as you look into it you'll get the idea.

Re: Questions on animating environmental props in source 200

PostPosted: Thu Mar 21, 2013 10:46 pm
by Hawke
Black_Stormy wrote:Negative. Vertex shaders that manipulate the vertexes are defined in code (in the vertex shader file) and flexes are defined by pre-set meshes. It's like cheese and chalk. Keyframing is yet another sort of animation, where meshes are rigged to bones and animated using keyframes. It's too much to explain right now but as you look into it you'll get the idea.


Ah I understand now.

Apparently someone already did exactly what I want to do.


However, while I feel I understand the basic concepts now, I have no idea how to translate it into real work. I understand static models, planes on the models for leaves but how do I use vertex coding to get them to move? If you can help point me in that direction I would be very indebted to you. Coding is rather above my head.

Re: Questions on animating environmental props in source 200

PostPosted: Mon Apr 01, 2013 12:48 pm
by kraid
Since you possibly will need a lot of grass, adding it as animated models isn't a good idea at all.
Such things are usually done with vertex shaders, at least in Unity or UDK and other engines supporting this by default.
In source you'd need to write your own custom shader for this.

As for the Trees, it depends on a few more things.
If the whole tree should sway, including the branches, it should be an animated model.
If swaying of the leaves is enough, then it might be doable with the same custom vertex shader as well.

One issue i see is how to determin the wind direction within the shader, since i don't know if reading it from the entity is possible in source. So it might be neccessary to use a predefined direction.