Open BinarySpike opened 5 years ago
Swapping particle x and y in the Vertex shader causes the particles to hang to the left hand size.
Looks like Particles[gl_VertexIndex].Position.y
is no good.
void main()
{
gl_Position = vec4(vec2(Particles[gl_VertexIndex].Position.y, Particles[gl_VertexIndex].Position.x) / vec2(ScreenWidth, ScreenHeight), 0, 1);
gl_Position.xy = 2 * (gl_Position.xy - vec2(0.5, 0.5));
fsin_color = Particles[gl_VertexIndex].Color;
}
Removed Velocity and Color from the ParticleInfo
and now it's a proper distribution.
Looks like Particles[index].Color.x
is being translated to Particles[index].Position.y
by the time it gets to the vertex shader.
This code at the end of of the Compute shader code causes everything to position, animate, and move correctly:
Particles[index].Position = newPos;
Particles[index].Velocity = newVel;
Particles[index].Color.x = pos.y;
The correct solution seems to be changing this call: https://github.com/mellinoe/veldrid-samples/blob/0ac284ddc8f62d8d75c8eae88cc1824c320b1caf/src/ComputeParticles/Application/ComputeParticles.cs#L34-L38
BufferDescription.RawBuffer
must be set to true to be functionally equivalent to other backends (and correct in general).
I cloned the project and did a
dotnet run
in theComputeParticles/Desktop
folder and all the particles are at the bottom of the screen.This is on Windows 10