I want to simulate some particles, and display them as pixels, so i can do the calculations with a shader, and no data needs to be sent back to the cpu-side.
I am doing the following steps:
-There is a positions-texture that holds the uv coordinate of where the pixel should be displayed.
-There is a velocitys-texture which holds the velocitys of the particles.
1: calculate velocities, and render them in to the RT (rendertarget)
2: set the velocitys-texture (from RT)
3: add velocities to positions, render to RT.
4: set the positions-texture (from RT)
5: renderpass:get the uv coordinates from the positions-texture, and render the pixel at that location white.
Step 5 is a problem: if a pixel gets processed by the pixelshader, it has to draw a pixel somewhere else, which is not possible.
A solution would be using an array: step 4 would than also include something like:
ColorArray[PosU][PosV] = Color;
Step 5 would be:
return ColorArray[uv,x][uv.y];
But the maximum size of an array is 65536 (256 * 256), which is not big enough for me.
Can you think of a way to make this work, without a lot of data-traffic, and without rendering the particles with vertices (using vtf)?