Saturday, January 26, 2013

Modular Assets II

Hello again!

In my last post I promised to write about specific modeling techniques I've picked up on while modelling modular assets, so here go! I'd also like to remind everyone that I'm in no way a veteran in the business, so if you see any improvements I can make, or just plain out things I do wrong, please let me know in the comments!

Corner assets

Symmetry

When making a corner you can always use symmetry on your mesh, unless it needs to look different on one side, is broken or stuff like that. But even if one part is broken, you could always just use symmetry first, and then break it afterwards, to save you some time. 

Let's do an example:
To the left we have a regular straight wall. We want to make a corner asset out of it, so we use symmetry. 
To the right, we've used a simple symmetry modifier, with the symmetry mirror turned 45 degrees. It works pretty good, but there are some problems we need to solve. 




When using a symmetry modifier where you turn the mirror, you will encounter parts of the mesh that are now stitched together, which were previously not. To the right we see two beams having been stitched together through the plane of the symmetry modifier. This is bad, as the 5 vertices selected on the picture form an ngon. It's not very clear on the picture, but the support beam has also been reduced to just a thin strip. Here you will have to do some manual fixing. By cutting through geometry like this, you will also have parts of the mesh that will not be visible, but still take up UV space. Note that this is only a problem if you're going to use symmetry on your UVs, as you're then taking UV information from a modifier applied before the symmetry modifier, but if you're using unique UVs you apply the unwrap modifer above the symmetry modifier, effectively fixing the problem.

While the symmetry modifier is applied, I fix the problems, welding verts to remove ngons, and brush up the visual problems, like the support beam becoming too thin in this example.
The next step is to look at the mesh in an ortographic view, from a 45 degree view, and delete every polygon on one side to ensure that every vertex is properly aligned to the plane of the symmetry modifier we used earlier. I then fix up the problems we were having, fixing Ngons and brushing up the problems like the support beam becoming too thin. The final step is to reapply a new symmetry modifier with the same properties as before.


In the next picture I've fixed the smoothing groups on the right side of the mesh. When using symmetry, you also transfer the smoothing groups, resulting in weird results in the seam.
If you want to use a symmetried texture, you can now apply an unwrap below the symmetry modifier, and it should work fine.
The final result with textures
If you want parts of the mesh to be damaged, there are some things you should remember. Even when using unique UVs it's a good idea to first use symmetry on your UVs to make sure they are of the same dimensions  on both side and thus saving you some work. If you're using special assigned places in your UVmap for different textures, remember to save some space for broken stuff, like debris, rock, wood, isolation or whatever material that might be exposed by damage.  
You can also get away with using symmetry on your UVs, even if the parts are not perfectly symmetrical. Working above the symmetry modifier, you should be able to detract parts of your mesh without breaking the UVs. This might not always work, and most of the time you will probably find that it's best to use unique UVs for parts like this. 


As I'm writing this I'm sitting at the global game jam, and will have to wrap this up for now! I'll try and get these posts out more frequently, but it's all dependent on the work load from week to week. 

Game of the moment: Civilization 5 !

Happy gaming!

-Svein



Sunday, January 6, 2013

Modular assets

The tutorials I write in this blog may seem obvious for the professional 3D-artist, and they're more aimed towards people who have recently started, or want to start with, game design.

In today's post I want to talk about modular assets for games. Modular basically means pieces of a bigger set that can fit together, and be reused multiple times to build a greater scene. When we started working on  Among the Sleep, we were all still students and had never done any (real) work on a game before. What we did in the start was to build levels as one mesh, and export it as one whole block. This created problems when we further down the road realized we had to rethink some of the level design, and had to redo the mesh. Some ugly work were done where we detached whole parts and slapped them on elsewhere and had some unpretty stitching to place it elsewhere. The whole mesh then had to be unwrapped all over, as this process can't be done without destroying some parts of your mesh. It will also create some issues with culling, but that's a whole other subject which I won't delve into today.

So after a while we decided to do some research on modular assets, and it has helped us a lot! Now we just create a number of pieces consisting of walls, doors, floors and ceilings and place them around like a construction set. This makes it that much easier to rebuild your level, and also helps keep your scene tidy, as everything is on a grid. There are a number of good tutorials on how to do modular assets, so I won't go in too much depth on how to do this, but I'll try to write about some of the tips and tricks we've learned on the way.

I'll start with some of the stuff you need to have down before you start, to avoid problems further down the road. I'll also show most examples in 3Dstudio Max, as it is the 3D-modelling software I use, though most of what I show is transferrable to other modelling softwares.

"Pivot! Grid! Units! UV tiling!"

When planning this post, I asked our Art Director if there were any points he wanted me to include. The answer was short and consice: "Pivot! Grid! Units! UV tiling!". So I figured I'd start with that.

Pivot!

Pivot placed in the lower corner of a very basic wall module
When making modular assets it is very important to be pinpoint precise. If you make pieces that kinda fit together, but not quite, you will get ugly seams or z-fighting in your level. The first thing to think about is your pivot point. We usually place the pivot on a modular piece in the lower corner. When having the pivot point in the lower corner it is easier for the level designer to place them together precisely. You could of course have your pivot in the dead center also, and it would work, but it is just easier to place things precisely when you can zoom in to the point you need to snap to, while at the same time being able to move your asset.


Snap settings, snapping two verts and grid point
What I found makes my work a lot easier in 3Dstudio is the "Snap to Vertex"-function. Using this I can easily snap my modules to the outermost vertex of another mesh, aligning them perfectly.

 Below I've very crudely demonstrated how you can align two wall modules using the snap to vertex-function.



2 unaligned wall modules

Snapping the pivot of one module
to the outermost vertex of another module,
creating a perfect alignment

Grid! Units!

The grid is the squares with which you measure distance. When snapping to the grid it makes it easier to do precise modelling and moving objects around. It's important to set up the grid in your 3D-modelling software the same way it is set up in your game engine. Let's use UDK as an example, where in the editor you generally follow a rule of 2. Assets are almost always dividable by 2, like 64x64 or 64x128 or 256x256 and so on. So you'd want to have a grid in your modelling software that's also dividable by 2. 

Setting up the grid. In my case I like to have a grid of 2,5 cm, and major grid lines every 10 lines
These can be changed based on personal preference, as long as they follow the same type of grid as you  use in your editor, e.g. don't use 2,5 as a grid in your modelling software if your grid in the editor is based on the rule of 2. 
At Krillbite we use the metric system, and then it's important to also remember to use the correct units in your modelling software. We've had some ugly cases where I forgot to change my units, and my 200 cm tall wall turned out to be 200 inches tall instead. Whoops! 
Setting up my units correctly. 

UV Tiling!

A very important aspect of modular assets is making sure you're unable to see where one module starts and another one ends. To achieve this it's important that your textures tile up. If you're not covering up every single transition between modules with other meshes, you need a tileable texture. You also need to make sure the UVs tile between modules. I'll give an example:

Here we have to very basic wall modules together. Their UVs tile up, so without the black line you would be unable to tell where the transition is. 
In this example it is easy to achieve a good result, since the walls are perfectly square, and it's thus easy to fit their UVs. However, you seldom use modules that are just square planes. In this example there is simply no room for any other part of the mesh in the UV space.











When using modules with several other parts that also needs to fit inside the UV space, you can either use two materials for the mesh. Alternatively you can assign a specific space for the part that needs to tile, and draw your tilable texture to this space. 





When using assigned space it is a good idea to select your vertices and write in their coordination value in the boxes below, as shown to the left. This way you can get them to a precise position, instead of "approximately in the middle-ish". This way, if we're talking about a 2048x2048 texture, the 2D-artist can know that the assigned space is -exactly- 1024x1024 pixels large.











In my next post I'll write more about specific modelling techniques I've picked up when working on modular assets.

Games of the moment: Planetside 2 and Chivalry!

Happy gaming!

-Svein