- Home /
create a building with the same texture
Alright, so I am trying to build a building that has walls of different lengths and heights. However, I would like all of these walls to have the same texture on all of them. But, when I apply the texture it stretches the texture and the texture does not get tiled. To solve this, I have adjusted the tiling in the texture inspector. But now for each new wall shape, I have to create a new material to get the tiling done right.
I know this is intensive on the processor and my goal is to publish my game to the iphone. How would I get the texture to automatically tile itself on any surface? (I do have the wrap mode set to repeat).
In addition, for the building I am making, I am using the primitive cube meshes and colliders scaled to the size I want them to make the walls. At some points in my game there are about 120 draw calls and 11k vertices. Would it be better to use a plane for each individual wall instead of a cube?
Thanks a lot for any help.
Answer by DaveA · Jan 15, 2011 at 05:59 PM
You may need to resort to modelling these and setting UV maps for each. That said, you could calculate UV's for each with a script. You'd divide the size of the wall by the size of the texture to determine number of tiles (with some scaling factor probably) (I've done this in VRML/X3D but not Unity, yet).
If you are tiling cubes to make a wall, you'd have 'interior' and 'exterior' walls from that. It would have the same texture on both sides. Well, all 6 sides, and probably 4 of those would not be seen (facing the ground, sky, other walls). So, yeah, you might want to model each wall differently. But to cut down on draw calls, combine meshes which share the same material (google for that script, I think it's on the script wiki).
Thanks! How much of a benefit would be gained from using one texture, but different UV maps? The main reason I would do this would be to save myself the hassle of finding out the tiling on all the objects.
Where would I find the UV mapping script?
Thanks again, Jeremy
One texture is fine, you'd save on texture memory. You'd probably have to write that script yourself, or google around, or visit the collaboration forum etc.