Our new LOD baking tool allows you to bake down textures for your LOD's in-engine so that each LOD uses a uniquely mapped texture set.
This way of creating LOD's has many benefits:
When you consider that the original LOD1 for this object (made in the traditional way) was 3435 tris and still used 5 sub-materials, the benefits are clear.
A video of the results can be seen here:
Because by using this technique we are able to reduce polycount and drawcalls so significantly, in many cases you may only need to make one LOD level. On average our new LOD1s created using this technique were about the same polycount as the final LOD level when it was done "traditionally". Things that have very 'polygon-heavy' silhouettes or will be seen miles in the distance may require more LOD levels, but for the sake of this tutorial we will assume we are just making LOD1.
If you do need to make further LOD levels, you can just use exactly the same technique and bake unique textures for each LOD level. Remember that the further away something is, the smaller the baked texture can be!
For simple objects with no alphatest materials or small detail that could be baked to alphatest (e.g. ladders), your LOD just needs to be a simple cage for the object, using as few polys as possible but also avoiding any significant areas of overlapping geometry because this will waste UV space and make your resulting texture look lower res.
The key thing is to preserve the volume and silhouette of the object whilst avoiding overlapping geometry, everything else is unimportant.
I would advise starting with a simple object like this one to get the hang of how it all works before attempting anything where you want to bake to alphatest, or re-use texture space or anything fancy.
Here is an example:
As you can see, even with all the geometry cut in rather than overlapping, the polycount can be massively reduced. Obviously this is quite a boxy example, but on average I was able to reduce most polycounts to about 10%-15% of LOD0 without significantly affecting the volume or silhouette.
In most cases I would generally advise rebuilding the LOD1 mesh from scratch rather than attempting to reduce the polycount of the LOD0 mesh, but this depends on the model to some extent. Models that are very topologically sound to begin with (eg characters) can potentially use the "Multires" modifier to reduce polycount and generate the LOD1 mesh, but for something like the example above it just generates a lot of issues and you are far better off building it manually, it doesn't take long.
The "Freeform" modelling tools in Max 2012 can be very useful for generating topology based on an underlying mesh - you can just kind of "draw over" the LOD0 mesh to create the LOD1 mesh.
Unless you want to do something special (like re-use some uv space or have different texture res in different places, more on which below) you can literally just apply an Unwrap UVW modifier and do a Flatten Mapping, or any other applicable auto-mapping technique that will give you unique UVs with no overlaps. Don't worry about UV seams or anything like that.
These were the settings I used - you can usually get away with the spacing being quite low which will give you a bit more texture resolution.
Each LOD needs at least one unique sub-material. In most cases, one will be plenty but there are certain instances where you may require more:
Remember, the fewer sub-materials you have the fewer drawcalls your LOD will require, so use as few as possible!
So, add your LOD sub-materials to your object's material, and apply them to your LOD1.
Make sure every part of the LOD1 model you want to bake (usually all of it) has a special LOD sub-material assigned.
In a simple case like the air-con unit above, all you need to do is:
Open the level your asset is in, or alternatively just drop it into a test level.
Select your asset.
Open the Material Editor (hit 'm').
Hit the "get material from selection" button to load the correct material.
Right click the material in the list and choose "Set number of sub-materials".
Add as many new LOD sub-materials as you need (one in the simple case of the air-con unit).
Name them assetname_lod1 or assetname_lod1_alpha if you are using an alphatest material.
You should end up with something like this:
With your object still selected, go to View -> LOD Baker
You should see a window like this pop up:
As you can see, the correct cgf is already referenced and the sliders to select the source and target LOD's will be set to LOD0 and LOD1 by default, which is what we want.
512x512 is a good starting resolution for most reasonably sizeable objects, but try out lower resolutions too to see if you can get away with it - you may be surprised!
Unless there is some weird and very good reason to change them, leave the texture paths and filenames alone. The defaults are good.
We aren't baking an alphatest texture right now (more on that later), so leave the Bake Alpha Channel box unchecked.
We have to select the sub-materials on the lod that we want to bake (in case we are baking some parts non-alphatest and some parts alphatest, or in case we have re-used a tiling texture in the LOD that we want to ignore).
But for now we only have one sub-material, so tick Bake this sub-material on it. Then hit Bake and Save.
In a few seconds, some baked textures should appear below the options!
If you want to get a better look at the textures, you can hover the mouse over them for a full size preview.
But even better, hit the Assign to Material button to assign the just-baked textures to your LOD sub-material and see the results in game.
Hopefully it will look perfect! If it doesn't there are a few possible reasons why below.
Once you have used the "Assign to Material" button once you can just keep re-baking the textures and they should update automatically on the object as they are already assigned. No need to do "Assign to Material" every time.
In very many cases, you will be able to remove the specular and normal maps without much visual impact and if you can, you should!
In the case of the specular map, you will probably want to replace it by using the SpecFromDiff controls to generate a spec map from the diffuse.
The LOD Baker supports baking to alphatest polys and this can be very useful for simplifying complex geometry with lots of little holes in (eg ladders, railings etc) or multiple layers of existing alphatest.
The watertower you can see in the picture at the top of the page and in the video is a good example of using alphatest baking.
It's generally a good idea to avoid having alphatest polys covering large areas of the screen because of the overdraw they create, so in some cases you may be better off leaving solid geometry as geometry if there are large spaces in between as on the girders at the bottom of the tower.
As we don't want to use alphatest blending on opaque areas (because it costs more), it usually makes sense to have two LOD sub-materials and bake two separate texture sets.
In most cases, using "two-sided" for alphatest is a BAD IDEA because it will be incorrectly lit the same both sides. A better option is to duplicate the geometry and flip the normals, then move one set of UVs (the side you don't want to bake from) out of the 0-1 range by exactly 1 so that it will use the same part of the texture but won't bake.
In two-sided cases as above and also in some cases where tiling textures or repeated geometry have been used, it's a bit of a waste of texture space to bake the LOD texture out entirely uniquely as the resulting bits of the texture will be the same for each repeat.
The legs are baked to alphatest boxes, but each face on the box is actually the same and then is repeated again for the other legs.
If we laid all the UVs out independently it would take up a lot of texture space for something we know is repeated.
Instead, we can simply layout each face in the same UV space and have them share the texture, like so:
If, as in this case, it isn't important which one gets baked you can just leave them overlapping and ignore the "overlapping UVs" warning in the LOD Baker. The LOD Baker will just choose a face at random to bake to.
If you want to control which face is baked, you can move the other UVs outside of the 0-1 range by exactly 1 (or 2, or 3 - any whole number basically). This way, they still use the same texture space but will be ignored when baking.
See Element Properties Rollout section on this page.
UV groups are a good way to preserve UV overlap while using the automatic UV packing functions in max.
Another thing you may want to do is maximise the efficiency of your LOD texturing by reducing the amount of texture space used for faces that are not very visible on LOD1. They need something on them or you would see holes, but the resolution is fairly unimportant.
In this case, you can simply scale the different UV clusters until you have the desired ratio between the highres and lowres parts.
Then repack the UVs using Pack UVs, but make sure Rescale Clusters is un-checked.
Overall the UVs will be scaled and packed as normal, but the difference in resolution between the clusters will be maintained.