- Home /
Same material, different meshes, different tiling
I am developing a game for the mobile platform. My terrain is procedural and made of blocks (like the old 2D games) All the boxes will have the same texture but a different tiling, how do i achieve this? Can i use the same material? I am completely ignorant about how many times happens a draw call, how it works, and if the material has one instance or a copy for every mesh. Thx in andvance to everyone!
Answer by zeman97 · Dec 26, 2014 at 07:33 AM
The simplest way to handle this situation is to create multiple materials and set the tiling there. I am not a mobile developer so I do not know how costly this would be for a mobile device but I imagine it is cheaper memory wise than attempting anything in code.
Creating multiple materials is generally not a good idea if not strictly necessary, especially on mobiles :) Objects drawn with different materials can't be batched, so more materials = more drawcalls per frame.
Answer by tanoshimi · Dec 26, 2014 at 07:43 AM
How are your blocks created? In code? Imported from a modelling program? It sounds to me like you need only a single material containing a texture atlas, but to define the appropriate UV coordinates for each block so that pick the correct texture and tiling from that material.
Those blocks are generated by code.I have a texture 64x64 and I want it to be tiled differently for each block, because they have different proportions ( I have a very tall and thin block and square blocks and also wide and short blocks ) . each block is a different game object but I can manage to merge in one single big gameobject if its needed.
Your answer
Follow this Question
Related Questions
Assigning UV Map to model at runtime 0 Answers
How to make a texture tile and not stretch 5 Answers
Repeat texture instead of scaling 1 Answer
Texture tiling for any object? 2 Answers
Dynamic Texture Tiling 1 Answer