Wednesday, 13 June 2012

Mapping a simple building in 3DS max

In the previous post I talked about General texturing. I skipped the bit about mapping, sorry.

There are a number of ways to map/edit textures to polygons, and I use different methods depending on what it is I am modelling.

Here I will show you how to model a simple Farm building, It will be done in a few parts as each post takes a little time.

I will be using the same textures as the previous post. the texture is 1024 pixels high and 512 pixels wide. 2-1 ratio.

I create a box in max in the top view.
Length 5M
Width 5M
Height 10M

and I make sure Generate Mapping Coords is ticked.

I create a new kuju material (tex diff will do for now) and apply it to the object.

I convert the model to edit poly and in the front view I select the edit poly option and detach the front polygon, then delete the original shape so that I am left with a flat plane facing forwards, this is going to be the front of my building.

I select the poly option and select Slice in the modifier list.

Right click the orange slice plane and select slice plane.

This allows you to rotate and move the place around the object, if you have followed these steps the slice plane should be cutting your polygon through the middle in the horizontal plane.

I move my slice plane down to the bottom of my wall.

However I want to slice my polygon a number of times so I need to copy the slice plane.
I click on the slice plane in the modifier stack.

I then click on the modifier stack again and select paste.

Repeat the process of moving the slice plane to where you want to cut next.

Once done I collapse the stack and make the object edit poly again.

I now select each polygon and detach them till I have 4 different objects.
These 4 objects are all that is needed to make your basic shape.
Windows and doors will be cut in later.
I select the wall section and hide the other 3 objects.
I move the wall down till it is centered at 0.

I select line in the modifier window (1) and I tick the preserve UVs (2)

Now then as i want my building to be longer than 5 M's so I am going to drag the right hand edge. Because we have the preserved UV button ticked and our polygon is mapped perfectly you will see no distortion in the mapping as you make the wall as long as you want.

Once you have made the wall as long as you want un tick the  preserve UV button.

End of Part 1

Thursday, 7 June 2012


Two Rules Of Success In Life:
1. Don't Tell People Everything You Know...

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.