Sunteți pe pagina 1din 35

By Stphane 'Azert2k' Jamin

Azert2k@gmail.com

T4M Project

What that and why use it ?


The T4M is an terrain tool.
It is an alternative of Unity Terrain using your own geometrie made with an 3D Modeling
tool (Maya, EarthSculptor, 3DS MAx, Blender...)
Initialy the T4M targeted the mobile device, but a lot of people find other benefits at the
T4M :
- T4M is a tool that allows users to import geometry into Unity to use as a terrain.
- the T4M for web and mobile is the small size of the build, only one draw call, fast load
speed and great performance(on old devices too)
So, I decide to targeted all plateform and propose a complete solution (exept : Elevation
tool yet)
The T4M included texture painting, planting trees & grass, and have an LOD system and
Billboard on every imported geometries.
The T4M can also convert a Unity Terrain into geometry retaining the blend texture and the
first four splat textures and use it with all benefits than an imported geometrie + T4M
system.
All features are compatible with Unity Free and Pro

Features :
- Unity 3.5 FREE and PRO
- Shader Model 1, 2 and 3 Devices (iPhone, iPad, Android and also Web, PC, MAC,Flash,
NaCi)
- Convert Unity Terrain to T4M and keep your textures and blend texture (it work with 4
splat textures)
- Convert your own Imported Mesh (you are free to make a Terrain with all 3D softwares)
- Planting/Placing any object you want with the new Planting System
- Integrated a LOD System
- Integrated also a Billboard System
- Paint directly with Substance Material
- Best Brush Preview
- 1 Shaders Model 1.1 to Mix 2 Textures
- 24 Shaders Model 2 : Bumped, Bumped Specular, Specular, Diffuse, Unlit, Toon and
Paint up to 6 textures (Desktop, Web) always in 1 DrawCall
- 14 Shader Model 3 : Bumped, Bumped Specular, Specular, Diffuse and Paint up to 6
textures (Desktop, Web) always in 1 DrawCall
- Compatible with Unity Terrain Shaders, you can use your own Shader.
- Undo/Redo implementation for painting.
- Multiple T4M on the scene
- Add your own Brushes (64x64)
- Compatible with Real Time Shadow, Lightmap and Directional LightMap

Before Start, I would apologize for my English, I'm French... Be French is not an excuse... I know :)

For a Good Start with T4M follow that :


Go to Layer Menu :

And ''Add Layer...''

On ''User Layer' 26,27,28,29 and 30, write that :

The T4M Editor Window


To open the T4M window, press CTRL+T (PC) or CMD+T (MAC)
or in the Unity Menu : Window T4M Black Edition

The Menu Tabs

To Deactivate the T4M Controls, just press ''T'' key, or press Activate/Deactivate T4M Controls
Button.

1- Converter
1.1 Imported Mesh to T4M

Simple menu to convert your imported mesh in the T4M.

Select your object on the Hierarchy window to see the convertor menu.
Give a name at your object or none (in this case the object keep original name)
Check or not ''New Prefab'' : if it checked the T4M will create a new prefab
Click on Process

Now you can find in project window a Folder with ''T4MOBJ'' name :
Without ''New Prefab''

Now, your model is ready to be used.

With ''New Prefab''

1.2 UnityTerrain to T4M

Select your UnityTerrain on the hierarchy window to see the convertor menu
Give a new name or not (in this case the future T4M Object keep the original name)
Check ''Keep the textures'' if you want keep the 4 first splat textures and the first blend texture
Adjust the final quality of the T4M Mesh (I put a Vertex performances Indication to help you)
Click on Process

Original UNITYTerrain

After Convertion : the T4M Mesh (8100 vertex)

Now, some choices are offered to you :

CAUCTION : if the number of vertices is too big, Unity will split automatically the mesh in some parts (don't
worry the T4M can use the splited terrains)
So, after have seen the result of the conversion, you can :
keep the new mesh and suppress the terrain in the scene (always kept in project)
Modify the options and make a new conversion for have a best result
Keep Both and Continue

In first case and the last, your model is ready to be used.

2- Mesh Optimization

In this menu, you can adjust Quality/Compression of the T4M Object


The benefits are a best load time , and ease the 3D treatment for the UnityEngine.

Level 0 : Just organize the order of vertices to ease the 3D treatment


Level 1 : Level 0 + Low Mesh Compression (low mesh degradation)
Level 2 : Level 0 + Middle Mesh Compression (middle mesh degradation)
Level 3 : Level 0 + High Mesh Compression (High mesh degradation)

Click on Process to validate the modifications

The process can take some time, depend of object and computer power

3- MyT4M (T4M setup menu)

3.1 Shader Model


3.1.1

Shader Model 1

In this part, only 1 shader is compatible with the T4M :


T4M_2_Textures_GLES1_1 : Simple shader to mix 2 textures in 1 drawcall, not compatible with MBX devices. Compatible

with Lightmap, but with 2 drawcalls (so 2x of vertices)

3.1.2 Shader Model 2

T4M Textures Unlit Lightmap Compatible : 2/3/4/5/6 textures (the last is not compatible with mobile) Best shaders for

mobile, and fix artefacts problems of surface shader when you have a too big tiling value
T4M World Projection Unlit Lightmap Compatible : 2 textures shader by world projection, no need to have an uv with this

shader. If is the case, create a lightmap uv on your model for use the Lightmap. Don't work on mobiles
T4M 6 Textures Unlit No Lightmap Compatible : 6 textures shader work on mobile, but can't use the lightmap
T4M Textures High Spec : 2/3/4/5/6 textures surface shaders, not opimized for mobile.
T4M World Projection High Spec : 2 textures shader by world projection, no need to have an uv with this shader. If is the

case, create a lightmap uv on your model for use the Lightmap. Don't work on mobiles.
T4M Textures Specular : 2/3/4 Specular Shaders
T4M Textures for Mobile : 2/3/4 Textures Shader optimized for mobile
T4M Textures Toon : 2/3/4 Toon Shaders
T4M Textures Bumped Mobile : 2/3 Textures Bumped Shaders for Mobile
T4M Textures Bumped : 2/3/4 Textures Bumped Shaders, not Mobile optimized.
T4M Textures Bumped Specular Mobile : 2 Textures Bumped Specular Shaders for Mobile
T4M Textures Bumped Specular : 2/3 Texture Bumped Specular, not mobile optimized

T4M Textures Bumped Directional Lightmap Mobile : 2 Texture Bumped Shader for mobile and Directionnal Lightmap

Compatible
T4M Textures Bumped Directional Lightmap : 2/3 Texture Bumped Shaders not for mobile and Directionnal Lightmap

Compatible
3.1.3

Shader Model 3

Some are the same than Shader Model 2 shaders, but with best quality and less limit.
3.1.4

Custom Shader

The T4M is compatible with all UnityTerrain shaders, and you can use your own shader too.

3.2 T4M Settings

Master T4M Object : A T4M Master Object is the alone object who can control the camera, LOD and Billboard.
You can have only 1 Master on the scene.

If you have more than one T4M object, the parameter can be adjusted only on the master.
Scene Camera : By default the T4M will seek the Main Camera on the scene, but you can use an other to see
correctly the LOD/Billboard or LayerCullDistance.

Activate LOD : Activate/Deactivate the script who control the LOD Objects.
Activate Billboard : Activate/Deactivate the script who control the Billboard Objects.
Activate LayerCullDistance : You can use four differents distances of view for your objects on the scene by using
the Layers. It's a good thing for mobile performances.
Maximum Distance of View : if you have Activated the layercullDistance, you can adjust the distance between
camera and the objects. (See : ''For a Good Start with T4M'' page)

On the screenshoot, all object who have :


- ''CloseView'' Layer will hide if it at more than 30 of distance,
- ''NormalView'' Layer will hide if it at more than 60 of distance,
- ''FarView'' Layer will hide if it at more than 200 of distance,
- ''BackGround'' Layer will hide if it at more than 1000 of distance,

When you have finished your tweaking, you can click on ''Update'' button

4- Painter

4.1 Materials

If you want paint you must add materials, so we will see this menu first :
Before import the texture, you must choice the type (Classic texture or Substance):

Classic Texture Case :

When you click on ''Texture to add'' box, you have the texture window which will open.
Just select one

Add place it on list with Up arrows

Repeat that as many times as you want.

Now, you can modify the texture selection in ''Modify'' box if you want.
If you use a bump shader, the ''Modify'' box will be like that. Select one texture in the list, you will can add a
bump texture in ''Modify'' menu

For Substances the menu is like that :

In this case, the bump will be automatically added, if you have generated it.

CAUTION : Since the 3.5 Update of Unity, if you change the values of substance and add an other
substances material on the list, the Engine will crash
2 Tips to avoid that :

Add all substances materials on the list before modify.

After modifications, cloase the T4M Menu, save the scene and return on the T4M menu to add an
other substances on list.

4.2 Painter
4.2.1 Brushes

To paint, you can use a lot of differents brushes, and you can add your own like that :
In root T4M Editor Brushes, you have this list by default

To add a brush, in your favorite 2D software create a 64x64 image and draw your own brush (Don't
forget to leave empty 1px on each side)

Now save new brush in PNG with name ''Brush15'' in the Brush Folder.

Select it in Unity :

In inspector configure it like that :

Congratulation, now you can use your own brush

4.2.2 Painter Settings


Differents Painter Menu according to shaders
2/3/4 textures diffuse/bump

Shader with more than 4 textures

Shaders with Specular

World Projection Shaders

Preview Type

Classic (texture preview)

Follow Normal Circle (In some cases and some UV, you might want to use a solid circle )

Follow Normal Wire Circle (In some cases and some UV, you might want to use a Wire circle )

Or you can Hide the preview

Brush Size and Brush Stronger : I think you know that

Tiling Settings :
You can adjust the tiling value for all textures
First choice : Tiles X and Y textures by the same value (Join X/Y box checked)

Or Second choice : Tiles X and Y textures independently(Join X/Y box unchecked)

Now, Just Paint !!

5- Planting

CAUTION : Think to reactivate the LOD/BillBoard after have plant one LOD or one BillBoard Object.
Add to list : Select the object you want add to the list, and click on one arrow to add, like that :

Under the plant list, you can find one checkbox and one list box for each object :

The CheckBoxes allow you to plant randomly each checked object. The T4M will alternate automatically the selected object
between each checked object.
The List Boxes : If you have activate the LayerCullDistance in the MyT4M menu :

You can choice for each object, the layer you want use.

In this case, the object with ''Close'' value, will be culled, by T4M, at the value of ''Close Distance'' in the MyT4M Menu (30 m).

General Settings

Plant Mode : You can choice if you want planting the object by the tilt of terrain surface (Follow Normal) or not (Classic)
LocalSize : If you want reduce or increase the value of the size of your object, before planting.
Size Var. : Random value, to allow you to obtain a variable size of each object you plant from the local size. (0 no variable size,
0 > the size will be variable between the -value and +value)

Y Origin Corrector : to adjust the distance between the ground and the pivot of your object
Create Collider : If checked, the T4M will create a mesh collider at the instantiate of your object.
Static Object : Make a Static object, for the Lightmap shadows, or Unity Pro Static batching use.
Group Name : Create a folder on the scene to group the objects

Spacing Distances Menu


To avoid to overlay multiple objects, and obtain variable distance between each objects.
Random Spacing Deactivate

The green circle is the Safe Zone

It ensures a minimum distance between objects


Too Close

Free to Planting

With Random Spacing Activated

In this case, the green zone is always the safe Zone, the yellow circle represent the ''Random Instance Zone'' and the Yellow
Wire Circle is the Randow Distance calculate between ''SafeZone'' and ''Random Instance Zone''
At each planting, the distance will be calculate randomly between this two values. The rsult is more realistic than use a
constant value.
If a object, already planted, is in wire circle, you can paint your new tree, but if it out of this zone, the T4M will instantiate the
new object.

Random Rotations :

Randomize the rotation of each planting objects to increase the realism of your scene.
X and Y value, will affect the tilt of the object, Y value just the Up rotation of objects.

Controls :
''Shift'' Key : Go to suppress mode, a red circle will appear, to allow you suppress all objects in the red circle :

''CTRL'' (PC) or ''CMD'' (MAC) Key : Replace mode, a orange circle will appear, to allow you to replace all object in the circle
by the selected object in the list (will keep the rotation and position of the old object)

''G'' and ''H'' Keys : before click on the scene to plant your object you can adjust the Y rotation manually with this 2 keys :

''+'' and ''-'' Keys : This keys affect the Y Origin Corrector, to adjust the distance between the ground and the pivot of your
object

5- LOD

5.1 LOD MANAGER


LOD Mode
Mass Controler : Each LOD objects will be managed by 1 algorithm, so all LOD change will be appear in same time, visualy
is not the best.
Independent Control : Each LOD Objects will be managed by itself, the LOD change is more gradually and give a best result

Culling LOD Object Mode


Max View Distance : The T4M will be culled the LOD object by Script, but if the LayerCullDistance is activated and that the
distance layer of the object is less than ''Maximum View Distance'' value, the MaxViewDistance function won't have any effect, because
the LayerCullDistance will make the culling before the script.
Layer Cull Distance : just let the LayerCullDistance make the culling.

MaxViewDistance
This value is used with MaxViewDistance function, think to put a less value than Layer Distance value of your LOD Objects, if
you want use it.

LOD Update Interval in Seconde


This value is very important, because it is the interval of the refresh status of LOD objects. Be care at too very small value, it
can be heavy for mobile

LOD 2 and 3 Start


LOD2 Start value is the distance you want change the LOD1 Objects by the LOD 2 Objects : 0 to this value, only the LOD1
Object will be visible, after this value, the LOD2 Object will replace the LOD1 Object
Same thing between LOD2 and LOD3 : between LOD2 value and LOD3 value, it will be the LOD2 that you can see, but after
LOD3 Start value, the LOD3 Object will replace the LOD2

ACTIVATE Button
Click on it, to activate the LOD function, the T4M will seek all LOD object on the scene, to be able to manage LOD Objects.

Think to reactivate it, when you will plant others LOD Objects.

5.2 LOD COMPOSER


A menu to create a T4M compatible LOD objects.

LOD Prefab Name


The name of the new LOD Object.

LOD Meshes
LOD1 Close : put the most detailed mesh here
LOD2 Medium : put the medium detailed mesh here
LOD3 Far : put the less detailed mesh here

LOD Setup

Place the MeshCollider on this LOD : Like said, choose one LOD Mesh to put the meshcollider, or not.
LOD Shader
New : Create a new material for this LOD Mesh
Already Exist : Choose a material who exist in the project, for this LOD Mesh

In both case, you can modify the Textures of the material and use Substances material too. because of lack of ''buildin shaders'' in the list, rather prefer to create the material manualy before.
You can use directly the Substances shaders too.

LOD 1

LOD 2

LOD 3

After finishing the LOD setup, you can press on the ''Construct'' Button.

You can find your LOD Object here :

In this case I haven't create a new material, if it the case, you can find the new material in the ''Material'' folder.

6- BILLBOARD

6.1 BillBoard Manager


Culling BillBoard Object Mode
Max View Distance : The T4M will be culled the Billboard object by Script, but if the LayerCullDistance is activated and that
the distance layer of the object is less than ''Maximum View Distance'' value, the MaxViewDistance function won't have any effect,
because the LayerCullDistance will make the culling before the script.
Layer Cull Distance : just let the LayerCullDistance make the culling.

BillBoard Rotation Axis


This value is very important, because it is the interval of the refresh status of Billboard objects. Be care at too very small value,
it can be heavy for mobile

BillBoard Update Interval in Seconde

Y-Axis : Just turn facing to player with Up Axis


Normal Position

Up Position

All Axis : Turn facing to player with all axis


Normal Position

Up Position

MaxViewDistance
This value is used with MaxViewDistance function, think to put a less value than Layer Distance value of your Billboard
Objects, if you want use it.

ACTIVATE Button
Click on it, to activate the Billboard function, the T4M will seek all Billboard object on the scene, to be able to manage Billboard
Objects.

Think to reactivate it, when you will plant others BillBOARD Objects.
6.2 BillBoard Creator
BillBoard Prefab Name : The name of the new Billboard Object.
New Billboard Type
Classic T4M : Create a simple billborad with a single plane, to make grass for exemple
Cutsom : Import your own geometrie to make the billboard object.
BillBoard Shader
New : Create a new material for this Billboard Mesh
Already Exist : Choose a material who exist in the project, for this Billboard Mesh
In both case, you can modify the Textures of the material and use Substances material too. because of lack of ''buildin shaders'' in the list, rather prefer to create the material manualy before.
After finishing the Billboard setup, you can press on the ''Construct'' Button.

You can find your Billboard Object here :

In this case I haven't create a new material, if it the case, you can find the new material in the ''Material'' folder.

Voil ! This is the end of the T4M Interface tutorial, I hope my english is not too boring to read.
See you soon, if you have others questions.

Stphane 'Azert2k' Jamin


From France ;)

S-ar putea să vă placă și