RWStructuredBuffer <Particle> particles; [numthreads(thread_group_size_x, thread_group_size_y, thread_group_size_z )] void CSMain ( uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex ) { int index = DTid.x; //int index = DTid.x + DTid.y * thread_group_size_x * 32; if(app_mode == 0) //Platonics Mode { float3 velTemp = particles[index].velocity; float3 vZero; vZero.x = 0; vZero.y = 0; vZero.z = 0; if(attractor_Count == 1 || attractor_Count == 2 || attractor_Count == 3 ) { float3 att_0_Dir = normalize((att_0 - particles[index].position)); float att_0_dist = distance(att_0, particles[index].position); if(att_0_dist < zero_mirror_radius) { particles[index].position = att_0 + att_0_dist*att_0_Dir; } velTemp += targetStrength * att_0_Dir * deltaTime / att_0_dist; if(attractor_Count == 2 || attractor_Count == 3 ) { float3 att_1_Dir = normalize((att_1 - particles[index].position)); float att_1_dist = distance(att_1, particles[index].position); if(att_1_dist < zero_mirror_radius) { particles[index].position = att_1 + att_1_dist*att_1_Dir; } velTemp += targetStrength * att_1_Dir * deltaTime / att_1_dist; if(attractor_Count == 3 ) { float3 att_2_Dir = normalize((att_2 - particles[index].position)); float att_2_dist = distance(att_2, particles[index].position); if(att_2_dist < zero_mirror_radius) { particles[index].position = att_2 + att_2_dist*att_2_Dir; } velTemp += targetStrength * att_2_Dir * deltaTime / att_2_dist; } } //float dotVels = dot(normalize(velTemp), normalize(particles[index].velocity)); particles[index].velocity = velTemp; particles[index].position += particles[index].velocity * deltaTime; } else if(attractor_Count == 4 || attractor_Count == 6 || attractor_Count == 8 || attractor_Count == 12 || attractor_Count == 13 || attractor_Count == 20) { ,,, } } }