# Gpgpu strange attractors

Hi!

Does anyone has an example reference on how to implements strange attractors with threejs, fbo and shaders?

I’ve a texture with particles position and another one with particle velocities.

How do I apply a strange attractor to the particle positions?

I’m trying some equations found here https://fusefactory.github.io/openfuse/strange attractors/particle system/Strange-Attractors-GPU/ but the results are totally different

2 Likes

Hi, essentially I’ve this in the simulation shader:

``````vec2 uv = gl_FragCoord.xy / resolution.xy;
vec3 position = texture2D(texturePosition, uv).xyz;

float x = position.x;
float y = position.y;
float z = position.z;

// Increments calculation
float dx = (a * (y - x))   * 0.05;
float dy = (x * (b-z) - y) * 0.05;
float dz = (x*y - c*z)     * 0.05;

// Add the new increments to the previous position
vec3 attractorForce = vec3(dx, dy, dz);

vec3 newPosition = position + attractorForce;
gl_FragColor = vec4(newPosition, 1.0);
``````

Where `texturePosition` is a data texture holding particles positions.

But what I get is this:

I saw in other examples the use of iterations to calculate attraction, which I’m not using.
And I’m not sure wether my particles initial position are right.

Again, a live demo will make it easier to debug your issue

Sure, give me some minutes to put it online.
thanks