Giter Site home page Giter Site logo

Opacity of overlapping structures about pv HOT 2 CLOSED

biasmv avatar biasmv commented on July 30, 2024
Opacity of overlapping structures

from pv.

Comments (2)

biasmv avatar biasmv commented on July 30, 2024

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(); 
});

from pv.

mizuchi3 avatar mizuchi3 commented on July 30, 2024

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.

from pv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.