forked from timdecode/UnrealComputeShaderExample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoid.usf
22 lines (17 loc) · 836 Bytes
/
Boid.usf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Since we can't #include private Engine shaders such as Common.ush we have to copy the needed Shaders from the Engine' Shader directory.
//When this gets chaned in the future, we could change this to #include "/Engine/Private/Common.ush".
#include "/Engine/Private/Common.ush"
//--------------------------------------------------------------------------------------
// Buffers
//--------------------------------------------------------------------------------------
RWStructuredBuffer<float3> positions; // Point Positions Input Buffer
RWStructuredBuffer<float> times;
[numthreads(256, 1, 1)]
void MainComputeShader(uint3 ThreadId : SV_DispatchThreadID)
{
int index = ThreadId.x;
float3 position = positions[index];
position.z += sin(times[index]);
times[index] += 0.016f;
positions[index] = position;
}