#Texture2D from portion of atlas

1 messages · Page 1 of 1 (latest)

final spindle
#

I have a shader that takes a mask texture as a uniform, however the mask texture currently lives inside of my atlas.

Is there a way to create a new Texture2D from my texture atlas that refers to the mask portion (so I can keep everything in one big atlas.png file), or do I need to separate the mask texture from the texture atlas so I can load in the mask as a different Texture2D (creating mask.png and atlas.png files)?

sinful pasture
#

you can use a RenderTexture

#

or stitch together the images with the Image* functions and then call LoadTextureFromImage

#

maybe copy the image, crop it, then upload ?

upbeat heath
#

provide the mask offset UVs to the shader as a uniform

#

then have it sample that

#

just add the offset to passed in UVs

#

no need to copy anything