Texturing / UV Advice needed...

I’m a programmer by trade and hobby and have been learning Unity after a transition from XNA. I have some experience with 3DS Max in the past but as I don’t personally own a copy I’ve been learning Blender. I can create my models (nothing super fancy). I also know how to UV Unwrap, texture paint, etc.

So, I can texture a model and I can put it in Unity and everything is fine… but I’m looking for ways to optimize so here is my scenario:

Let’s say I want to model the interior of a castle. I’ll be modeling sections separately and can model the floors and ceilings separate from the walls, but I will be doing it all in Blender. So I want to use a Stone texture on the walls, but I don’t want to create a new UV Map for every room with the entire walls painted. Instead, I would like to be able to use a tileable texture and tile it across the walls (same with the floor and ceiling). What’s the best way to go about using tiled textures on these models and how would I setup the UVs for these?

So I’ve been trying to work on a workflow like this for awhile as well. And if anyone has any greater insight please share.

I would go about doing it like this:

Create the walls in sections and allow for natural breaks. Ideal example would stone pillars or wooden beams that you would naturally find in a structure. This way your wall could literally be 1 quad for the stone texture. And then you wouldn’t need to tile it.

Tiling in a texture atlas is hard. I’ve attempted to find some easy solutions but I’ve come up empty handed. That being said you could tile it by hand. Make your wall a nice squared plane and then uv map every quad to the tileable texture in your atlas. This leaves a lot of room for human error but on the plus side, you might find that it adds a little variety that will give it a nice touch.

As I’m sitting here thinking about it I am thinking of another method as well. This is only a theory as I haven’t tried it yet and it would take a little bit of planning and thought before you start. If you made smaller textures as individual pieces instead of an atlas to begin with. You could go about uv mapping and texturing your surfaces and tiling as you go. Blender has a plugin that automatically generates a texture atlas, you will have to enable this in your plugin preferences.

My thought is that if you make the texture atlas after you’ve textured everything with smaller individual textures, you might come out with one large texture and a nicely uv mapped object.

When I get the chance I will see if I can’t test it.

Thanks! What I was trying to avoid was creating extra geometry. I could break a single wall into multiple quads and then just lay them on top of eachother in the UV editor, but I thought it seemed silly to create extra wall geometry just to tile my texture. I know in 3DS Max for instance, when I create my UVs I can add my materials and adjust the tiling and positioning along the UVs within the material itself. I’m assuming I would probably need to do the same in Unity using a shader that tiles my textures for me.

Well one of the problems you face is the shape of each room. Lets look at two examples:

  1. A square room 10 x 10 blender units. You repeat your texture every 5 units - so two textures on each wall. Should look ok.

  2. A rectangular room 10 x 6 blender units. On two of the walls you can repeat your texture every 5 units (as above) - no problem. But if you use that same texture density on the 6 unit walls (ie one texture every 5 units) you will get at least two seams. If you change the texture density to 1 texture every 6 units for the short walls you can remove the seams but then the texture will be stretched. The visual impact of the stretching will depend somewhat on the nature of your stone texture. If you chose to use a texture density of one texture every 3 units - then you will get squashing of the texture.

So are your rooms all the same shape? My guess not. It would be nice to see an example layout of the rooms.

One little trick I use when working with textures in this manner is to create a new version of the seamless stone texture with a column a few pixels wide on the left side replaced with a just a plain red colour and on the right with a plain blue colour - so then when it tiles you should get a red line next to a blue line in your 3d window.

Attached an example of a cave network that I am texturing with a tiled texture.

cheers, gryff :slight_smile:

Modular model creation would be pretty helpful here actually.

So its like this:

Create a few wall types (excluding unique pieces here) and then reuse those everywhere, you can use decals to break it up and each copy wouldn’t HAVE to use the same texture, you could swap out the texture if you wanted too.

Great info, thanks guys! I haven’t created any sample layouts yet… I wasn’t sure what the best approach for texturing would be so I wanted to structure my room sizes around what approach I was going to use. I think I can use a combination here… I can make sure my walls are multiples of whatever my texture size is so I can tile accordingly. I can use the same shader for the walls but use different textures depending on the wall type (as Dan suggested), so I could piece them together.

Using this approach I wouldn’t be able to model an entire floor of a building in Blender because I’d be assembling pieces in Unity but I think that would work and would give me more flexibility in things like door placement and details.

I played around with different techniques and found that it’s actually very simple. The easiest approach is to model the walls separately. For long flat walls they can be a single poly surface. I can UV Unwrap and apply a standard image material. In both Unity and Blender I can just tile the material to achieve the effect I’m looking for.