Skip to content
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

Issue with sparse_voxels Z-buffer #379

Open
CoenHordijk opened this issue Oct 3, 2022 · 8 comments
Open

Issue with sparse_voxels Z-buffer #379

CoenHordijk opened this issue Oct 3, 2022 · 8 comments

Comments

@CoenHordijk
Copy link

CoenHordijk commented Oct 3, 2022

  • K3D version:
    2.14.5

  • Python version:
    Python 3.95

  • Operating System:
    Windows

  • Using WebGL / GPU accelarated view

Description

Z buffering seems to fail on some near cubes in this sample.

What I Did

`
import k3d
import numpy as np
N = 111220

sparse_voxels = np.random.randint(0, 1115, size=(N, 4), dtype=np.uint16)
sparse_voxels[:, 3] = np.random.randint(1, 5, size=(N,))

plot = k3d.plot(grid_visible = False)
obj = k3d.sparse_voxels(sparse_voxels, [300, 300, 300], compression_level=1, outlines=False)
plot += obj
plot.display()
`

somecubesk3d

@artur-trzesiok artur-trzesiok self-assigned this Dec 16, 2022
@artur-trzesiok
Copy link
Collaborator

That is very strange results. I cannot replicate that on my computer. Can you share (even on private channel: [email protected]) information about your GPU card? It is visible in developer console in browser:
image

@artur-trzesiok
Copy link
Collaborator

artur-trzesiok commented Dec 16, 2022

@CoenHordijk can you confirm that opacity of object is 1? It looks kind of "Order-independent transparency" issue. Please also share information about depth bits (it is also in developer console - on my screenshost i put bottom segment from rectangle on it)

@CoenHordijk
Copy link
Author

import k3d import numpy as np N = 111220

sparse_voxels = np.random.randint(0, 1115, size=(N, 4), dtype=np.uint16) sparse_voxels[:, 3] = np.random.randint(1, 5, size=(N,))

plot = k3d.plot(grid_visible = False) obj = k3d.sparse_voxels(sparse_voxels, [300, 300, 300], compression_level=1, outlines=False) plot += obj plot.display()

That is very strange results. I cannot replicate that on my computer. Can you share (even on private channel: [email protected]) information about your GPU card? It is visible in developer console in browser: image

Here it is:
image

@CoenHordijk
Copy link
Author

@CoenHordijk can you confirm that opacity of object is 1? It looks kind of "Order-independent transparency" issue. Please also share information about depth bits (it is also in developer console - on my screenshost i put bottom segment from rectangle on it)

It seems this only occurs with opacity less than 1 (0.955 does generate this artifact).
Because the k3d panel is now freezing in Chrome, I wasn't able to replay the issue in this browser.
So I took the MS Edge browser and succesfully replayed the issue here, with opacity = 0.955 and with the following console output:

image

@CoenHordijk
Copy link
Author

I was able to replay the issue in Chrome as well now:

image

@artur-trzesiok
Copy link
Collaborator

@CoenHordijk do you confirm that it happen with opacity <1 but it is ok with opacity = 1?

@CoenHordijk
Copy link
Author

opacity = 1 is fine indeed

@artur-trzesiok
Copy link
Collaborator

Thanks @CoenHordijk !

So it is problem with https://en.wikipedia.org/wiki/Order-independent_transparency . It is not easy problem in computer graphics. Three.js that k3d depends on have no support to that.

There are some techniques to solve that like depth peels. I have that feature in beta stage. But even when we will release it it won't be enable by default because add extra overhead to rendering. So that will be decision of user to add:

plot.depth_peels = 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants