View Issue Details

IDProjectCategoryView StatusLast Update
0032723Open CASCADEOCCT:DRAWpublic2021-12-11 15:26
Reporterkgv Assigned Tosmoskvin  
PrioritynormalSeverityminor 
Status verifiedResolutionfixed 
Product Version7.5.0 
Target Version7.7.0 
Summary0032723: Draw Harness, ViewerTest - sloppy animation in WebGL
DescriptionRunning animation in WebGL shows FPS higher than possible with VSync (like 100-200 FPS on 60Hz display).

Opening a complex scene reveals the problem - these extra frames are duplicates, so that FPS looks high, while animation becomes sloppy and overall application experience becomes slow.

One issue is with emscripten_async_call() called with 0 argument redirecting to setTimeout().
Instead, viewer animation was expected to be handled by emscripten_async_call() with -1 argument redirecting to requestAnimationFrame().

Another issue is that command "vanimation" calls ViewerTest_EventManager::ProcessExpose(), which queues next update via emscripten_async_call(), but if update was already queued - updates are doubled (or further multiplied in worse case) leading to bad animation performance (several frames are redrawn while user sees only one update).
Steps To ReproduceScenario 1:
- Start WebGL sample or Draw Harness session with 3D Viewer.
- Start clicking on View Cube rapidly to initiate animation and check for FPS.
Result: FPS might exceed VSync limit.

Scenario 2:
- Open a complex scene.
- Enable expensive features like Depth Peeling.
- Start animation.
Result: on slow hardware (e.g. mobile phone) demonstrated FPS looks fine, but experienced performance is obviously worse.

pload XDE MODELING VISUALIZATION
box b1   0   0 0 50 50 50
box b2 150   0 0 50 50 50
box b3   0 150 0 50 50 50
vinit View1
vdisplay -dispMode 1 b1 b2 b3
vfit
vaspects b1 -color RED -transparency 0.5
vaspects b2 -color RED -transparency 0.5
vaspects b3 -color RED -transparency 0.5
vtorus t1 50 25
vtorus t2 50 25
vtorus t3 50 25
vlocation t1 -reset -rotate 0 0 0 0 1 0 90 -translate 175 175 -125
vaspects  t1 -color GREEN -transparency 0.5
vlocation t2 -reset -rotate 0 0 0 0 1 0 90 -translate 175 175 25
vaspects  t2 -color GREEN -transparency 0.5
vlocation t3 -reset -rotate 0 0 0 0 1 0 90 -translate 25 175 -125
vaspects  t3 -color GREEN -transparency 0.5

set NB 3
for {set i 0} {$i < $NB} {incr i} {
  for {set j 0} {$j < $NB} {incr j} {
    for {set k 0} {$k < $NB} {incr k} {
      psphere s$i$j$k 25.0
      ttranslate s$i$j$k 100.*$i 100.*$j -100.*$k
      vdisplay -dispMode 1 s$i$j$k
      vaspects s$i$j$k -color BLUE -transparency 0.5
    }
  }
}

# define camera animation
vcamera -persp
vaxo
vfit
vanim a/v1 -start  0.0 -end  5.0 -view -eye1  96 -515 -68 -eye2 -507   88 -68 -at1 96 88 -68 -at2 96 88 -68 -up1 0 0 1 -up2 0 0 1 -scale1 2 -scale2 2
vanim a/v2 -start  5.0 -end 10.0 -view -eye1 -507  88 -68 -eye2   96  691 -68 -at1 96 88 -68 -at2 96 88 -68 -up1 0 0 1 -up2 0 0 1 -scale1 2 -scale2 2
vanim a/v3 -start 10.0 -end 15.0 -view -eye1  96  691 -68 -eye2  699   88 -68 -at1 96 88 -68 -at2 96 88 -68 -up1 0 0 1 -up2 0 0 1 -scale1 2 -scale2 2
vanim a/v4 -start 15.0 -end 20.0 -view -eye1  699  88 -68 -eye2   96 -515 -68 -at1 96 88 -68 -at2 96 88 -68 -up1 0 0 1 -up2 0 0 1 -scale1 2 -scale2 2

vrenderparams -perfCounters fps
vrenderparams -oit peel 8
vanim a/v1 0.0 5.0
TagsNo tags attached.
Test case numberN/A

Activities

git

2021-12-07 20:07

administrator   ~0105727

Branch CR32723 has been created by kgv.

SHA-1: 5e89d4fa28b03f6d146740971b745b054d00e576


Detailed log of new commits:

Author: kgv
Date: Tue Dec 7 20:07:04 2021 +0300

    0032723: Draw Harness, ViewerTest - sloppy animation in WebGL
    
    Fixed emscripten_async_call() calls to use requestAnimationFrame() instead of setTimeout().

git

2021-12-07 20:47

administrator   ~0105729

Branch CR32723 has been updated forcibly by kgv.

SHA-1: ccc420dc56ff6740e20587b811c95e731e50b541

git

2021-12-07 23:38

administrator   ~0105734

Branch CR32723 has been updated forcibly by kgv.

SHA-1: 40d8ed0561870cf1f488d125adfdc542dc315cdb

kgv

2021-12-08 01:00

developer   ~0105735

Patch is ready for review
- OCCT: branch CR32723.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32723-master-KGV/

osa

2021-12-09 10:00

developer   ~0105761

The patch was reviewed

smoskvin

2021-12-11 11:35

administrator   ~0105811

Combination -
OCCT branch : IR-2021-12-10
master SHA - e463b2f685d8c815f8a7ab996c6843808e8b1430
49e51745631c52b6c452c65adae4d6dfa21a1b1e
Products branch : IR-2021-12-10 SHA - 6377a4e004f3c988c651adf5eca35203f239b1c2
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18222.380000000427 / 18166.60000000042 [+0.31%]
Products
Total CPU difference: 11645.100000000084 / 11658.820000000103 [-0.12%]
Windows-64-VC14:
OCCT
Total CPU difference: 19999.4375 / 19937.953125 [+0.31%]
Products
Total CPU difference: 13044.453125 / 13069.28125 [-0.19%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2021-12-11 15:26

administrator   ~0105827

Branch CR32723 has been deleted by mnt.

SHA-1: 40d8ed0561870cf1f488d125adfdc542dc315cdb

Related Changesets

occt: master e3dae4a9

2021-12-07 17:07:04

kgv


Committer: smoskvin Details Diff
0032723: Draw Harness, ViewerTest - sloppy animation in WebGL

Fixed emscripten_async_call() calls to use requestAnimationFrame() instead of setTimeout().
ViewerTest_EventManager::handleViewRedraw() - fixed queuing new onWasmRedrawView()
before previous one has been processed (leading to multiplying of pending redraws executed at the same time).
RWGltf_TriangulationReader::readDracoBuffer - suppressed CLang compilation warnings.
Affected Issues
0032723
mod - samples/webgl/WasmOcctView.cpp Diff File
mod - samples/webgl/WasmOcctView.h Diff File
mod - src/RWGltf/RWGltf_TriangulationReader.cxx Diff File
mod - src/Standard/Standard_WarningsDisable.hxx Diff File
mod - src/ViewerTest/ViewerTest_EventManager.cxx Diff File
mod - src/ViewerTest/ViewerTest_EventManager.hxx Diff File

Issue History

Date Modified Username Field Change
2021-12-07 20:01 kgv New Issue
2021-12-07 20:01 kgv Assigned To => kgv
2021-12-07 20:02 kgv Test case number => N/A
2021-12-07 20:02 kgv Steps to Reproduce Updated
2021-12-07 20:07 git Note Added: 0105727
2021-12-07 20:47 git Note Added: 0105729
2021-12-07 21:01 kgv Product Version 7.6.0 => 7.5.0
2021-12-07 23:38 git Note Added: 0105734
2021-12-07 23:48 kgv Description Updated
2021-12-08 01:00 kgv Note Added: 0105735
2021-12-08 01:00 kgv Assigned To kgv => osa
2021-12-08 01:00 kgv Status new => resolved
2021-12-09 10:00 osa Note Added: 0105761
2021-12-09 10:00 osa Assigned To osa => bugmaster
2021-12-09 10:00 osa Status resolved => reviewed
2021-12-11 11:35 smoskvin Note Added: 0105811
2021-12-11 11:35 smoskvin Status reviewed => tested
2021-12-11 15:14 smoskvin Changeset attached => occt master e3dae4a9
2021-12-11 15:14 smoskvin Assigned To bugmaster => smoskvin
2021-12-11 15:14 smoskvin Status tested => verified
2021-12-11 15:14 smoskvin Resolution open => fixed
2021-12-11 15:26 git Note Added: 0105827