K3D-jupyter icon indicating copy to clipboard operation
K3D-jupyter copied to clipboard

non-physical alpha blending in scatter plot

Open bjudkewitz opened this issue 2 years ago • 1 comments

When I create a 3d scatter plot of points with alpha<1 (can be 0.99), there are perspectives from which background points are shown in front of foreground points (see screenshot, generated with code below; note that all spheres have the same size, so the larger one should be in the foreground). Switching to alpha = 1 fixes the problem, but that prevents me from using alpha.

Screenshot 2022-09-06 at 17 34 19
import k3d
import numpy as np
coords0 = np.random.randn(20,3)
plot = k3d.plot()
plot.background_color = 0
plot.grid_visible=False
points = k3d.points(positions=coords0,point_size=1, shader='3d', color_range=[0, 1]) 
points.opacity = 0.99
plot += points
plot.display()

python and js version: 2.14.5 Client: mac firefox Server: ubuntu linux

bjudkewitz avatar Sep 06 '22 15:09 bjudkewitz

Hi!

It's well know limitations in 3d graphics called "order independent transparency". There is couple techniques to solved it. I have it already in k3dpro version (non open-source one) and it seems to be stable. I used depth peels method.

Thanks for that issue. Please obseve tasks with label "order independent transparency" here.

artur-trzesiok avatar Dec 16 '22 17:12 artur-trzesiok