Download

How do I export a material to an image file?

I’m trying to figure out if its possible to do GPU side compute using shader code and grab the final pixel values and export them to disk as an image.

Let’s say you have some sort of trivial shader code which generates a procedural texture. For the sake of illustration, you could just feed in a texture parameter into your material node base color. Next, we have a known image dimension we want to export, such as 512x512. We can derive the UV values easily enough for each pixel in the image. But how do we get the computed values from the material (presumably on the GPU) into main memory (on the CPU side) so that we can write those pixels to disk? I’m a bit stuck on how to build this bridge.