Swaying Objects ( non animated )

Started by
4 comments, last by riuthamus 11 years, 1 month ago

How would one go about making weighted objects? Is this something I can setup via Maya and export to be used in the game engine? For example if we wanted the bottom part of our grass mesh to NOT move and we wanted to allow the top to move back and forth via a wind modifier would we use something in maya to make that happen?

This could be used for cloth and such or flags as well... I know that in neverwinter nights ( the first one ) they had something like this but it doesn't control clipping. None of the objects were animated either. The main reason I am asking this is for our cloth elements or maybe the grass.... if we can get something like Maya weighted verts to work than we could get some very nice movement out of these things for a small cost.

Thanks for any ideas in advance.

Advertisement

Grass

One option is to use vertex color on the model and assign one channel (alpha if you need the RGB channels) to indicate how much a vertex is influenced by a wind modifier. Then use a special grass/tree vertex shader, where you move the vertieces along the wind directions (use smooth perlin noise or similar to break up the monotony) depending on the vertex color.

cloth

For cloth you need a physics engine to support it. Cloth simulation is much more demanding then grass animation, therefor take a look at what your physics engine supports. Often a statically vertex animated mesh is a good start, or use some bones to animate it (inverse kinetics).

Did you try searching for some papers first? There is plenty of information on the web regarding grass/foliage animation and real-time rendering. Most popular ones are probably 2 articles from GPU Gems:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html

http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html

+1 for using vertex colors painting method as it gives you most flexibility and is especially good for more complex models (some bushes, trees, weeds and other). But for simple quad based grass you dont have to even paint vertices - as described in mentioned papers (GPUGems Ch07), you need to know upper vertices of a quad to animate them (lower ones touching the ground stay static), and there is very easy method to do this - you use texcoords for it. With default texcoord approach, top vertices have UV's of (0, 1) and (1, 1) so you have to check if texcoord.t >= 0.9 for example. It will be truth for two upper vertices which you can then animate. There is probably a way to optimise this branch somehow, so its for your consideration only. Just wanted to point that for quads its much easier than vertex colors and don't require you to store additional vertex attribute.


Where are we and when are we and who are we?
How many people in how many places at how many times?

Did you try searching for some papers first? There is plenty of information on the web regarding grass/foliage animation and real-time rendering. Most popular ones are probably 2 articles from GPU Gems:

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch16.html

http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html

+1 for using vertex colors painting method as it gives you most flexibility and is especially good for more complex models (some bushes, trees, weeds and other). But for simple quad based grass you dont have to even paint vertices - as described in mentioned papers (GPUGems Ch07), you need to know upper vertices of a quad to animate them (lower ones touching the ground stay static), and there is very easy method to do this - you use texcoords for it. With default texcoord approach, top vertices have UV's of (0, 1) and (1, 1) so you have to check if texcoord.t >= 0.9 for example. It will be truth for two upper vertices which you can then animate. There is probably a way to optimise this branch somehow, so its for your consideration only. Just wanted to point that for quads its much easier than vertex colors and don't require you to store additional vertex attribute.

While GPU Gems can be of help often they lack some of the guidance needed to actually get it working. Some people who frequent this section have been rather helpful with our grass project and instead of nesting it in another grass thread I figured it deserved its own topic. The coloring vertex was the suggestion of Telanor ( but I doubted it since there seemed to be a better way ). I was wrong again and he was right!

We are using a complex mesh so some of the more basic functions do not work. We had implemented one previous when it was just a flat quad.. and it caused our current model to look like seaweed. :P Thank you for the links though and for the confirmation as to how we could do it.

Yeah, as someone already mentioned in previous thread, your topics even help refreshing some knowledge and give opportunity to discuss some more "modern" approaches. Searching GameDev does not always yield best and most up-to-date information. smile.png Its just that these 2 papers describe quite well two most widely used techniques, including vertex color, so I felt a bit like stating the obvious and hence asked if you read the papers.


Where are we and when are we and who are we?
How many people in how many places at how many times?

Thanks, I don't want to be too annoying but our situation is slightly unique since we are trying to work from the fringe rather than the.... tried and true! :P We couldn't have done half of what we have without the help from this place.

This topic is closed to new replies.

Advertisement