I have created a rendering target in runtime, that I can paint on using textures, and I wanted to save it to disk as a PNG.
I used the “export render target” and saved it as a png. At first the png could not be read, then I used the formatting RGBA8, and then the PNG could be read, however anything I drew ontop of the canvas turns white. Now my theory is that it has to do with the fact that Textures are HDR/ Use a larger range than RGBA8 so it paints white instead, so I wondering for a way to export it as a png, either by lowering the range in the Texture, or a completely different method to draw on the render target, or saving as png
Now I have gotten it to work as a HDR, but that uses a higher range format then png (LDR) supports, and I would really want it in png format
My guess is: you will have to clear the render target to be black. DrawMaterialToRenderTarget usually stacks the old picture on top of the new one, I just presume this is the same here.
that… is weird. What happens when you clear it as blue, and then paint yellow on it? Does it export as entirely white then? If the blue is darker than the red it might export in greyscale. (I don’t know why it would though)
Odd. You could try drawing the texture you want saved to a separate render target before exporting, then export this export-dedicated render target. Displaying that when you save you can also double-check whether something is wrong with it before exporting.
I am uncertain what you want me to try out. Taking a copy of render target before exporting it?
Both the render texture and exporting happens during runtime.
I mean creating a 2DRenderTarget in the content browser. When saving, draw the material to it and export both. Then you can check if they both export the wrong texture.