warmanw

Hi guys.. Working on environment animations for an adventure game.

We are having difficulties with applying wind on our trees and bushes on the map.

So please check the screens and let us know how would you do the batch wind effect.

what we have now is all spine objects have wind animation which is played once in a while(randomly). but it looks totally different when one bush gets affected by wind and next by bushes not.



We were thinking of using wind shaders, though not sure if that will work with spine.

Also any suggestions on animation itself would be appreciated.. We dont really like fluid effect when bushes react to wind

Thanks in advance.
Аватара пользователя
warmanw

Kickstarter Backer
  • Сообщения: 121

Nate

I can see randomly would look odd. What about triggering wind animations every random duration, but delay triggering the animations based on the skeleton position, eg from right to left.

Every notice bushes in Mario games? They dance to the music and are super cool. :)
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

warmanw

Thanks for your time Nate, I really appreciate any of it spent on my questions/problems :D

Well we think of a way to imitate a wind by moving some object on the map which ever bush collides with it, will be affected.

I just want to know if there are better ways to achieve similar effects.

I personaly like Ori and the Blind Forest Walkthrough Part 14 - Thornfelt Swamp - YouTube props animations, they look so well programmed.
Аватара пользователя
warmanw

Kickstarter Backer
  • Сообщения: 121

Nate

Looks like a lot of the background elements in Ori are just wiggling loops. That might be sufficient, but I guess that depends on a lot of things. Just don't forget to finish your game! ;)
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

Harald

From a shader programming point of view, the cited examples above (e.g. Ori's foliage) are well suited for animation in shaders because there you have some vertices at the base (ground level) and some further away from this fixed attachment position. The typical grass shader will move the verices around (e.g. in sine-wave motion) depending on how far away from the fixed attachment position they are.

If on the other hand as in your game, you have a top down view with all vertices at the outer shell and equally distant from the fixed point, this will not be well suited to be animated in a shader (and maybe also not to be animated in general?). You would need to add some overlapping geometry for each branch / bushel to be able to animate it in a convincing way, such as can be seen here. You can skip the trunk and everything hidden from top view of course.

Nevertheless, I would also not like to recommend changing your trees entirely, but maybe it's feasible to split and overlap some of the regions, to gain a lot with little effort.
Аватара пользователя
Harald

Harri
  • Сообщения: 1054

warmanw

Thank you @Nate and @Harald very much for your help.. it was inspiring and very valuable.

We will slice the assets more deeply to make more custom animations. And with code just run big and thin collider over the environment from right to left, whoever collides with it wind animation will be played.

But whatever I do now I dont like the wind animation and how I approach to it. I think I need more expert advice here.
I tried several times to use skinned meshes. But I always end-up with bushes/trees looking like liquid.

- since we also have idle, we would like to have wind played on different track to avoid weird mixing.
- we want to have all bushes in one project and all trees in another. and change them with skins.
- we use unity SkeletonMecanim component -> can we use tracks here? if no we may change to SkeletonAniamtion

so the question is...
- Do we approach to it correctly? maybe one of above points is already wrong.
- Overall good advice about the animation of wind for these assets would be appreciated. or any refs.
- Can we use tracks with SkeletonMecanim I didnt find an info about it

P.S. I dont know if this tread still actual for this question(let me know I can repost)
У вас нет необходимых прав для просмотра вложений в этом сообщении.
Аватара пользователя
warmanw

Kickstarter Backer
  • Сообщения: 121

Harald

warmanw писал(а):- Can we use tracks with SkeletonMecanim I didnt find an info about it
Yes, you can use multiple mecanim layers. However, note that the mecanim integration does not provide the full feature set of the SkeletonAnimation especially in terms of blending/transition customization. You could give it a try though, just add multiple layers in the Mecanim Animator window and add your animations as you normally would.
warmanw писал(а):We will slice the assets more deeply to make more custom animations.
I do not yet see slices in the images you posted, or are these other images? What I think might improve the look would be e.g. 3 layers per tree that show different transparent areas, and each layer is animated differently, so that not all parts wobble in the same direction and at the same speed.

Maybe it looks nice if you add more high-frequency animation to simulate small leaves moving by making the top layer have a noisy transparency pattern, e.g. as when using Photoshop's dissolve layer blend mode. It's just an idea though.
Аватара пользователя
Harald

Harri
  • Сообщения: 1054

Zooch

Thanks for your inputs Harald and Nate! I'm working on the same project with Arman and figured I'd elaborate a little on how we solved the wind cascading issue (the original question), for those who might come across a similar problem. I also just felt like it was a generally interesting solution to share.

We've created a prefab in Unity called WindTriggerParent, and it has two children. The parent game object has a movement script attached (explained below) and the WindTrigger child object has a box collider (set to trigger) and a WindTrigger script (also explained below). We attached a sprite render component to it as well just so we could visualize its movement for testing. The other child object - Destination - is just a transform position. It's just meant to mark the end point of our collider's movement.

SpineWindProcess01.png


The idea is that the collider will spawn in a certain spot (we can move it around in the editor like any other game object), then it moves toward the destination point. We are able to customize the collider's speed, easing, number of loops and type of looping.

Here's a breakdown of our WindTriggerMovement.cs script, placed on the WindTriggerParent game object:

SpineWindProcess02 - WindTriggerMovement.png


We use DOTween to move the collider, which has lots of useful features (such as the LoopType and Ease functions). There's a free version on the unity asset store: https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676?aid=1100l355n&gclid=Cj0KCQjwsvrpBRCsARIsAKBR_0KHHj_nCRwBjyr6As95xvRePHgBzm0Wr2c2Mvk0pAP9rRyuLl7KUloaAlusEALw_wcB&utm_source=aff

Here's a screenshot of the child game object WindTrigger:

SpineWindProcess03.png


And here's the WindTrigger script that's attached to that game object:

SpineWindProcess04 - WindTrigger.png


At this point, our trigger and collider are set up and working as intended, but now we need to do some work on the Spine assets in order to get them to interact with our collider.

For this, we've created a SpineProp.cs script. Here's the inspector's item list for additional reference:

SpineWindProcess05.png


And finally, here's the SpineProp.cs script. This file has some code in it that isn't required to have this running, which I tried to outline in the previous image.

SpineWindProcess06.png


Here's the resulting effect:

У вас нет необходимых прав для просмотра вложений в этом сообщении.
Zooch
  • Сообщения: 5

Nate

Looks neat, thanks for sharing! Do you have a GIF or video of the finished wind?
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

Zooch

Yep! Was just editing the post to add the video (linked from imgur). The video was 80kb too large to upload here ^_^.

From this point we are able to see how our animations react when cascaded and can make adjustments accordingly, which Arman has already begun doing (and the new animations are noticeably better than the ones linked even in my gif because I haven't had time to swap the new anims in Unity). Additionally, we have a couple more things left on the to-do list to make this foliage feel great, such as including the shadows in the animations and also not starting all the animations at the same time (you can see their idles all playing at the same time).

Video relinked here:
Zooch
  • Сообщения: 5

Nate

Cool, it looks very nice! I can see how relatively simple trees wouldn't look good animated continuously. This is a neat effect!
Аватара пользователя
Nate

Nate
  • Сообщения: 9264

Harald

This looks very cool! Thanks for sharing!
Аватара пользователя
Harald

Harri
  • Сообщения: 1054


Вернуться в Unity