Porting GPGPU Curl-noise + DOF to newer r3f version #2400
Replies: 5 comments 7 replies
-
Here's a direct port with the old threejs version ( |
Beta Was this translation helpful? Give feedback.
-
ive updated mine as well, thanks @CodyJasonBennett! it works until three 135 and over that it fails. i think it might have to do with three kicking out RGBFormat or something like that. they might also have broken backward compat in webgl1renderer. it's one of the many changes here: https://github.com/mrdoob/three.js/releases/tag/r136 it's unfortunate. don't have the time to investigate though. |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for the quick reaction! Had a peek into the migration docs and found this Since I am instantiating a DataTexture (https://github.com/benjaminpreiss/gpgpu-curl-noise-dof-nextjs/blob/d8f2e9297806e6b2d5a2385d94bef7bb64b3ce7f/components/Particles/Particles.tsx#L71) I was wondering whether I have to somehow set needsUpdate? |
Beta Was this translation helpful? Give feedback.
-
@CodyJasonBennett Two further suggestions regarding your port https://codesandbox.io/s/gpgpu-curl-noise-dof-forked-tvtcfd :
Proposal for function getPoint(v:Vector4, size:number, data: Float32Array, offset: number): ArrayLike<number> {
v.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, 0)
if (v.length() > 1) return getPoint(v, size, data, offset)
return v.normalize().multiplyScalar(size).toArray(data, offset)
} |
Beta Was this translation helpful? Give feedback.
-
Managed to make it work! Have no explanation though, why it works now but didn't work before - If you have an idea about that I would be glad to learn :) Here is the commit that made it work: benjaminpreiss/gpgpu-curl-noise-dof-nextjs@321942f And for anyone having a look at this discussion - here is the working repo: https://github.com/benjaminpreiss/gpgpu-curl-noise-dof-nextjs |
Beta Was this translation helpful? Give feedback.
-
Dear community
I have been trying to reproduce the GPGPU Curl-noise + DOF (https://codesandbox.io/s/gpgpu-curl-noise-dof-zgsyn) example from the r3f webpage, but have been having problems with porting it to a newer r3f version.
When changing the codesandbox example to directly rendering the FBO I get the following result. Here is the forked codesandbox link(https://codesandbox.io/s/gpgpu-curl-noise-dof-forked-7r5t3k?file=/src/Particles.js)
But in my React 18 reproduction of the same thing I get the following result. Here is a repo for reproduction (https://github.com/benjaminpreiss/gpgpu-curl-noise-dof-nextjs)
Can anybody help me understand what I am doing wrong here?
Would greatly appreciate help!
Beta Was this translation helpful? Give feedback.
All reactions