Jump to content

[SOLVED] Vizualizer synchronisation


photo

Recommended Posts

Posted

Hi again,

 

Working with the vizualiser I noticed that with low rate FPS, the visualizer produce artifact :

 

It's seem that the scene rendering is delayed one frame after the vizualizer.

So here you will see the grid partially on the mesh when it should be totally under (see on the right)

post-718-0-58969100-1345815494_thumb.png

Posted

You should set correct modelview/projection matrices for visualizer each frame before calling visualizer.renderXXX functions:

 

engine.visualizer.setProjection(projection);
engine.visualizer.setModelview(modelview);

Posted

Okay so it's seems that it's was the last frame projection/modelview.

 

Thank you.

Posted
You should set correct modelview/projection matrices for visualizer each frame before calling visualizer.renderXXX functions
Is there a special reason why this is not done automatically by the engine on render frame start based on active player ?
Posted

Actually ulf.schroeter it is set automatically during the render() method , that why I've been fooled.

The subtle thing is that even if the perspective should not cause trouble, when addRender*** is called, points positions are transformed with the current modelview matrix, which turns out to be the last frame matrix.

Posted

fully understood, it was more a question to UNIGINE crew, why visualizer are not automatically synchronized with current player transformation by the engine itself without any explicit user intervention. There had been already some one frame off problem between player and visualizer in the past (2009) which had been fixed.

  • 2 weeks later...
Posted

The reason is that such approach reduces the number of calculations. Otherwise, matrices would be reset each time the player position changes. We also need to check if the visualizer is loaded, if the editor or game player is used. If compared to only 2 functions to set modelview and projection matrices, the overhead can be pretty noticeable, especially in case complex behaviour of the camera is implemented in scripts.

 

I've added a notice into docs to clear this issue out.

×
×
  • Create New...