Jump to content

[SOLVED] Animations with LOD problem.


photo

Recommended Posts

Hello, 

I found a problem with the animations when you combine animations and LOD. I will explain the attached photo and how I got there. I'm working on 2.7.2.2 version.

The problem happened to me in a scene where I had a door system with animations and LODs, but I was seeing something weird. When I walked away from a door that I had just opened and approached another of the same type, I noticed that when loading the same LOD (Near), the door kept the same frame in the animation of the previous door. 

It seems like the engine optimizes the load of a certain LOD and when I pick it up, it returns the one that had the other door, without taking into account the frame of the animation.

I will explain how I created the example below so that you can simulate it:

I have put two doors, both have a loaded animation, I have put the LODs at a little distance and added to one of the doors an oscillating expression, forcing the door to change the LOD. Second LOD I have deactivated so that the change is noticed at a glance. Now I have a static door and another that oscillates from the first LOD to the second.
Well, at the first door I gave it to play and I put it in a loop. Usually the error appears, but sometimes it does not. To force it, you can give play to the second door and then stop, stopping the animation at once. However, as the example shows, loading the first LOD, it takes the same one that uses the first door.
 

That's my expression if anyone wants to simulate fastly:

{

float frequence = 0.02f;

float amplitude = 1.0f;

double time = cos(engine.game.getFrame()*frequence)*amplitude;

Node node = getNode();

node.setPosition(dvec3(time,0,0));

}

 

Thank you for your attention.

 

 

GIF.thumb.gif.a47d7596304ddce1412403a33f3ba1c2.gif

Edited by raul.salas
Link to comment

Hi, here's the test scene, just copy all the content on the data folder on a new 2.7.2.1 base project.

 data.7z

If the error not appears on running, please, open the editor and press play and stop on the second door, you'll see.

EDIT: The first time i open the project the error not appears, i delete the door, clone the first one, sets as child on expression, reset the position, disabled the loop check, and stops the animation, and you can force it to appear.

Edited by raul.salas
Link to comment

Why do you use a skinned animation for this simple rotation?

I also would apply the rotation to a dummy rather then to the mesh itself and then just put the mesh as a child of the dummy.

Link to comment

Thank's for your response, i'll be waiting for some news about the future fix.

Werner, in the example you can not see but in this case, the full animation includes a sequence with the door handler animated. 

Link to comment

Hi Raul,

Yes, there is a bug.
Temporary workaround:
1) Refresh current animation state every frame

void update() {
// ObjectMeshSkinned door;
door->setFrame(0, door->getFrame(0));
}


2) Play looped "idle" animation on every door in the scene

void init() {
door->setAnimation(0, "idle");
door->setLoop(1);
door->play();
}


Best regards,
Alexander

  • Like 1
Link to comment

It works. It can be a good solution until it is solved. But, the project where i'm working ends near the possible date of the next version. If you could prepare a patch when you have it ready , I would be very grateful.

Thanks Alexander!

Edited by raul.salas
Link to comment
  • silent changed the title to [SOLVED] Animations with LOD problem.
  • 2 months later...

Hi Raul,

You can also try to patch engine sources:

source/engine/framework/direct3d11/D3D11MeshSkinned.cpp
source/engine/framework/opengl/GLMeshSkinned.cpp

Just find following line:

if (buffer.frames[is.vertex_index] != frame)

and replace it with:

if (buffer.frames[is.vertex_index] == is.frame)

This fix will be availble in 2.8 SDK update.

Thanks!

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

Link to comment

Hi, Silent. This are great news! As we can't move now the project to 2.8 (project is in final stages) we will patch 2.7.2 sources.

We will let you know if it works fine.

Regards, Javier

Link to comment
  • 1 month later...

Hi, we have recently faced some problems that might be related with the previous issue. In this case, animating one ObjectMeshSkinned inside a NodeReference makes other NodeReference pointing to same file to make strange behaviours. I attach a sample with reproduces this issue following these steps:

  1. Open editor
  2. Edit mode on DOOR_1 NodeReference
  3. Play the animation of 760x1850__a-lh_door ObjectMeshSkinned
  4. Move camera

The sample does not have bin/ folder but I left patched Unigine_double_x64.dll and patched cpps to make sure my patch was correct. Is a good practice to animate ObjectsMeshSkinned inside NodeReference?

Thanks, Javier

animation_lod_patch.7z

Link to comment

Hi, there is the video.

In our application, the same LOD issue appears in runtime. We have many NodeReference pointing to same node (as DOOR_1 and DOOR_2). We place them in scene as NodeReference and when we play (by code) an animation for one, the others begin to 'close' for LOD 1.

I think that this might be a bad patch by our side, can you send us the 2.7.2 patched dlls so we can test in our app?

Regards

Link to comment

Hi Silent, it is working fine right now.

We came up again with the issue because Assemble tool in SDK Browser did not copy Unigine_double_x64.dll from our project bin/ folder, it copies DLL from project's SDK.
When we tested versions after assembling and before sending to client, issue pop again.

Right now we added DLL manual copying to our 'version making' pipeline but it might be useful for Assemble tool to make that for us.

Regards, Javier

Link to comment
  • 4 weeks later...

Hi!

I have problem  with animation in LODs too.

I have anten with animation and 4 LODs.

I tried: linked LODs objects(without animation) to one object(with animation). But the parent does not inherit the animation to children(

I tried: to export all LODs with animations(all LODs has the same animation) and setting LODs "Visibility". But the animation on the different LODs is not the same(in 3dmax animation all lods is the same). 

Question 1:  How to inherit the animation to children(add animation dummy and linking LODs object)? 

Question 2:  How can I do when when switching LODs animation will coincide??

 

 

anim_BUG_1.JPG

Link to comment

aie

Not sure that I've understand your issue correctly, but maybe adding this Node to the force update list via method addUpdateNode() will help to update animations when surfaces are disabled?

If this doesn't help - could you please send us a minimal test scene (only data folder content will be enough).

Thanks!

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

Link to comment

This parameter("Time") is current animation key???

If i change this parameter("Time"), the object should change its position\rotation\.. according to the animation???

UG_animation1.jpg

Link to comment
Quote

I can do simple object animation  with LODs without programming??? For example: I want to have a animated object all time.

In that case with LODs you need to add custom logic that will continue animation play on disabled node (addUpdateNode()).

 

Quote

Question 1:  How to inherit the animation to children(add animation dummy and linking LODs object)? 

Not sure that I've understand this question correctly. Could you please give us more information on this? If your objects has the same bone hierarchy you can just play the same .anim file on multiple objects.

 

Quote

If i change this parameter("Time"), the object should change its position\rotation\.. according to the animation???

Yes, that's animation time. When you change this field nothing happens, but when you press Play animation will continue playing from that specific time. You can also modify Tracker tool to control the animation more precisely:

Thanks!

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

Link to comment
×
×
  • Create New...