Sunday, 3 June 2012

General Texturing

There is no right or wrong way to lay out a texture.
You can unwrap every polygon and give it it's own space on your UV unwrap but that is a huge waste of space and just not needed for most assets.
However, as I started texturing back in 1995 a 32/32 sized bit map was a big deal and I am always looking to get the most out of my textures.

Do more with less better.

You can of course make the best/largest texture you can for each asset no matter what the size or where it would be used on your route, however your memory footprint will become a huge problem, as is seen on many freeware projects where the user has ticked the set object filter tab and added loads of different packs from many different creators.

My advice for route builders, only add what you need, or even better, set up your own provider product and make (or ask someone to make) what you need. This way you are in control of what gets loaded.
As a route builder you have to think about the trade off between detail and performance.

Asset builders, give some thought to what you are building and make sensible packs (if you intend to share) that contain a selection of useful and relevant assets that can share textures.
Of course not all assets can share textures but often you don't need to use a high res texture to get good detail.
Buildings and assets that are track side tend to get more detail and texture allocation than those further away from the track.

Generally it is best to have 1 asset 1 texture and 1 material. as that is 1 draw call. However it is rare where you can get away with this for most assets.
For the majority of my assets I use a texture layout that I often refer to as a ‘layered cake’ method because of the stacked horizontal strips of texture.

This approach allows me to tile the texture in the ‘U’ direction allowing a higher texel size.
For scenery assets I often make the texture before i make the 3D model. I think about the building I want to make. I often make these textures 1024/512 pixel size.

Example of farm building:

I have a photograph of a building I want to make, it is made of stone and has a tiled roof and a side building with a corrugated steel roof. It also has a selection of doors and windows all painted green.

I make the wall material and the 2 roof materials along with a thing structural support type material for beams and put this into 1 texture.
Note, it is also wise to not mix wall and roof textures on upright and horizontal surfaces if you plan on making winter variations.

So, once I have made my base texture I then make my simple building.

This building is all tiled in the U so can be as long or as deep as you wish.
However, you can see at the end there is a visible join where I have added the apex section. To get rid of this I sliced the end section and shifted the mapping in the vertical. This method can be used to make your building taller, shifting the mapping in the U slightly on each layer can also help reduce and visible tiling.

I then mirrored the front and side to have a textured building shaped box.
Now that I have my basic shape I make a second texture, this I call my detail texture

The detail textures I often make 512/512, however it does really depend on the size of building and how many different types of buildings you want to apply these textures too.

Once I have my selection of doors and windows I cut my doors and windows into my simple shape.

I add elements for window and door supports.
These 2 textures can then be used to make a whole selection of farm buildings.

I then unwrap and shadow bake the whole object and use the trainlightmapwithdiffuse material (explained earlier in this blog)

Changing one of the textures can then give you a whole new building:

Changing 2 textures can make it feel even more different and of course you can mix and match and make many different shapes of buildings with the same textures:

Each building I would make it's own shadow map of about 256/256 pixel size.

So for a small cost of textures/polygons you get a wide and varied range of detailed buildings.



  1. Hi Derek

    How do you get a really sharp images in a 512/512 texture sheet.

  2. Hi Geoff, can you explain to me what you mean?

    maybe with examples of how you something currently looks that you want shaper.

    Some times it could be the texture, other times it could be the mip lod bias (not sure what blender/canvas call it) but that is changing the distance at when the mips kick in. It also could be that your computer is running lower res textures because of your graphics set up in the front on.

  3. Hi Derek

    I seem to get the best results with texture sheets of 1024/1024 and the textures seem to hold up quite well in close up on the models. A 512/512 sheet is a quarter of the size of the 1024/1024 sheet yet you and other modellers still seem to produce models that have sharp clear textures at close range even with a relatively small sheet.

    My 1024/1024 sheets have a resolution of 100ppi x 100ppi in the native GIMP layered format and 500ppi x 500ppi as a converted .tga file and I don't know what the .ace file ends up as. What does this mean and does it help to use some sharpening on the image or even unsharpening.

    My computer is set to max on just about everything except shadows so I should be seeing textures at their best. The Canvas exporter will add the LOD's automatically or you can specify the distances required so I don't think there is a problem there.

    Perhaps I am using the wrong method of reducing high pixel images to much lower resolutions so that they become blocky or perhaps I am seeing a problem that is not there but a walk through of the way in which you build up your texture sheets from scratch might help.

  4. Hi Geoff, can you send me one of your textures at 1024/1024 and the same texture you have reduced to 512/512.
    If you reduce a texture in photoshop you can do 2 things to try and keep the sharpness.
    You can reduce it then add a sharpen filter, I often set this to 50% if I use it.
    Gimp has this feature.


    When you come to reduce your texture you can set the resample method, I often select nearest neighbor. which tries to match pixels without bluring.
    However, in gimp I'm not sure of the process, but i seem to recall there is an Interpolation box at the bottom of the scale image box.
    Try and change the selections to see what effects they give.



    1. Hi Derek

      Files have been e-mailed.

    2. Great tutorial Derek - thank you. Perhaps you could follow this with some tips on how to unwrap then texture a more complex shape such as a wagon chassis.

  5. Derek,

    Many thanks for your advice. For my own attempts at textures I have typically started from the model then mapped each tile (mostly by hand: very boring). Is there a tutorial - even a paid course - on this stuff anywhere, as I can't but help thinking there must be a better/quicker way, given the speed experienced folk like you can do these things :-)

    In your pics above, you show the doors cut into the shape, which then of course makes non-rectangular tiles. How do you then map the tiles onto the sheet? Doesn't it get quite horrible?

    Funnily enough, I have just posted on UKTS about farm building models for Cambridge and then I find you making a set... :-)