simularium / simularium-viewer

NPM package to view Simularium trajectories in 3D
Apache License 2.0
2 stars 0 forks source link

Fix/ao with zoom #315

Closed toloudis closed 1 year ago

toloudis commented 1 year ago

Problem

Resolves #303 Ambient Occlusion had poor behavior when zooming in close.
This may address #306 too.

Because AO is a screen space algorithm here, we are not going to get a perfect result in all cases. The things that affect the result are generally the range of very small geometries vs very large ones, and overall scene size (size of distance values). A scene with a very large bounding box and lots of very small geometries can look different than a scene with a small bounding box and just a few objects filling it.

Solution

I chose to replace the AO algorithm completely. The new one uses fewer samples, has more customizable parameters, and has a smoother result. The quality is good enough to use with one single render pass as opposed to two, which we were using before.

The AO result is not identical to the previous. Some care should be taken to verify. I tried to use settings and variables to scale with scene size and distance such that it is reasonably close to our previous production trajectories.

Type of change

Screenshots (optional):

The screen shots were not taken at identical viewer sizes so in some cases the number of pixels may also affect the differences.

Before: Simularium πŸ”Š 2023-05-25 15-09-32 After Simularium viewer πŸ”Š 2023-05-25 15-09-56

Before: Simularium πŸ”Š 2023-05-25 15-06-12 After: Simularium viewer πŸ”Š 2023-05-25 15-08-24

Before: Simularium πŸ”Š 2023-05-25 15-05-29 After: Simularium viewer πŸ”Š 2023-05-25 15-08-55

github-actions[bot] commented 1 year ago

jest coverage report πŸ§ͺ

Total coverage

Status Category Percentage Covered / Total
πŸ”΄ Statements 40.27% 1951/4844
πŸ”΄ Branches 43.78% 814/1859
πŸ”΄ Functions 37.1% 400/1078
πŸ”΄ Lines 40.54% 1869/4610

Status of coverage: 🟒 - ok, 🟑 - slightly more than threshold, πŸ”΄ - under the threshold

Show files with reduced coverage πŸ”» ### Reduced coverage | Status | Filename | Statements | Branches | Functions | Lines | | :----: | :------------------------ | :------------------ | :------------------ | :---------------- | :------------------ | | πŸ”΄ | index.ts | 7.52% | 7.31% | 5.46% | 7.5% | | πŸ”΄ | src/visGeometry | 20.06% | 21.81% | 25.69% | 20.05% | | πŸ”΄ | src/visGeometry/rendering | 41.13% | 65.59% | 31.86% | 41.75% | | πŸ”΄ | GaussianBlur.ts | 34.28% (-13.72% πŸ”») | 68.18% (-15.15% πŸ”») | 22.22% (-1.3% πŸ”») | 35.38% (-13.55% πŸ”») | > Status of coverage: 🟒 - ok, 🟑 - slightly more than threshold, πŸ”΄ - under the threshold