theShadow Posted June 9, 2012 Report Share Posted June 9, 2012 I have been thinking about various ways this could be done, without having too large an impact on performance, and have also gotten a few Ideas from other games. I recently played a game called Dear Esther, and instead of animating all of the plants, it had animated "detail" plants mixed in with non animated plants. The movement was enough that it looked like all the plants were animated. So for 0ad, animations could be assigned to a percentage of the trees, instead of all of them. It could even change which tree is being animated, so that every tree is animated, but never at the same time. and the animations themselves could just be a rotation of the whole entity from side to side, and assigned procedurally. Would something like this work in 0ad? Quote Link to comment Share on other sites More sharing options...
Sighvatr Posted June 9, 2012 Report Share Posted June 9, 2012 (edited) I play a game called Mount & Blade: Warband which every piece of vegetation was static. But a DLC called Napoleonic Wars came out and brought animation to every tree and grass. I'm pretty sure animation in vegetation will not be a problem if created properly.Or what you can do is when ever a unit of some kind interacts with a vegetation of some kind, it will become animated. Like if you watch a character walk through grass, the grass will move and then stand back up again. If somebody is chopping down a tree, the tree will rock back and forth and eventually topple over. Edited June 9, 2012 by Sighvatr Quote Link to comment Share on other sites More sharing options...
majapahit Posted June 12, 2012 Report Share Posted June 12, 2012 (edited) Animated trees sounds niceit gives a sense of realistic environment Edited June 12, 2012 by majapahit Quote Link to comment Share on other sites More sharing options...
WhiteTreePaladin Posted June 12, 2012 Report Share Posted June 12, 2012 Looking at AoE3 and BFME2, I really do miss the animated trees. It adds a lot to the feel. Quote Link to comment Share on other sites More sharing options...
zoot Posted June 13, 2012 Report Share Posted June 13, 2012 I wonder if 0 A.D. might benefit from using a library like ngPlant:If I understand correctly, it will actually generate a random (subject to input parameters) tree and give you a description of how each leaf and branch relate to each other. This would allow us to animate it with something like this. Later iterations could even do crazy things like animating individual leaves on high-end systems but to begin with it can just support basic low poly trees much like those already in the game:(Screenshots from BlenderArtists.org) Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted June 13, 2012 Report Share Posted June 13, 2012 I wonder if 0 A.D. might benefit from using a library like ngPlant:That kind of thing has been around for a long time. What I wonder is how easy is it to find "good" parameters? I've always seen mentioned that it's quite difficult. And more practically, can it generate trees that work well with alpha testing rather than alpha blending, which I think will be our preferred method of rendering trees (lots of little leaves/branches would look ugly)?About animated trees: can people link or make some videos showing animated trees in other games? I tried looking up AoE3, BFME2, and only saw very slight tree animation and not clearly on every map, understandably most people show off gameplay in their videos rather than graphic effects I don't own any such games. Quote Link to comment Share on other sites More sharing options...
zoot Posted June 13, 2012 Report Share Posted June 13, 2012 (edited) That kind of thing has been around for a long time. What I wonder is how easy is it to find "good" parameters? I've always seen mentioned that it's quite difficult. And more practically, can it generate trees that work well with alpha testing rather than alpha blending, which I think will be our preferred method of rendering trees (lots of little leaves/branches would look ugly)?Tree generation has been around since the early 70's, but those early algorithms were guided more by mathematical and botanical principles (like fractals) than by visual appearance. ngPlant seems to be based on a more recent (1995) and well-established technique by Jason Weber and Joseph Penn, designed specifically for photorealism. Here is a sound bite from their paper, which was presented at SIGGRAPH:"Our attention in designing the model was focused on allowing a general user to create trees that generally match images from books or photographs.The user needs no knowledge of botany or complex mathematical principles, only a basic understanding of geometry. We concentrated on the general structural appearance of a tree instead of the biological and biophysical principles that produced its structure."Commercial packages like SpeedTree also seem to use some variation of this technique.Furthermore, ngPlant comes with a "designer" application which allows you (or an artist) to model a base tree which can then be randomized within some specificed range. The model is exported as a special file which can be imported into the game using the C++ library and seeded at runtime.So overall, it seems like a pretty controlled and professional solution.As for alpha testing vs. alpha blending, I imagine that is entirely up to the user - the library only concerns itself with creating the basic tree model (the mesh, if you will). Texturing it would be done with whatever tools artists normally use. Edited June 13, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted June 14, 2012 Report Share Posted June 14, 2012 Furthermore, ngPlant comes with a "designer" application which allows you (or an artist) to model a base tree which can then be randomized within some specificed range. The model is exported as a special file which can be imported into the game using the C++ library and seeded at runtime.Interesting, probably something for the art team to keep in mind when they focus on revamping the gaia assets, I wouldn't mind more varied tree models Thanks for the example! Maybe it's just me, but I hardly notice the subtle swaying of trees in that video? I mean when you focus on the tree and the camera isn't moving, you see it clearly, but most of the time during a game I'd be oblivious to such a minor effect. The fields were more apparent but only from being so ugly... What really stood out to me in that video were the effects surrounding naval combat, which are much lacking for 0 A.D. Quote Link to comment Share on other sites More sharing options...
myconid Posted June 14, 2012 Report Share Posted June 14, 2012 (edited) Here's a more recent game that has nice trees: Here's how I think it can be done (without even modifying the tree models):there's a global wind direction/intensity shared by all treeseach tree vertex knows its height from the groundvertices higher up sway more (in the wind direction)swaying is done by adding a sin or cos wave to the vertex positionsmaybe there's some randomness to make different trees look uniqueAll this can be done in the vertex shader, so the performance cost is probably minor. Same effect can be generalised to also do things like moving grass, cloth etc. Edited June 14, 2012 by myconid 1 Quote Link to comment Share on other sites More sharing options...
theShadow Posted June 14, 2012 Author Report Share Posted June 14, 2012 tree animation is indeed a subtle effect, but it adds a lot to the feel of the world. When things like trees and grass are moving, it is much easier to believe that the world is truly alive Quote Link to comment Share on other sites More sharing options...
WhiteTreePaladin Posted June 14, 2012 Report Share Posted June 14, 2012 It's equivalent to unit breathing / idle animation; subtle, but it makes the game seem more real and less static. Quote Link to comment Share on other sites More sharing options...
Pureon Posted June 14, 2012 Report Share Posted June 14, 2012 Unfortunately animating most of the existing tree models would substantially increase lag, negating the added realism of animated trees. Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted June 14, 2012 Report Share Posted June 14, 2012 If we're really going for animated trees, I think we should do what myconid suggested. I think that's how its done in Anno 1404 too. Quote Link to comment Share on other sites More sharing options...
kosmo Posted June 14, 2012 Report Share Posted June 14, 2012 Would it then be possible to use the global wind direction/intensity for smoke also? Quote Link to comment Share on other sites More sharing options...
myconid Posted June 14, 2012 Report Share Posted June 14, 2012 (edited) Unfortunately animating most of the existing tree models would substantially increase lag, negating the added realism of animated trees.True, if you try to rig the models with skeletons and animate them manually (in that case the vertex transforms are done on the CPU, and that has a severe performance penalty). What I'm suggesting is to send some generic parameters to the GPU (time and wind direction/intensity) and let it do what it does best.Would it then be possible to use the global wind direction/intensity for smoke also?That's a different effect entirely (particles), though I suppose they could share the same wind parameters. Edited June 14, 2012 by myconid Quote Link to comment Share on other sites More sharing options...
zoot Posted June 14, 2012 Report Share Posted June 14, 2012 (edited) This. "Using a hierarchical form of vertex displacement, [deformation and wind modelling] can be combined in a single vertex shader, fully leveraging the power of modern GPUs to realistically animate thousands of branches and ten thousands of leaves at practically no cost."If tree animation has to be very low priority, myconid's solution seems a lot more straightforward, of course. Edited June 14, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
myconid Posted June 14, 2012 Report Share Posted June 14, 2012 This."Using a hierarchical form of vertex displacement, [deformation and wind modelling] can be combined in a single vertex shader, fully leveraging the power of modern GPUs to realistically animate thousands of branches and ten thousands of leaves at practically no cost."If tree animation has to be very low priority, myconid's solution seems a lot more straightforward, of course.Whoa, that's really clever and looks amazing! It seems like it's using the low-frequency components of a frequency-space texture to transform the trunk and branches and the high-frequency components to transform the leaves... I only skimmed the paper, but I suppose it needs a super-fast Fourier transform library to be done efficiently? Quote Link to comment Share on other sites More sharing options...
Pureon Posted June 14, 2012 Report Share Posted June 14, 2012 True, if you try to rig the models with skeletons and animate them manually (in that case the vertex transforms are done on the CPU, and that has a severe performance penalty). What I'm suggesting is to send some generic parameters to the GPU (time and wind direction/intensity) and let it do what it does best.Interesting. Am I right in thinking something like that would take a long time to implement in order to test performance impact? Quote Link to comment Share on other sites More sharing options...
zoot Posted June 14, 2012 Report Share Posted June 14, 2012 Whoa, that's really clever and looks amazing! It seems like it's using the low-frequency components of a frequency-space texture to transform the trunk and branches and the high-frequency components to transform the leaves... I only skimmed the paper, but I suppose it needs a super-fast Fourier transform library to be done efficiently?As far as I can tell, they just trace linear trajectories through the texture (one texture per branch level). But you'd probably need some level of detail technique to be able to animate tens of trees at once. Quote Link to comment Share on other sites More sharing options...
myconid Posted June 14, 2012 Report Share Posted June 14, 2012 Interesting. Am I right in thinking something like that would take a long time to implement in order to test performance impact?Probably not too long.As far as I can tell, they just trace linear trajectories through the texture (one texture per branch level). But you'd probably need some level of detail technique to be able to animate tens of trees at once.Yeah, I figured it would be a lot simpler than I thought initially! Quote Link to comment Share on other sites More sharing options...
myconid Posted June 15, 2012 Report Share Posted June 15, 2012 (edited) Interesting. Am I right in thinking something like that would take a long time to implement in order to test performance impact?The correct answer is 25 minutes. Edited June 15, 2012 by myconid Quote Link to comment Share on other sites More sharing options...
Pureon Posted June 15, 2012 Report Share Posted June 15, 2012 The correct answer is 25 minutes.lol, now you're just showing off! Amazing. Quote Link to comment Share on other sites More sharing options...
zoot Posted June 15, 2012 Report Share Posted June 15, 2012 (edited) The correct answer is 25 minutes.Very nice! Might it be advantageous to introduce a slight bit of randomness? Perhaps in the phase? Edited June 15, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
Potter Posted June 15, 2012 Report Share Posted June 15, 2012 The correct answer is 25 minutes.WOW! Looks amazing what a simple effect can do for the game ambience... Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted June 15, 2012 Report Share Posted June 15, 2012 Hahahahaha! Man, you are too cool! Did you say you could do this for cloth too? Amazing stuff! Keep it up bro Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.