Author Topic: More thoughts on land object creation  (Read 427 times)

Offline 8thJinx

  • Silver Member
  • ****
  • Posts: 990
More thoughts on land object creation
« on: January 01, 2018, 07:46:22 PM »
Regarding the creation of land objects, here are some mile-high thoughts and concepts:

I.   Nomenclature
The element that I have been calling a 'land object' for the last 2 months, like the town, or a GV base, or the center of Ndisles, or the Remagen tanking area I'm working on, is called a 'shape' in the Object Editor (OE), but a 'file' in AC3D.  In the Terrain Editor (TE), you find them under the Object Tab, in a pull down list of 'shapes'.  Bustr has referred to these as 'micro terrains'.  Whatever we want to call them, it is extremely important to NOT make the assumption that the OE/TE nomenclature carries over or applies in any way to what you're working on in AC3D.  This goes for building shapes, berm shapes, bridge shapes, etc.  The shape you will ultimately select in the Terrain Editor in the "Objects" tab has a vastly different life inside of AC3D and the .ac text file.

So in a nut shell, it is best to think of these land objects this way:
   a.  In the OE and TE, these things are called shapes.
   b.  In AC3D, these things are a collection, or World, of groups, nodes, and polys arranged within or on top of each other, that represent the thing you see in the game, and saved in one .ac file.

I will try to explain below, but for now, I will continue to call these things land objects.

II.  File formats and getting started
Consider the town1x1m land object.  It is very useful to play around with this object to teach yourself how to make an efficient, detailed land object that doesn't screw up frame rate.  When you export the town shape out of the OE to AC3D using the "Export to AC3D" button, you get a bunch of files in the Export folder:

The filename.ac file - this is the file with all of the hierarchy, vertex and surface data.  You can open this file in AC3D, or in Notepad.  In fact, you can create new objects just from Notepad, without ever needing AC3D!  Easyscor does this with buildings.  (However, it is important to note that for new objects that you create wholly inside of AC3D, you need to copy over the 512 material definition lines from any .ac file you get from the OE conversion.  This is worthy of its own thread, but you need those 512 lines copied into your file via notepad.  So for example, say you created a berm fresh inside of AC3D, and you now have a new AC3D file named berm with a mesh and texture.  Save the file, close AC3D, then open the file in Notepad, and copy those 512 material definitions from one notepad window to the other, into the second line of the file.  Delete any other "Material..." lines from your text file.  Save it, then re-open the file in AC3D and continue working.)   

The background bitmap image or diffuse map filename.bmp of the town (overhead view).  This is the image that the original content creator used to create the town.  This is the file you should start with, before doing anything.  These images can be 1024x1024 pixel resolution or more.  The 1 mile square town is 1024x1024 pixels.  The 2 mile GV base is 2048x2048 pixels.  The 4 mile Ndisles center island land object is also 2048x2048 pixels.  Note however that for building diffuse maps, which is used to map the building image on to a side of the building, this file can be up to 4096x4096 pixels.  This is important to note, because when you convert a building shape to AC3D, you get the 4096x4096 diffuse map, but when you convert a land object to AC3D, you get the background image.  This is a huge aspect of the process to take note of.

The Alpha bitmap, filename_A.bmp.  This is a grayscale overhead image of the town.  Black means 100% the atlas textures from the TE show through, including trees, hay stacks, and village buildings.  White means none of the atlas textures show through.  Shades of gray mean some of the atlas textures show through.  So you can gray-out trees, but keep the underlying grass or dirt pattern from the atlas texture.  It's important to note that no matter how you set your land object poly textures, the alpha map will determine what shows through in the final product.  So you could set a bunch of polys with a dirt texture, but if half of them are "alpha'd out" in black in the alpha map, and the other half is set to white in the alpha map, those polys covered in white will show your dirt, while the polys covered in black will show the underlying atlas texture. 

The Normal bitmap, filename_N.bmp. This is the normal file, which are essentially vectors that set how much the diffuse map is warped to simulate 3-D when the object is subjected to lighting.  For rendering purposes, you should leave your overall land object normal maps flat and not give it bumps.       

The Environment bitmap, filename_E.bmp.  This is a grayscale overhead image of the town.  Darker areas are the areas where light has no effect on it, and the appearance is dull.  Lighter areas are somewhat shinier.  So if a grass field should have a duller appearance than a rock face or a street surface, then the grassy areas should be given a darker gray mapping, while the rock faces and streets should be given a lighter gray mapping.  White is chrome-like, so don’t go near white for land objects.

The Height map, filename_EV.bmp.  This is a grayscale overhead heightmap.  White is highest, black is lowest.

The Clutter bitmap, filename_CL.bmp.  This is a grayscale overhead image of the town.  The clutter bitmap controls the level of ground clutter (grass, flowers, etc) appear in the terrain.  The shades of gray are specific to the level of clutter. 

The Specular bitmap, filename_S.bmp.  This file controls the shiny-ness of the terrain.  Black is no shine.  White is high shine.

You will need to create each of these files for your land object.  It is best to start with the background image, and start building from there.  Having a background image makes it much quicker to lay in things like streets, railroad tracks, streams, and building foot prints. 

III. Land Object Creation
Regarding the actual construction of a land object in AC3D, try not to think of it as a single mesh with all of the vertices welded together, like the meshes we see in the terrain editor.  Think of your land object as a complex layering of discrete objects, each of which you have great control over.  These discrete objects can be split up into groups of polys, or nodes.

A good way to wrap your head around it is to think of it as a dinner table.  The most primitive layer is the table top.  You can add a table cloth, or place mats, plates, napkins, tableware, center pieces, etc.  However, you will be in a plane flying over this table, and the vector your plane is flying in will be processed many times a second by the collision traverser to check and see if you flew into a candle, or a wine glass, or a plate, or the table cloth.
 
To avoid frame rate issues, don’t put all of your polys and vertices into one node.  If you do that, the traverser will have to cycle through that one large node, checking all of the polys for collisions, many times a second, even if you’re 2 miles away from the polys being checked.  Your entire land object should be split up into an elegant grouping of nodes, in an orderly hierarchy, with the primary goal of giving the collision traverser an easier job of checking for collisions. 

The final node hierarchy would look something like the node hierarchy found in the town1x1m.ac file.  You can see this clearly in Notepad, and clearly in AC3D under the Tools/Hierarchy View menu item.  The table top (your most basic element) is split into nodes consisting of 1/4 mile squares.  You can do anything you want in those quarter mile squares, but two rules cannot be violated:

1. The perimeter vertices of the land object need to be spaced at 660 feet, to match the TE mesh.
2. The vertices inboard of the perimeter need to also line up, at least for your base layer (table top).

The easiest way to begin this orderly node grouping is at the point you lay down your table top.  There are a number of ways to start your table top.  L3DT is a great tool.  Terrain.party is another.  Or you could start right from AC3D.  My preferred method for land objects is to create a rough mesh in L3DT, and then bring it into AC3D for polishing. 

Regardless, the final work of bringing order to your land object hierarchy will be from within AC3D.  To do this, simply highlight the poly surfaces in a quarter mile square, and select Surface/Cut Away Object from the menu.  If you now check your hierarchy view, you will now have the original node of your table top mesh, plus a new node with your selected poly surfaces.  It is a good idea to lay a hierarchy out on paper or in a word or excel document, so you can rename your nodes as you create them, and stay consistent from one project to another. Continue highlighting and cutting away until all of your quarter mile squares are in their own, named nodes.

Next, do the same thing for your higher elevations.  Create ‘high’ nodes and ‘low’ nodes.

When it comes time to add detail to your land object, the single most powerful tool will be using the File/Merge command.  Why is this powerful?  Because you can create a library of objects, like roads, rocky cliffs, bridges, buildings, berms, railroad beds and tracks, etc., apply textures to them individually, and then bring them into your land object with the merge command, complete with their texture maps applied.  This makes it a lot easier to build complex land objects.

So for example, if I wanted to create custom a tanking area with berms like the old 85 spawn from Compello, I’d create a library with the barn objects, the berm objects, the road objects, and the bridge objects, and then create a land object for the terrain, and merge the library objects into the land object file and hierarchy.  My land would by alpha’d out and take the grassland and beach atlas texture, but the barns, roads, and bridges would have their own textures mapped and baked into the file once they were merged in. 

In the end you will end up with an orderly hierarchy of nodes, that won’t tax frame rate.
Join Date: Nov 2012

B-24H Liberator SN 294837-T, "The Jinx", 848th BS, 490th BG, 8th AF, RAF Station Eye, delivered 1943.  Piloted by Lt. Thomas Keyes, named by by his crew, and adorned with bad luck symbols, the aircraft survived the entire war.

Offline 8thJinx

  • Silver Member
  • ****
  • Posts: 990
Re: More thoughts on land object creation
« Reply #1 on: January 03, 2018, 02:54:31 PM »
I need to make a hugely important edit:

The "E" bitmap, filename_E.bmp.  Even though this has the "_E" extension, the game reads this as the detail texture map.  This is a grayscale overhead image of the town.  Each shade of gray corresponds to a specific material (asphalt, dirt, cobblestone, brick, grass, etc) in the detail texture atlas.  The default detail texture atlas has been posted in the first sticky of the Terrain Editor forum. 

So now we have all of the tools needed to make and texture land objects.   
Join Date: Nov 2012

B-24H Liberator SN 294837-T, "The Jinx", 848th BS, 490th BG, 8th AF, RAF Station Eye, delivered 1943.  Piloted by Lt. Thomas Keyes, named by by his crew, and adorned with bad luck symbols, the aircraft survived the entire war.

Offline 8thJinx

  • Silver Member
  • ****
  • Posts: 990
Re: More thoughts on land object creation
« Reply #2 on: January 03, 2018, 09:15:50 PM »
Here's a primer on how textures are applied to land objects:

The game relies on a default detail texture atlas for land objects, with a file name of objdet_nep.bmp.  This is a 2048x2048 bitmap sectioned off with 16 textures that you can apply to the land object.  Key word here is "default."  Because you can create your own atlas.  You can either swap in different textures from the ones HTC created (there are 24 or so available), or you can add your own custom textures.  I'll post another comment on custom textures when I get one to work, but for now, here are the nuts and bolts of the file system, and how they get laid down onto the mesh.

The 16 textures in the objdet_nep detail texture "atlas" are laid out in position in a square that is 2048x2048 pixels.  So each subsquare is 512x512.  There is a text file that the game reads that defines how the subsquares are accessed, and which source file is to be used (the source files themselves are 512x512).  The game uses the "_E" bitmap to apply these detail textures.  The "_E" file is a grayscale bitmap that supplies shades of gray ranging from "0" (black) to "240" (very light gray).  The shades of gray need to be set at 0, 16, 32, 48, ... 208, 224, 240 in order for the texture to be read properly in 8 bit grayscale.  These values are the channel values in rgb (i.e., "16" = 16 r, 16 g, 16 b, in 256 rgb).  "0" will access the texture in the lowest left corner of the atlas (currently asphalt01).  "16" accesses the texture next to it to the right in the atlas (asphalt03). "48" accesses the lower right corner (concrete02).  "64" is the next row up, first column (3secconcrete)... etc, etc, to finally "240" at the upper right corner (pspplankvertical). 

To paint your land object with these textures, add a layer on top of your overhead diffuse (256 color) background image of your object, and make it opaque.  Then using a brush and the color palette, simply paint in where you want dirt roads ("208" gray), rocks ("144" gray), grass ("96" gray), asphalt ("0" or "16" gray) etc.  You can even stipple in pixels on top of a texture, and the game will smooth it out.  If you ever drove on the dirt roads outside of the mega airbase VH, and noticed it had both dirt and a little cobblestone mixed in, this is why.

Don't leave any area of the _E bitmap "unpainted".  Then, bring the layer to full alpha (no transparency) save the layer as your "filename_E.bmp" bitmap.  This file, along with your .ac file, and _A, _N, _EV, _S, and _CL files are now ready to be converted using the Object Editor into a new land object. 

Join Date: Nov 2012

B-24H Liberator SN 294837-T, "The Jinx", 848th BS, 490th BG, 8th AF, RAF Station Eye, delivered 1943.  Piloted by Lt. Thomas Keyes, named by by his crew, and adorned with bad luck symbols, the aircraft survived the entire war.