Hello.
I am trying to wrap my head around a solution to fit my needs.
I am making a fixed camera angle pseudo 2d game using 3d space with a to use built in physics and make things overall more intuitive to design for (thing Enter the Gungeon).
This tile grid solution creates 3d ‘blocks’ consisting of a box collider and 2 quads. What I’d like to do it use as few materials and shaders as possible to assist with performance.
Each texture is a 64x64 image currently part of a larger texture of 1024x1024.
I have been reading up on Atlases and TextureArrays but as far as I can tell you cannot offset uvs on a per object level without all objects using that same material also changing and creating a material for each tile would also cause a lot of render passes.
Also floated the idea of an editor tool to combine all/a subset of objects textures into a combined texture+material but I don’t want to commit to experimenting with this if there is a built in/better way.
Any advice in how to go about this is an performance optimal way would be greatly appreciated!
Yes you can. All materials have offset and scale parameters for the texture coordinates, precisely for use cases similar to yours. You can have lots of objects with the same material and shader, then give a specific offset/scale to each one (either using MaterialPropertyBlocks if you’re in BiRP, or material instances if in URP) so that it grabs the correct part of the texture atlas.
Render passes are independent from the amount of materials you have, each object would still require a single pass. I think you’re confusing this with drawcalls, which is a different thing altogether.
Thank you for the reply!
I think material Instances is what I was looking for. Hard to find things if you don’t know the name for it!
I will look into it and hopefully it meets what I need.
Thank you!