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

Output 1D Unknown-Length Array from 2D Known-Length Array #805

Open
c4b4d4 opened this issue Dec 28, 2022 · 3 comments
Open

Output 1D Unknown-Length Array from 2D Known-Length Array #805

c4b4d4 opened this issue Dec 28, 2022 · 3 comments

Comments

@c4b4d4
Copy link

c4b4d4 commented Dec 28, 2022

I'm trying to generate an unknown-length array, from an input image or 2D array.

I want to distribute data using a noise image, for example:

For every white pixel -> Save the position of it (x, y) and push it to an array so you end up having a Z-length array. Where Z is the number of white pixels in the noise image.

Input

Screenshot 2022-12-28 at 17 08 45

Output

[[x1, y1], [x2, y2], .... [xZ, yZ]]

In result I get all the locations of where a pixel is white.

I need to use GPU power, since noise images are huge in my use case and must be updated at least at 24 fps.

Doing math

@ObliviousDonkey
Copy link

This is not possible using gpu.js D:

@c4b4d4
Copy link
Author

c4b4d4 commented Jan 1, 2023 via email

@TrashUwU
Copy link

TrashUwU commented Jan 1, 2023

I guess the library is missing the feature.

https://github.com/gpujs/gpu.js/#types
The kernel can only return few amount of types, the length of returned array cannot be more than 3.

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

No branches or pull requests

3 participants