Any way to modify Texture3d using fragment shader?

I want to make tile fluid simulation in 3d. My idea is to make something like 3d texture where tile fluid level parameters and tile emptiness are coded in pixel.
So i will pass it in shader and process it to next fluid state of the map.
I wanted to use compute shader to process and store fluid texture in gpu to draw it directly from there, but i get some odd error with compute fork. It say my target is net6, but mgcb-compute supports only net6 when i try to install it from nuget…

Edit.1. My world and fluid texture size might be 512x512x128 tiles

There isn’t way how to efficiently do it without Compute fork, you can do it from Pixel shader however you need Geometry Shader (in SM 5.0) to route to individual slices, which again, is available only in Compute fork.

Any ideas how to solve my odd error with compute fork?

Nope, was fairly painless for me, tho I did build from source

I do basically this in Exipelago using a regular shader to manipulate texture data … but I use a slightly modified MG version to be able to use a SurfaceFormat better fitting to my needs.

You basically supply a texture as input and another as rendertarget, process a fullscreen quad, done. next frame you switch the output of the last as the input of the next and so on.

In my case this is beneficial, because all the data for rendering is already on the GPU … be aware tho, to access this data on CPU, you’d have to read it from the GPU and that is a huge bottleneck. My personal bottleneck is DataSize tho, as I simulate several things that way and squeeze a lot of information into the texture as possible (even bitfields).I don’t create geometry there, the geometry is supplied as a fixed grid, which is getting transformed in the respective shader for different things which access the simulation texture for its respective grid field.

PS: I am using a TextureArray not Texture3D but maybe its the same.

Yes, i thought about supplying layer by layer to the shader but i need to have access not only to current layer but also layers above and below.
What the modification of mgcb do you use?
What kind of computation do you perform using shaders in your game?

I do several kinds of cellular automata (where you can never update a neighbour field directly, because you cant do it that way in regular shader) - as I use TextureArrays I can just sample all neighbours in any direction if it’s needed - but I also do a 2 pass approach to first do all the vertical stuff and all horizontal stuff afterwards for each layer in the game (as the game is layered anyway)

The shaders for all other stuff basically access the same data structures to find information about water, light, several growth stats, discovery state and so on. It still has its downsides the way I do it, mainly in terms of data size limitations/PCis bandwidth limitations - I try hard to pack everything into a 32bit texture format