molstar / molstar

A comprehensive macromolecular library
https://molstar.org
MIT License
654 stars 148 forks source link

Isosurface Representation Quality #160

Closed iimry closed 3 years ago

iimry commented 3 years ago

Hey,

For isosurface representations, when I am changing the quality levels, I am not noticing much change in the actual representation. Between the highest and lowest quality, it seems that the only change is possibly lighting or a slight smoothing (see the screenshots). The first is using lowest quality and the second screenshot is using highest quality.

With NGL, I was able to use the smooth property to make the volume more rounded and without the sharp angles seen. Is there something similar in Molstar?

Screen Shot 2021-04-12 at 1 10 24 PM Screen Shot 2021-04-12 at 1 09 55 PM
stefdoerr commented 3 years ago

In NGL the volumes especially when transparent seemed much smoother while with molstar you get quite noisy images. Take a look for example directly under the orange volume image image

Zoom in NGL image Zoom in MolStar image

stefdoerr commented 3 years ago

I am actually not sure it's so much a matter of smoothing. I think it might be a question of probe radius used to calculate the surfaces because it looks to me like there are bubbles created inside the volume in the molstar version.

dsehnal commented 3 years ago

@iainmaryanow

This is weird, trying gaussian surface for ligand in 4KTC:

Lower quality:

image

High quality:

image

Can you please share the data/code you are using for this?


@stefdoerr This seems like a difference between Gaussian and Molecular Surface:

Gaussian: image

Molecular Surface: image

dsehnal commented 3 years ago

@stefdoerr For the weird coloring: this could be a GFX driver issue. In Mol* 2.0 as gaussian surfaces are computed by default on GPU. If you use tryUseGpu: false does the error persist?

arose commented 3 years ago

The black/grey dots are artifacts from the AO. You can get rid of them by increasing the number of samples and blurring (at the expense of speed).

David is right re the surface interior. The Gaussian Surface interior is always "noisy". You can get id of that by using the "extraRadius" property - with obvious sideffect of making the surface larger. The Molecular Surface does not have this issue.

The smoothing pass for meshes is not supported in Mol*. I think you are the first to ask for it. There is commented out code waiting to be ported (https://github.com/molstar/molstar/blob/master/src/mol-geo/geometry/mesh/laplacian-smoothing.ts). @stefdoerr and @iainmaryanow would you be interested in proting it so it can be used for the isosurface representation (add here https://github.com/molstar/molstar/blob/master/src/mol-repr/volume/isosurface.ts#L85)? One caveat is that this would have no effect for the GPU isosurface extraction with MC. We would need to find a lapalcian smooth that can be implemented on the GPU with WebGL.

stefdoerr commented 3 years ago

Great! Thanks for the molecularsurface tip, I was not aware. Apparently Iain chose Gaussian because it was faster and we had performance issues but for static structures I believe we should be fine. As for the AO yes we turned it down a lot, I am aware of the dots but it's better to be fast in our case.

Generally since we mentioned performance molstar seems to me a bit sluggish compared to NGL on my computer. I have yet to pinpoint the exact issue with it but if I open side by side NGL and molstar the difference is drastic. I am not sure if we are using maybe some unoptimized version or we need to tune down some settings. For example hovering the mouse over a surface overloads my viewer, the mouse is stuttering just moving over the view. Iain does not seem to have the same issues though.

This is for sure partially related to my laptop suffering a bit at rendering on the ultra-wide display I have attached (I also have issues if I full-screen youtube) but the performance difference can be seen clearly when opening them side by side. I was wondering if there is some sort of benchmark for performance in molstar.

I made a video here showing the performance difference: NGL is on the right side. Look at the rotation speed in the two viewers and also at how the mouse gets stuck when it moves over the surface in the molstar viewer https://youtu.be/cwdz48gXF4g

dsehnal commented 3 years ago

@stefdoerr Does this still happen if you turn SSAO off? I think that is the likely culprit since you are running on slow GPU

canvas3d: {
        postprocessing: {
            // occlusion causes perf issues on older Intel cards
            occlusion: { name: 'off', params: {} },
        },
}

setting in the PluginSpec.

Another cause could be event forwarding if you are using WebComponents or Angular (seen that happen in the PDBe wrapper).


I do have a fast machine, but this this entity level highlighting on ~6M unique and ~63M instanced atoms:

https://user-images.githubusercontent.com/21145776/114429044-3679ac80-9bbd-11eb-9d93-f8010d48fb53.mp4

stefdoerr commented 3 years ago

Yes, don't worry about it for now since it seems like it mostly happens just on my machine and it's not even fully consistent, I sometimes have issues replicating it. I have a GeForce MX250 which seems to hit 100% usage when hovering (for both viewers). Anyway, thanks for the info! I will for sure also compare your own viewer because it might be related to our setup.