Hi all,
I need to use a texture atlas in order to pack all textures and be able to using a single shared material for several object in my scene.
Actually what I’m working on it’s a shader for procedural texturing of building facades.
I successfully create the atlas and passed it to the shader:
this.texturesAtlasDomains = this.atlas.PackTextures(orderedTextureList.ConvertToArray(), 0,ATLAS_WIDTH);
...
this.material.SetTexture("atlas", this.atlas);
That works fine. Now, in order to make my shader works under unity, the coordinate returned from PackTextures should be available inside the shader ( I need to sample the right tile in the fragment shader, for this reason I need the offset of tiles inside the atlas)
Is there anyway to do that? I’m thinking of packing them inside a Texture2D, but I’m having some troubles to make it work. It seems also that I can’t pass an array of float to a shader through a shader lab property, right?
Does anyone has ever done something similar? Can anyone put me in the right direction?
thanks in advance