-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opacity of overlapping structures #55
Comments
That's an inherent problem of the way opacity is implemented. When a transparent triangle gets rendered before something that is behind it, the triangle behind does not get rendered, because it fails the Z-test. To solve this with the current method, all the triangles would have to be sorted by projected Z-coordinates and that's relatively expensive in JavaScript. Another option is to implement per-object opacity as a post-processing pass. I've added a small fix for the case where an the objects is completely transparent. That doesn't solve the visual artifacts when multiple objects are semi-transparent. To somewhat lessen the problems, we could order the objects such that the most opaque gets rendered first. When setting the opacity you could do the following(untested): var alpha = 0.5;
obj.setOpacity(alpha);
obj.order(10 - alpha * 10);
viewer._objects.sort(function(lhs, rhs) {
return lhs.order() - rhs.order();
}); |
Thanks, that works well, and is better than the binary on/off switch we were using. I notice that if option outline is true, then for 0 opacity, the object is drawn black. If outline is false, then the object is not visible at opacity 0 as expected. |
This makes sure the outline fades out together with the rest of the structure. Without this patch, the structure is rendered in outline color (see #55).
Hi Marco,
I was playing with the new opacity settings, they will be really useful indeed. However I find that if I set the opacity of an overlapping structure to 0, the structures which lie behind the now transparent object are not visible
The text was updated successfully, but these errors were encountered: