Jump to content

[SOLVED] Synchronizing vertex animations


photo

Recommended Posts

Hello,

I was wondering why the Syncker plugin does not synchronize the vertex animations of e.g. ObjectGrass. I know that the transformation of the vertices happens in the vertex shader and is hard to synchronize, but I think it should be easy to synchronize the vertex transformations by synchronizing the time, because the calculations seem to be deterministic.

Example for ObjectGrass (grass/base/vertex/common.h):

97: float stem_angle = dot(position.xy, to_float2(s_material_animation_stem.x)) + s_material_animation_stem.w;

I am not exactly sure how "s_material_animation_stem.w" is calculated right now, but it seems to happen internally. If there was a global shader parameter "s_time" similar to "s_frame" it would be possible to control the animation with Unigine::Game::setTime() or something similar. This would also enable us to reverse and pause time without adjusting the scale parameter. That is important because we receive our current simulation time from an external application.
You could introduce a new material state in order to keep the old behaviour. This could then also be used for other objects e.g. ObjectCloudLayer.

So are there any problems with this approach I am overlooking right now?

Best regards

Link to comment

Hello,

Thank you for the insight. We also thought about vertex animation synchronization, but it required a lot more research than the team thought in the first place. At the moment this task is postponed. This will require a decent work digging in CPU and GPU sync mechanics.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hello,

I'd like to also stress that vegetation sync between channels is very important for us too! Some of our future tests will be landing near trees and seeing the effect of rotor generated wind on the vegetation, as a feedback to pilots (so not just eye candy!).

Thanks!

Link to comment
1 hour ago, morbid said:

Hello,

Thank you for the insight. We also thought about vertex animation synchronization, but it required a lot more research than the team thought in the first place. At the moment this task is postponed. This will require a decent work digging in CPU and GPU sync mechanics.

I understand that, but I think you kind of missed my point. If the movement is deterministic and only depends on the time you only have to synchronize the time between channels.
If you modify the grass material to include a time parameter, replace "s_material_animation_stem.w" with the time and supply the shader with e.g. Unigine::Game::getTime() it already partly works. There is weird flickering if the time is constant so apparently it is not that easy.

But in general I was wondering if that could be a solution for some of the vertex animations and how much work it would be to integrate as a general option. Controlling the environment by just setting the time would be easier to handle than multiple offset parameters (e.g. setAnimationCoverageOffset). Again, I can not estimate if that would be feasible as a general option.

Link to comment

Well, we do understand your point, and this will be based on Game::getTime(). So you're totally right here.

However, we do not 100% sure that this will work out fast and will produce a stable result that we can ship as a generic solution. There could be potential pitfalls, that's why I stressed the research phase.

This feature indeed important for convincing vegetation rendering, and we'll deliver it in the future updates. The team is focused on other tasks at the moment, so I can't provide some concrete ETA for this, sorry.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
50 minutes ago, morbid said:

Well, we do understand your point, and this will be based on Game::getTime(). So you're totally right here.

I am sorry if I sounded condescending. It just sounded like you were talking about  the GPU state.

50 minutes ago, morbid said:

However, we do not 100% sure that this will work out fast and will produce a stable result that we can ship as a generic solution. There could be potential pitfalls, that's why I stressed the research phase.

Could you maybe share some insight on how it works now? What is stored in "s_material_animation_stem.w"?

50 minutes ago, morbid said:

This feature indeed important for convincing vegetation rendering, and we'll deliver it in the future updates. The team is focused on other tasks at the moment, so I can't provide some concrete ETA for this, sorry.

We do not need this immediately, so this is completely fine! :)

Link to comment
  • 3 months later...
  • silent changed the title to [SOLVED] Synchronizing vertex animations
  • 3 months later...
On 12/21/2020 at 1:25 PM, silent said:

Should be fixed in 2.13 update.

How can we control vertex animations outside of syncker? Game::setTime still does not seem to affect the animations.

Link to comment

I cant get it to work in an empty CMake project. I just added a basic ObjectGrass and a Cylinder primitive and tried calling setTime(0.0f) in the various update() functions to pause animations. If this actually works on your side, I will send you my project.

Link to comment
×
×
  • Create New...