[IDEA] Windy trees mod 🌲

Hoor de wind waait, do-oor de bo-men.
(if you’re dutch, you get it)

I came up with this mod idea the other day. But seeing as I won’t be toying with it for a while, because of the everlasting time constraints. Curse you, Perry the Platypus Everlasting Time Constraints!!! *balled fists * , I thought I’d share it. So if anyone wants to take a whack at it instead, here it is.

The idea is to make trees move in the wind, when the weather has the right circumstances. You know, makes things more alive. I was thinking to accomplish it in the following way:

  • Animations for every tree in all the four (eight?) directions. (Taking advantage of symmetry when existent)
  • Find a way to detect when it is windy, and in which direction the wind blows (if that is a thing)
    • Otherwise somehow get some code that picks at random what the wind direction is, although I think it is something that is defined in game, because of the sandstorms.
  • Somehow hook up stuff to make the trees play the right animation when windy weather is detected.
5 Likes

Would love to have some fluffy happy trees dancing with the wind :evergreen_tree::deciduous_tree::palm_tree::grinning:

1 Like

The trees bow down before the wind and so should every sensible creature :eagle::evergreen_tree::tornado::jubilant:

This would really be a great feature, just the idea to be able to pick up the wind direction visually, would give a great depht to the world of hearth.

Detecting windy weather is very easy. Actual wind animations for everything would be super expensive. But you could probably hack something together with a vertex shader.

2 Likes

blending animations would probably let you reduce the number to make down to four (one for each cardinal direction). Also, you can probably get away with only animating trees semi-randomly; for example, only 1/3 are actually moving at a given time, especially the ones closer to the camera target. Maybe 1/2 to 2/3 of the trees near the camera target, and about zero to 1/4 of the trees in the distance

1 Like

Weel, you can, I guess take advantage of symmetry. If you have a tree hat is completely radially symmetric (i.e. turn it 90 degrees and it always looks the same), you only need one animation, provided there is some way to actually display the animation in a turned way, since I believe even radially symmetric models have a front.

How about instead of having swaying trees, just create periodic simultaneous CubeMitter particle effects on every tree, to symbolize leaves being blown? This would be significantly computationally cheaper than animating, and it would still add enough life to the world to fit with the idea.

2 Likes

not really though. adding particles would increase the amount of triangles that need to be rendered, whereas as an animation, requires you to calculate the mesh at a given frame. both would increase computational load significantly (particles might still be a bit cheaper if in small enough numbers.)

Hmm, I don’t know enough about SH’s rendering engine to reply with any authority, but it’s always seemed to me that CubeMitter is conceptually simple. On the contrary, SH’s animations appear to have a lot of moving parts, no pun intended, as shown by the “animations” folder in Stonehearth root directory. Again, I’m not speaking with any confidence here, but it seems like this is the area where Stonehearth caches its animations for use in-game. We do not see an equivalent CubeMitter folder, so that leads me to assume that animations must be harder for the engine, since they involve at least a read, possibly a write cycle. But I am only guessing. At the end of the day, I have a pretty good idea of how to accomplish the CubeMitter solution, but I wouldn’t even know where to start with animating trees.

Particles can use less than an animation… but that’s only if it’s used in smaller quantities. animation have a lot of vertices to manipulate per an object; so, it’s easily more taxing. That in mind, to add a particle wind effect to a tree would probably use a fair amount particles; so it’s hard to say if particles would have better performance as opposed to an animation.

Particles are probably the most expensive, followed by bone animations, followed by a vertex shader that moves the vertices based on a wind speed/direction uniform. I would suggest that latter.

2 Likes

sounds about right.