-
Notifications
You must be signed in to change notification settings - Fork 42
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
Reading framebuffer data to pixel buffers #11
Comments
do you mean pulling the data back to the cpu using readPixels() and then putting it back into threejs that way? you can call getValues() or getValuesAsync() on a DataLayer object, which both call readPixels() internally and return the values in the framebuffer as a TypedArray: Though it's obviously less efficient to copy the data from the gpu->cpu->gpu, in practice I've found that you can still run realtime sims of a decent size with no problems. And the interface with threejs is a lot simpler! I'm actually using a similar strategy in this project: https://origamisimulator.org/ maybe you have something else in mind though, let me know if I'm not understanding the question. thanks for the nice comment, glad the library has been helpful! |
@amandaghassaei I was thinking just copying pixels directly gpu -> gpu... I just went ahead and implemented it in #13! |
Uh, by the way the origami simulator is 🤯 |
awesome, thanks for the PRs - so I guess the idea is to pass e.g. the position buffer of a threejs BufferGeometry into the I will have some time to take a closer look next week and hopefully merge in, thanks so much for the contribution! |
That's the idea, yup, though I have to say I haven't tried that part yet. As you can see in the tests the GPU -> GPU transfer is working and hopefully the connection with THREE.js WebGLBuffer backed objects will go smoothly. Setting vertex attributes seems like the a good simple test case for that. |
Wondering if anyone has tried reading data from gpu-io framebuffers to a pixel buffer, and if so how did it go?
I'm considering trying this. I think it could potentially simplify the process of using data computed with gpu-io as regular old uniform buffer/vertex buffer data, as an alternative to transform feedback, and to extra texture sampling. That said, I'm unsure about performance, so will need to experiment.
If it works it'd be cool to have a little API for it, especially if it could be used with THREE.js buffers in the same way as the textures can be shared.
(by the way, this library is awesome, I tried like 5 different WebGL GPGPU libraries before settling on this one and it's been working out great)
The text was updated successfully, but these errors were encountered: