IPB Style© Fisana

Jump to content


Animated Trees


  • Please log in to reply
63 replies to this topic

#1 theShadow

theShadow

  • Community Members
    Pip

  • Discens
    (90 posts)

Posted 09 June 2012 - 05:29 PM

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

Why has a developer ever needed any reason other than "it looks bloody awesome"?

I do 3D modeling and map creation for an open source fps called xonotic

#2 Sighvatr

Sighvatr

  • Community Members
    PipPipPip

  • Duplicarius
    (252 posts)

Posted 09 June 2012 - 10:52 PM

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 by Sighvatr, 09 June 2012 - 10:52 PM.


#3 majapahit

majapahit

  • Community Members
    PipPip

  • Sesquiplicarius
    (157 posts)

Posted 12 June 2012 - 01:03 PM

Animated trees sounds nice
it gives a sense of realistic environment

Edited by majapahit, 12 June 2012 - 01:11 PM.

----------
Fried Banana, Steamed Banana, Banana Kolak, Nagasari, Banana Ceriping, and still many more delicious banana based cuisine.

#4 WhiteTreePaladin

WhiteTreePaladin

  • WFG Programming Team

  • Primus Pilus
    (1,275 posts)

Posted 12 June 2012 - 04:34 PM

Looking at AoE3 and BFME2, I really do miss the animated trees. It adds a lot to the feel.
Brian [aka WhiteTreePaladin]

0 A.D. Gameplay and UI Developer

#5 zoot

zoot

  • Community Members
    PipPipPipPipPipPip

  • Primus Pilus
    (1,472 posts)

Posted 13 June 2012 - 08:05 PM

I wonder if 0 A.D. might benefit from using a library like ngPlant:

Posted Image

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:

Posted ImagePosted Image

(Screenshots from BlenderArtists.org)

#6 historic_bruno

historic_bruno

  • WFG Programming Team

  • Primus Pilus
    (1,923 posts)

Posted 13 June 2012 - 09:16 PM

View Postzoot, on 13 June 2012 - 08:05 PM, said:

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.
Ben Brian [ aka historic_bruno ]

Wildfire Games Programmer
Contact me: ben@wildfiregames.com

#7 zoot

zoot

  • Community Members
    PipPipPipPipPipPip

  • Primus Pilus
    (1,472 posts)

Posted 13 June 2012 - 10:53 PM

View Posthistoric_bruno, on 13 June 2012 - 09:16 PM, said:

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 by zoot, 13 June 2012 - 11:24 PM.


#8 historic_bruno

historic_bruno

  • WFG Programming Team

  • Primus Pilus
    (1,923 posts)

Posted 14 June 2012 - 02:42 AM

View Postzoot, on 13 June 2012 - 10:53 PM, said:

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 (y)

View PostLion.Kanzen, on 14 June 2012 - 12:20 AM, said:



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. ;)
Ben Brian [ aka historic_bruno ]

Wildfire Games Programmer
Contact me: ben@wildfiregames.com

#9 myconid

myconid

  • WFG Programming Team

  • Centurio
    (789 posts)

Posted 14 June 2012 - 05:29 AM

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 trees
  • each tree vertex knows its height from the ground
  • vertices higher up sway more (in the wind direction)
  • swaying is done by adding a sin or cos wave to the vertex positions
  • maybe there's some randomness to make different trees look unique
All 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 by myconid, 14 June 2012 - 05:30 AM.

Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#10 theShadow

theShadow

  • Community Members
    Pip

  • Discens
    (90 posts)

Posted 14 June 2012 - 03:00 PM

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

Why has a developer ever needed any reason other than "it looks bloody awesome"?

I do 3D modeling and map creation for an open source fps called xonotic

#11 WhiteTreePaladin

WhiteTreePaladin

  • WFG Programming Team

  • Primus Pilus
    (1,275 posts)

Posted 14 June 2012 - 03:15 PM

It's equivalent to unit breathing / idle animation; subtle, but it makes the game seem more real and less static.
Brian [aka WhiteTreePaladin]

0 A.D. Gameplay and UI Developer

#12 Pureon

Pureon

  • 0 A.D. Art Team

  • Primus Pilus
    (3,220 posts)

Posted 14 June 2012 - 04:34 PM

Unfortunately animating most of the existing tree models would substantially increase lag, negating the added realism of animated trees.
Pureon
0 A.D. Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com

#13 Shield Bearer

Shield Bearer

  • 0 A.D. Art Team

  • Primus Pilus
    (1,579 posts)

Posted 14 June 2012 - 04:54 PM

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.
Amish Coelho [aka Shield Bearer aka gAMeboy]
Wildfire Games Art Department
Contact me: amish13@gmail.com
AIM handle: Mythgamer
MSN Account: amish13@live.com


"The fate of 0 AD is in the hands of those who have vision and perseverance." - Ken Wood

#14 kosmo

kosmo

  • Community Members
    Pip

  • Discens
    (81 posts)

Posted 14 June 2012 - 05:22 PM

Would it then be possible to use the global wind direction/intensity for smoke also?

#15 myconid

myconid

  • WFG Programming Team

  • Centurio
    (789 posts)

Posted 14 June 2012 - 05:27 PM

View PostPureon, on 14 June 2012 - 04:34 PM, said:

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.


View Postkosmo, on 14 June 2012 - 05:22 PM, said:

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 by myconid, 14 June 2012 - 06:17 PM.

Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#16 zoot

zoot

  • Community Members
    PipPipPipPipPipPip

  • Primus Pilus
    (1,472 posts)

Posted 14 June 2012 - 06:36 PM

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 by zoot, 14 June 2012 - 06:37 PM.


#17 myconid

myconid

  • WFG Programming Team

  • Centurio
    (789 posts)

Posted 14 June 2012 - 07:07 PM

View Postzoot, on 14 June 2012 - 06:36 PM, said:

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?
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com

#18 Pureon

Pureon

  • 0 A.D. Art Team

  • Primus Pilus
    (3,220 posts)

Posted 14 June 2012 - 07:32 PM

View Postmyconid, on 14 June 2012 - 05:27 PM, said:

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?
Pureon
0 A.D. Designer / Texturer / 3D Artist
Contact email:
pureon{@}wildfiregames.com

#19 zoot

zoot

  • Community Members
    PipPipPipPipPipPip

  • Primus Pilus
    (1,472 posts)

Posted 14 June 2012 - 08:02 PM

View Postmyconid, on 14 June 2012 - 07:07 PM, said:

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.

#20 myconid

myconid

  • WFG Programming Team

  • Centurio
    (789 posts)

Posted 14 June 2012 - 08:17 PM

View PostPureon, on 14 June 2012 - 07:32 PM, said:

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.

View Postzoot, on 14 June 2012 - 08:02 PM, said:

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! ;)
Myconid
Wildfire Games Programmer
Contact me: myconid@wildfiregames.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users