Lately I’ve been re-thinking the way that I create terrain/scenery in a little game that I’ve been working on, and since I’ve never been good when it comes to the artsy side of development, I decided that using a full tile set would be a lot easier for me to work with. On the plus side, the assets in my game would feel more connected to each other, as they were all created by the same person, and not random textures found on Google from various sources.
In order to best optimize my game, I’d like to know some theory on what might be a good way to implement something like this.
I currently have an 8192x8192 PNG image that contains smaller images with dimensions of 256x256 laid out in a “grid” within. Thus, there are 16 rows and 16 columns in my large texture image. That’s what I’m working with.
The game world that I’m building is going to consist of 1x1x1 cubes, which should make things simple. I’d like to be able to create cubes at run-time as well, so I need to keep that in mind when determining the way to do this.
Since the smaller images are evenly placed out within the larger one, I am thinking that the way to do this would be to use just a single material with the Tiling/Offset properties set to only cover the region for the tile that I’m selecting.
For example, if my rock texture is at position [x,y] within my large image, then the tiling would grab [.0625 * x, .0625 * y], since .0625 is (1/16).
Is it possible to a single material that is in use on multiple objects with different Tiling/Offsets? It seems that within the Unity Editor I am unable to figure out a way to do this without using a separate material for each tile in the grid.
If this is possible, does that mean that just a single draw call would be able to display all of the objects in my game world even if they are displaying different tiles within the texture?
I know I asked a lot of things. I’m just looking to learn all I can from anyone willing to share their knowledge. Anything you can contribute to this topic would be appreciated, but if I had to limit it, I would mainly be interested in learning about the asset structure for this type of thing (i.e. one material, many materials, etc) as well as the number of draw calls for this type of things despite all of the tiles being within the same texture.