RWStructured Buffer to Texture

has anyone a starting point for the following problem ?

i have a RWStructuredbuffer rendering my custom particle datatype consisting of pos, vel etc. and i want to save the Pos to a texture. could this be done with a texture fx shader ? but how do i iterate through a buffer with a texture fx ?

solved my problem with readback but it would be interesting anyway if there is a way to convert a positionbuffer to a texture.

Hi, this is really isn’t that hard:
So position buffer is basically a 1d spread, and position texture is a 2d spread.
In tfx we have SV_Position, and UV. SV_Position would give us a pixel coordinate…
So we can do something like:
flaot2 x = SV_Position; (this line is pseudo code)
float4 col;
col.rgb = sbPos [x.x + x.y * widthInPixels] //(R:TARGETSIZE int width = R.x)
col.a = 1;
return col;

Also you need use default size pin On, and specify Width and Height, and Output format R32G32B32A32_Float

1 Like

cheers man, just talked to vux and he recommended to do it the readback way. so all is good. just for the record, a screenshot

here you go your example… (38.2 KB)

1 Like

i didnt know DefaultSize and float2 R:TARGETSIZE;
cheers man

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.