i want to copy pixels from a texture2D to a bigger texture/rendertexture, so the bigger texture would be the atlas, i want to copy the data onto an specific part of the bigger texture.
I know this can be done purely from the cpu side using setpixels32 and apply, but it has a huge bottleneck for more than 1k by 1k pixels so im trying to find another way.
I have seen that some people suggest using Unity - Scripting API: Graphics.CopyTexture but doesnt that requieres same size textures?
i was thinking something like;
Create small texture on cpu using setpixels and apply, then somehow copy the data to some bigger texture already in the gpu.
Hi!
As mentioned in your post here, you can Graphics.ConvertTexture for copying to a texture with a different size and format.
What might work here is to use something like a staging texture, so just a Texture2D which you fill using SetPixels or other API, do an Texture2D.Apply() to upload the data to the GPU and then do a CopyTexture (the region based overload) to copy that staging texture to a sub area of the target texture.
1 Like
hi, copytexture worked fine for me since i don’t have different formats, if i understand correctly that seems to be the difference between the two methods, and the cpu copy, altou, i don’t understand that part very well, thanks anyways.