Fixing Tessellation Seams in UDK

Tessellation in UDK

Tessellation is a great way to add organic detail to a mesh.
However even with matching UVs and pixel perfect line-up in textures seams will occur across meshes.

109.jpg

And here’s why the problem occurs and how to fix it.
UDK_Tessellation_Fix

Expand the models and have the displacement map taper off towards the end. The tesselated geometry will intersect creating a more natural looking seam. CAUTION!!!The geometry will lightmap based on the un-tessellated geometry which will produce some lightmap errors on the tessellated geometry. But at least there’s no seams 🙂

UDK_Tessellation_Fixed

Using Cloth Dynamics to Create Complex Meshes

Introduction
I needed to fill up an area with large piles of garbage for the project I am currently working on.
My first impulse was to model a couple of different bags and start piling them up into larger piles.
It wasn’t before long that the triangle count shot up exponentially and the drawcalls went through the roof even with batching enabled. I had to find a way to make them all one shape and eliminate any excess geometry that wasn’t needed.

The Idea
I decided to try and use Mayas nCloth functionality to generate a low-poly mesh for the piles.
This technique should work for any organic form where you have a pileup of multiple shapes.
In this case its garbage piles but it could be a rock slide etc.
First I created the pile out of the individual meshes adding variation through differences in hue, scale and rotation. I even enabled soft selection and helped some areas conform to the shape I had in mind.
Then I created a fairly dense plane and positioned it above the area.
I converted the pile to a collider and the plane into a cloth object then ran the simulation until the cloth had covered the pile. From there I retopologized and reduced the cloth, then transferred the normal information from the high poly pile. In the end I transferred the diffuse information to a new texture and applied that to the low poly pile.

Settings
A problem I encountered when simulating the cloth was that the points that made contact first would stretch and slide across the object. You need a cloth preset that is flexible enough to deform and slide into the creases but not stretchy enough that it loses its shape again.
I ended up starting with the burlap preset and then tweaking its Friction to 1000, Stickiness to 10000 and the stretch resistance to 0.01.
That way the points that have made contact will stay fixed while anywhere that there still is a gap, the mesh will stretch to fill them out.

Bellow you can find a timelapse of the stages of the process.

Asset and Scene Management in UDK

Importing assets

So we have an asset to send over to UDK, what now?
In this series I will be covering an asset flow based on the FBX plugin as the other method, based on ActorX is being phased out.

Select your asset and bring up your fbx exporter.
A common problem is that smoothed edges don’t translate over to the game engine after the export.
Make sure to be using the 2013 version of the plug-in as UDK will yell at you otherwise.
Set your settings according to the image and hit Export.

Post_002_FBXexporter

Packages

UDK uses a packaging system to manage its content.
Every asset that you will put into your scene will be saved in a package.
You can store models, textures, materials, animations, audio etc in packages.
Typically packages are saved under UDKGame>Content.
Packages can get quite large; UDK recommends not letting them get over 300mb, since you can have a near infinite amount of packages that will not ever be a problem.
My recommendation is to split your project up into several packages, within reason.
I had a project built around a single package once and that package corrupted. Should that happen in the future, with a multi package setup you only lose a portion of your in-engine work.

Now, let’s get started.

In UDK, bring up your content browser.
Press the Import button on the lower left and an explorer window will open.
Navigate to and select your asset, the Import dialog will open.

Post_002_ImportDialog

The first segment ‘Info’ is always the same, no matter what type of asset you’re importing.
Here you determine what package you want to add your new asset too.
If you had a package selected when you pressed import, that package will appear here.
You can create a new package my deleting the text and naming a new package.

Grouping is where you can define the sub-groups of your package.
For instance I like seeing all the meshes together, all the textures together etc so for a package that will contain static meshes I usually create three groups; Materials, Meshes and Textures.

Name, this will be the name of your asset inside UDK.
By default this will be whatever the name is of the asset you’re importing but you can still change it.

Below the Info box you will find more import options, these differ for every type of asset you import.
Experiment with what works best for you, the option names are pretty self-explanatory and if you hover over an option additional explanations will pop up.

 

Adding assets to a scene

Now that the asset is in its package, together with its textures and with its materials applied, it’s time to add it to a scene.

One way is to just select the asset and drag and drop it into your viewport. The other is to have your asset selected in your content browser and then right clicking into your viewport.
A dialog will appear and you asset will be listed for placement.

Post_002_AddAsset

 

How to find my asset – Scene Tab

Once you start building a world, level, portfolio piece you will quickly end with a tone of assets in your scene. Managing all those assets can become difficult and tedious. You can find a list that breaks down everything in your scene under the Scene Tab in your content browser.

By default UDK will list everything out by its default handle. The first static mesh you add will be StaticMeshActor_1 etc. So it becomes difficult to see at a glance what StaticMeshActor_168 is.

Post_002_SceneTab_A
With a little effort you can add a Tag and assign a layer to your objects.

Click on a listing and on the right you will see its properties. Those are the same options you see when you bring up the options window by pressing F4.
Scroll down until you find the Object category.
There you can tag an object and assign it to a layer.

Post_002_SceneTab_B
The tag can be anything but I don’t feel like getting creative with the asset tagging will benefit me in the long run. Instead, I copy the asset name out of its listing up top under Static Mesh Actor>Static Mesh Component>Static Mesh Component>Static Mesh and paste it into the tag.
That way glancing over the Tag column will give me the asset name, which should be following some sort of naming convention and therefore give me all the information I need.

 

Help, my scene is too crowded – Layers Tab

All those assets sure make for a beautiful scene, but trying to place an asset using the viewports in that wireframe soup quickly becomes cumbersome.

Post_002_ViewportWire
This is where it paid off that you also defined a Layer in the same step where you assigned a Tag. In the content browser, open the Layers tab and all the layers you declared earlier will be here. Now you have a way of easily hiding and unhiding whole groups of assets based on their layer.

Post_002_LayersTab

Tutorial – mib_color_mix_node

In this tutorial I will introduce one of my favorite nodes in the Mental Ray tool set, the mib_color_mix node.
Often overlooked, this node will transform any material into a powerful multi-texture solution.

So let’s begin. You can find the mib_color_mix in the Mental Ray section under the Data Conversion sub-group.

You can use a mib_color_mix in any channel of any Mental Ray shader.

You will notice that the mib_color_mix is broken up into 4 sections.
From top to bottom these are, a field called Num, Mode 1-7, Weight 1-7 and Color 1-7 + Color Base.
The Color section is where you will plug in any visible maps you wish to use.
The Weight section will house your alpha maps.
Mode will determine how the layers will blend together and Num will tell the Shader how many channels to calculate.

Each layer that you add after the Color Base, will be a combination of its Color Layer, Weight and Mode settings.
So, Color 0, Weight 0 and Mode 0 will belong together and so on.

In the image below, I added a breakdown on how I used the mib_color_mix to create a multi-layered texture that
significantly reduced my memory consumption while at the same time increasing the available detail.

Click on image to view in full resolution.

Click on image to view in full resolution.

Now that we understand how the shader works, let’s take a look at how the settings affect the overall look of a texture.

Below, I added another example on how the node can be used.
The project called for a waterfall and a dynamic simulation was not a realistic option due to time constraints.
With a single texture and an mib_color_mix I was able to take a more game-engine like approach.
The same texture was overlayed four times with different UV repeat rates that were additionally animated.
Below, you can find the results of the waterfall effect.