# Getting data from GPU

**URL:** https://discourse.threejs.org/t/getting-data-from-gpu/91080
**Category:** Questions
**Tags:** webgpu, bufferattributes
**Created:** [April 19, 2026, 2:15pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080 "2026-04-19T14:15:10Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [April 19, 2026, 2:15pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/1 "2026-04-19T14:15:10Z")

</div>

Greetings !

I am working on [Attractors extension](https://paulbourke.net/fractals/clifford/) to [Rebelle](https://www.escapemotions.com/products/rebelle/about) painting software based on this [canonical example](https://threejs.org/examples/?q=attrac#webgpu_tsl_compute_attractors_particles) but can’t fetch particles coordinates from GPU buffer.

At preset time I am stacked with a following attempt (finalData has 0 length):

```javascript
async function animate() {
  await renderer.compute( updateCompute );

  const storageAttribute = new THREE.StorageBufferAttribute(new Float32Array(count), 3);
  const resultBuffer = await renderer.getArrayBufferAsync(storageAttribute);
  const finalData = new Float32Array(resultBuffer);
  console.log(finalData);

  renderer.render( scene, camera );
}

```

Probably the reason explained by the following console message: “_WebGPU is not available, running under WebGL2 backend_”, but getting positions from GPU buffer still a mystery.

Help me to solve this puzzle, please !

---

<div class="post-metadata">

### Author: ![Oserebameh](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/oserebameh/32/60456_2.png) [@Oserebameh](https://discourse.threejs.org/u/Oserebameh)
#### Post date: [April 19, 2026, 3:44pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/2 "2026-04-19T15:44:13Z")

</div>

```javascript
const storageAttribute = new THREE.StorageBufferAttribute(new Float32Array(count), 3);

```

Is “count” defined somewhere in scope where it can be accessed?

---

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [April 19, 2026, 6:33pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/3 "2026-04-19T18:33:28Z")

</div>

Thanks for reply, yes it defined globally and script works as expected, excluding data fetching to CPU space.

---

<div class="post-metadata">

### Author: ![Oserebameh](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/oserebameh/32/60456_2.png) [@Oserebameh](https://discourse.threejs.org/u/Oserebameh)
#### Post date: [April 19, 2026, 7:55pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/4 "2026-04-19T19:55:45Z")

</div>

Oh ok. One possible problem that I can think of is that the instance of the storage buffer does not persist because of the animation loop. So somehow on re-render, the data never actually gets created and finalData just returns 0.

Can you try confirming what `console.log(resultBuffer.byteLenght)` returns?

---

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [April 19, 2026, 8:32pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/5 "2026-04-19T20:32:07Z")

</div>

Thanks for attention to my problem.

`console.log(resultBuffer.byteLenght) returns` _undefined_

Also I found the following message (sorry for not to mentioning it earlier):

`WebGL: INVALID_OPERATION: getBufferSubData: no buffer`

---

<div class="post-metadata">

### Author: ![Oserebameh](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/oserebameh/32/60456_2.png) [@Oserebameh](https://discourse.threejs.org/u/Oserebameh)
#### Post date: [April 19, 2026, 8:50pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/6 "2026-04-19T20:50:15Z")

</div>

Yh, thanks for the extra detail there, that confirms my suspicion. Try defining `storageAttribute` before the animate function and let me know what the console.log says this time.

---

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [April 19, 2026, 9:27pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/7 "2026-04-19T21:27:22Z")

</div>

```javascript
const storageAttribute = new THREE.StorageBufferAttribute(new Float32Array(count), 3);

async function animate() {
  await renderer.compute( updateCompute );
  const resultBuffer = await renderer.getArrayBufferAsync(storageAttribute);
  console.log(resultBuffer.byteLenght)
  renderer.render( scene, camera );
}

```

Unfortunately result is the same: _undefined_.

---

<div class="post-metadata">

### Author: ![PavelBoytchev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/pavelboytchev/32/38639_2.png) [@PavelBoytchev](https://discourse.threejs.org/u/PavelBoytchev)
#### Post date: [April 19, 2026, 9:57pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/8 "2026-04-19T21:57:09Z")

</div>

> [@yesbird](#):
>
> `console.log(resultBuffer.byteLenght) returns` _undefined_

Try with `byteLength` instead of `byteLenght`

---

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [April 19, 2026, 10:07pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/9 "2026-04-19T22:07:05Z")

</div>

Ohh, sorry, silly me !  
Now it’s ‘0’.

---

<div class="post-metadata">

### Author: ![Oserebameh](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/oserebameh/32/60456_2.png) [@Oserebameh](https://discourse.threejs.org/u/Oserebameh)
#### Post date: [April 19, 2026, 10:27pm UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/10 "2026-04-19T22:27:55Z")

</div>

Lol, it happens.  
Can you please confirm that the value of count itself is not “0”? If all this is in place then I think a next debugging step is making sure storageAttribute is wrapped in a tsl storageNode and that node is what’s being passed. Something like:

```javascript
//above the animate function
const storageAttribute = new THREE.StorageBufferAttribute(new Float32Array(count), 3);

const storageNode = storage(storageAttribute, 'vec3', count);

//then inside the function
const resultBuffer = await renderer.getArrayBufferAsync(storageNode);

```

Then pass the storageNode to getArrayBufferAsync instead of the raw attribute. Ultimately, this seems to be a datatransfer problem and since returnBuffer is not returning an error, then we need to find every possible step of data transfer that might be missing. I write in vanilla wgsl so I’m switching between the docs here on tsl’s implementation

---

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [April 20, 2026, 10:28am UTC](https://discourse.threejs.org/t/getting-data-from-gpu/91080/12 "2026-04-20T10:28:41Z")

</div>

Thanks so much for support, but unfortunately this trick did not help also:

```javascript
count = 8192
resultBuffer.byteLength = 0

```

Here are the sources for the case if someone want to check it yourself:  
[attractors\_test.zip](https://discourse.threejs.org/uploads/short-url/osN9p5IRG3Y0nj2gGA2RBPNQ2HA.zip) (5.2 KB)

```javascript
npm i
npm run dev

```

I am completely stuck and even think about switching to more simple [implementations](https://yesbird.online/rebelle/attractors/), for example from this [source](https://www.dynamicmath.xyz/strange-attractors/).
