nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
661 stars 167 forks source link

Holes in molecular surfaces #180

Open arose opened 8 years ago

arose commented 8 years ago

on (especially low resolution) molecular surfaces there are sometimes holes and stray triangles.

screenshot 10

fredludlow commented 8 years ago

So this is probably it's own issue, but I'll post it here: I'm a big fan of the AstexViewer surface generation (I'm biased as I work at Astex so it's what I'm used to but anyway ;) ).

I asked Mike Hartshorn (the original author) and it uses his own method for generating the grid that gets fed to marching cubes - the grid values are distances to the surface which I think means you don't need to do any post-smoothing. There's also an option to do 2D face contouring rather than triangulation of the cubes when rendering in wire mesh mode so the meshes it generates are much sparser (they're a mixture of quads and triangles). I was hoping to have a go at porting the method to JS if I get time. I can send you relevant Java source if it sounds interesting? (sure you'd do a better job of porting/adapting, though obv this might not be the route you want to take).

arose commented 8 years ago

I can send you relevant Java source if it sounds interesting?

Sure! It sounds all cool. How is that licensed?

So far I was thinking about the grid-based algorithm from Chimera described here.

To get meshes with less triangles than with marching cubes I want to look at surface nets, see http://mikolalysenko.github.io/Isosurface/

It will probably two month before I start working on that, still planing and happy about any suggestions and contributions.

fredludlow commented 8 years ago

I've sent you an email with link to the AV code. (a bit reluctant to post it here in case I've done something stupid like including the whole local git repo!).

mkhorton commented 7 years ago

FYI, I'm not sure what version of marching cubes you're using in NGL, but there's an updated version of the algorithm that helps guarantee topological correctness: Efficient Implementation of Marching Cubes' Cases with Topological Guarantees (this is the version used by scikit-image).

That said, I don't know if that's the issue here, or if it's just missing data due to the low resolution, so apologies if this is besides the point!

arose commented 7 years ago

Thanks @mkhorton nice paper and very nice to have an implementation to look at as well :)