T4MTutorial

Embed Size (px)

Citation preview

  • 8/10/2019 T4MTutorial

    1/35

    By Stphane 'Azert2k' Jamin [email protected]

    mailto:[email protected]:[email protected]
  • 8/10/2019 T4MTutorial

    2/35

    T4M Project

    What that and why u e it !

    The T4M is an terrain tool.It is an alternative of Unity Terrain using your own geometrie made with an ! Modelingtool "Maya# $arth%cul&tor# !% MA'# (lender...)

    Initialy the T4M targeted the mo*ile device# *ut a lot of &eo&le find other *enefits at theT4M +, T4M is a tool that allows users to im&ort geometry into Unity to use as a terrain., the T4M for we* and mo*ile is the small size of the *uild# only one draw call# fast loads&eed and great &erformance"on old devices too)

    %o# I decide to targeted all &lateform and &ro&ose a com&lete solution "e'e&t + $levationtool yet)The T4M included te'ture &ainting# &lanting trees - grass# and have an /! system and(ill*oard on every im&orted geometries.The T4M can also convert a Unity Terrain into geometry retaining the *lend te'ture and thefirst four s&lat te'tures and use it with all *enefits than an im&orted geometrie 0 T4Msystem.

    All features are com&ati*le with Unity 1ree and ro

    "eature #

    , Unity .3 1 $$ and /, %hader Model 5# 2 and !evices "i hone# i ad# Android and also 6e*# 7# MA7#1lash#8a7i), 7onvert Unity Terrain to T4M and kee& your te'tures and *lend te'ture "it work with 4s&lat te'tures), 7onvert your own Im&orted Mesh "you are free to make a Terrain with all ! softwares), lanting9 lacing any o*:ect you want with the new lanting %ystem, Integrated a /! %ystem, Integrated also a (ill*oard %ystem, aint directly with %u*stance Material, (est (rush review, 5 %haders Model 5.5 to Mi' 2 Te'tures, 24 %haders Model 2 + (um&ed# (um&ed %&ecular# %&ecular# !iffuse# Unlit# Toon andaint u& to ; te'tures "!eskto 6e*) always in 5 !raw7all, 54 %hader Model + (um&ed# (um&ed %&ecular# %&ecular# !iffuse and aint u& to ;te'tures "!eskto 6e*) always in 5 !raw7all, 7om&ati*le with Unity Terrain %haders# you can use your own %hader., Undo9 edo im&lementation for &ainting., Multi&le T4M on the scene, Add your own (rushes ";4';4)

    , 7om&ati*le with eal Time %hadow# ightma& and !irectional ightMa&

  • 8/10/2019 T4MTutorial

    3/35

    Be$ore Start% & wou d apo o(ize $or my )n( i h% &'m "rench*** Be "rench i not an e+cu e*** & know #,

    "or a -ood Start with T4M $o ow that #

    -o to .ayer Menu #

    And ''Add .ayer***''

    /n ''0 er .ayer' 21%2 %23%2 and 56% write that #

  • 8/10/2019 T4MTutorial

    4/35

    The T4M )ditor Window

    To open the T4M window% pre 7T8.9T :P7, or 7M;9T :MA7,or in the 0nity Menu # Window < T4M B ack )dition

    The Menu Ta=

    To ;eacti>ate the T4M 7ontro % ju t pre ''T'' key% or pre Acti>ate?;eacti>ate T4M 7ontro

    Button*

  • 8/10/2019 T4MTutorial

    5/35

    @ 7on>erter @*@ &mported Me h to T4M

    %im&le menu to convert your im&orted mesh in the T4M.

    %elect your o*:ect on the

  • 8/10/2019 T4MTutorial

    6/35

    1.2 UnityTerrain to T4M

    %elect your UnityTerrain on the hierarchy window to see the convertor menu =ive a new name or not "in this case the future T4M /*:ect kee& the original name)

    7heck >> ee& the te'tures>> if you want kee& the 4 first s&lat te'tures and the first *lend te'ture Ad:ust the final uality of the T4M Mesh "I &ut a Berte' &erformances Indication to hel& you) 7lick on rocess

    /ri(ina 0 &TCTerrain

  • 8/10/2019 T4MTutorial

    7/35

    A$ter 7on>ertion # the T4M Me h :3@66 >erte+,

    ow% ome choice are o$$ered to you #

    7A07T&/ # i$ the num=er o$ >ertice i too =i(% 0nity wi p it automatica y the me h in ome part :don'tworry the T4M can u e the p ited terrain ,

    %o# after have seen the result of the conversion# you can +

    kee& the new mesh and su&&ress the terrain in the scene "always ke&t in &ro:ect) Modify the o&tions and make a new conversion for have a *est result ee& (oth and 7ontinue

    &n $ir t ca e and the a t% your mode i ready to =e u ed*

  • 8/10/2019 T4MTutorial

    8/35

    2 Me h /ptimization

    &n thi menu% you can adju t Dua ity?7ompre ion o$ the T4M /=ject

    The *enefits are a *est load time # and ease the ! treatment for the Unity$ngine.

    .e>e 6 + ?ust organize the order of vertices to ease the ! treatment .e>e @ + evel C 0 ow Mesh 7om&ression "low mesh degradation) .e>e 2 + evel C 0 Middle Mesh 7om&ression "middle mesh degradation) .e>e 5 + evel C 0

  • 8/10/2019 T4MTutorial

    9/35

    5 MyT4M :T4M etup menu,

    5*@ Shader Mode

    5*@*@ Shader Mode @

    In this &art# only 5 shader is com&ati*le with the T4M +

    T4ME2ETe+ture E-.)S@E@ + %im&le shader to mi' 2 te'tures in 5 drawcall# not com&ati*le with M(D devices. 7om&ati*lewith ightma *ut with 2 drawcalls "so 2' of vertices)

  • 8/10/2019 T4MTutorial

    10/35

    5*@*2 Shader Mode 2

    T4M Te+ture 0n it .i(htmap 7ompati= e + 29 94939; te'tures "the last is not com&ati*le with mo*ile) (est shaders formo*ile# and fi' artefacts &ro*lems of surface shader when you have a too *ig tiling value

    T4M Wor d Projection 0n it .i(htmap 7ompati= e + 2 te'tures shader *y world &ro:ection# no need to have an uv with thisshader. If is the case# create a lightma& uv on your model for use the ightma&. !on>t work on mo*iles

    T4M 1 Te+ture 0n it o .i(htmap 7ompati= e + ; te'tures shader work on mo*ile# *ut can>t use the lightma&

    T4M Te+ture Fi(h Spec + 29 94939; te'tures surface shaders# not o&imized for mo*ile.

    T4M Wor d Projection Fi(h Spec + 2 te'tures shader *y world &ro:ection# no need to have an uv with this shader. If is thecase# create a lightma& uv on your model for use the ightma&. !on>t work on mo*iles.

    T4M Te+ture Specu ar + 29 94 %&ecular %haders

    T4M Te+ture $or Mo=i e + 29 94 Te'tures %hader o&timized for mo*ile

    T4M Te+ture Toon + 29 94 Toon %haders

    T4M Te+ture Bumped Mo=i e + 29 Te'tures (um&ed %haders for Mo*ile

    T4M Te+ture Bumped + 29 94 Te'tures (um&ed %haders# not Mo*ile o&timized.

    T4M Te+ture Bumped Specu ar Mo=i e + 2 Te'tures (um&ed %&ecular %haders for Mo*ile

    T4M Te+ture Bumped Specu ar + 29 Te'ture (um&ed %&ecular# not mo*ile o&timized

  • 8/10/2019 T4MTutorial

    11/35

    T4M Te+ture Bumped ;irectiona .i(htmap Mo=i e + 2 Te'ture (um&ed %hader for mo*ile and !irectionnal ightma&7om&ati*le

    T4M Te+ture Bumped ;irectiona .i(htmap + 29 Te'ture (um&ed %haders not for mo*ile and !irectionnal ightma&7om&ati*le

    5*@*5 Shader Mode 5

    Some are the ame than Shader Mode 2 hader % =ut with =e t Gua ity and e imit*

    5*@*4 7u tom Shader

    The T4M is com&ati*le with all UnityTerrain shaders# and you can use your own shader too.

  • 8/10/2019 T4MTutorial

    12/35

    5*2 T4M Settin(

    Ma ter T4M /=ject # A T4M Master /*:ect is the alone o*:ect who can control the camera# /! and (ill*oard.Eou can have only 5 Master on the scene.

    If you have more than one T4M o*:ect# the &arameter can *e ad:usted only on the master.

    Scene 7amera # (y default the T4M will seek the Main 7amera on the scene# *ut you can use an other to seecorrectly the /!9(ill*oard or ayer7ull!istance.

    Acti>ate ./; + Activate9!eactivate the scri&t who control the /! /*:ects.

    Acti>ate Bi =oard + Activate9!eactivate the scri&t who control the (ill*oard /*:ects.

    Acti>ate .ayer7u ;i tance + Eou can use four differents distances of view for your o*:ects on the scene *y usingthe ayers. It>s a good thing for mo*ile &erformances.

    Ma+imum ;i tance o$ Hiew # if you have Activated the layercull!istance# you can ad:ust the distance *etweencamera and the o*:ects. "%ee + >>1or a =ood %tart with T4M>> &age)

    /n the screenshoot# all o*:ect who have +

    , >>7loseBiew>> ayer will hide if it at more than C of distance#, >>8ormalBiew>> ayer will hide if it at more than ;C of distance#

    , >>1arBiew>> ayer will hide if it at more than 2CC of distance#, >>(ack=round>> ayer will hide if it at more than 5CCC of distance#

    6hen you have finished your tweaking# you can click on >> 0pdate'' =utton

  • 8/10/2019 T4MTutorial

    13/35

    4 Painter

    4*@ Materia

    If you want &aint you must add materials# so we will see this menu first +

    (efore im&ort the te'ture# you must choice the ty&e "7lassic te'ture or %u*stance)+

  • 8/10/2019 T4MTutorial

    14/35

    7lassic Te'ture 7ase +

    6hen you click on >>Te'ture to add>> *o'# you have the te'ture window which will o&en.

    ?ust select one

    Add &lace it on list with U& arrows

  • 8/10/2019 T4MTutorial

    15/35

    e&eat that as many times as you want.

    8ow# you can modify the te'ture selection in >>Modify>> *o' if you want.

    If you use a *um& shader# the >>Modify>> *o' will *e like that. %elect one te'ture in the list# you will can add a*um& te'ture in >>Modify>> menu

  • 8/10/2019 T4MTutorial

    16/35

  • 8/10/2019 T4MTutorial

    17/35

    4*2 Painter

    4*2*@ Bru he

    To &aint# you can use a lot of differents *rushes# and you can add your own like that +

    In root F T4M F $ditor F (rushes# you have this list *y default

    To add a *rush# in your favorite 2! software create a ;4';4 image and draw your own *rush "!on>tforget to leave em&ty 5&' on each side)

    8ow save new *rush in 8= with name >>(rush53>> in the (rush 1older.

  • 8/10/2019 T4MTutorial

    18/35

    %elect it in Unity +

    In ins&ector configure it like that +

    7ongratulation# now you can use your own *rush

  • 8/10/2019 T4MTutorial

    19/35

    4*2*2 Painter Settin(

    ;i$$erent Painter Menu accordin( to hader

    2?5?4 te+ture di$$u e?=ump Shader with Specu ar

    Shader with more than 4 te+ture Wor d Projection Shader

  • 8/10/2019 T4MTutorial

    20/35

    Pre>iew Type

    7 a ic :te+ture pre>iew,

  • 8/10/2019 T4MTutorial

    21/35

    "o ow orma 7irc e "In some cases and some UB# you might want to use a solid ci rcle )

    "o ow orma Wire 7irc e "In some cases and some UB# you might want to use a 6ire ci rcle )

    /r you can Fide the pre>iew

    Bru h Size and Bru h Stron(er + I think you know that

  • 8/10/2019 T4MTutorial

    22/35

  • 8/10/2019 T4MTutorial

    23/35

    I P antin(

    7A0T&/ # Think to reacti>ate the ./;?Bi Board a$ter ha>e p ant one ./; or one Bi Board /=ject*

    Add to i t # %elect the o*:ect you want add to the list# and click on one arrow to add# like that +

    0nder the p ant i t% you can $ind one check=o+ and one i t =o+ $or each o=ject +

  • 8/10/2019 T4MTutorial

    24/35

    The 7heckBo+e allow you to &lant randomly each checked o*:ect. The T4M will alternate automatically the selected o*:ect*etween each checked o*:ect.

    The .i t Bo+e + If you have activate the ayer7ull!istance in the MyT4M menu +

    Eou can choice for each o*:ect# the layer you want use.

    In this case# the o*:ect with >>7lose>> value# will *e culled# *y T4M# at the value of >>7lose !istance>> in the MyT4M Menu " C m).

    -enera Settin(

    P ant Mode # Eou can choice if you want &lanting the o*:ect *y the tilt of terrain surface "1ollow 8ormal) or not "7lassic)

    .oca Size # If you want reduce or increase the value of the size of your o*:ect# *efore &lanting.

    Size Har* + andom value# to allow you to o*tain a varia*le size of each o*:ect you &lant from the local size. "C no varia*le size#C G the size will *e varia*le *etween the ,value and 0value)

  • 8/10/2019 T4MTutorial

    25/35

    C /ri(in 7orrector # to ad:ust the distance *etween the ground and the &ivot of your o*:ect

    7reate 7o ider + If checked# the T4M will create a mesh coll ider at the instantiate of your o*:ect.

    Static /=ject # Make a %tatic o*:ect# for the ightma& shadows# or Unity ro %tatic *atching use.

    -roup ame # 7reate a folder on the scene to grou& the o*:ects

    Spacin( ;i tance Menu

    To avoid to overlay multi&le o*:ects# and o*tain varia*le distance *etween each o*:ects.

    8andom Spacin( ;eacti>ate

    The green circle is the %afe Hone

    It ensures a minimum distance *etween o*:ects

    Too 7 o e

  • 8/10/2019 T4MTutorial

    26/35

    "ree to P antin(

    With 8andom Spacin( Acti>ated

    In this case# the (reen zone is always the safe Hone# the ye ow circ e re&resent the >> andom Instance Hone>> and the Ce owWire 7irc e is the andow !i stance calculate *etween >>%afeHone>> and >> andom Instance Hone>>

    At each &lanting# the distance will *e calculate randomly *etween this two values. The r sult is more realistic than use aconstant value.

    If a o*:ect# already &lanted# is in wire c ircle# you can &aint your new tree# *ut if it out of this zone# the T4M will instantiate thenew o*:ect.

  • 8/10/2019 T4MTutorial

    27/35

  • 8/10/2019 T4MTutorial

    28/35

    ''-'' and ''F'' Key # *efore click on the scene to &lant your o*:ect you can ad:ust the E rotation manually with this 2 keys +

    ''9'' and '' '' Key # This keys affect the E /rigin 7orrector# to ad:ust the distance *etween the ground and the &ivot of youro*:ect

  • 8/10/2019 T4MTutorial

    29/35

    I ./;

    I*@ ./; MA A-)8

    ./; Mode

    Ma 7ontro er # $ach /! o*:ects will *e managed *y 5 algorithm# so all /! change will *e a&&ear in same time# visualyis not the *est.

    &ndependent 7ontro # $ach /! /*:ects will *e managed *y itself# the /! change is more gradually and give a *est result

    7u in( ./; /=ject Mode

    Ma+ Hiew ;i tance # The T4M will *e culled the /! o*:ect *y %cri&t# *ut if the ayer7ull!istance is activated and that thedistance layer of the o*:ect is less than >>Ma'imum Biew !istance>> value# the Ma'Biew!istance function won>t have any effect# *ecausethe ayer7ull!istance will make the culling *efore the scri&t.

    .ayer 7u ;i tance # :ust let the ayer7ull!istance make the cull ing.

    Ma+Hiew;i tance

    This value is used with Ma'Biew!istance function# think to &ut a less value than ayer !istance value of your /! /*:ects# ifyou want use it.

    ./; 0pdate &nter>a in SecondeThis value is very im&ortant# *ecause it is the interval of the refresh status of /! o*:ects. (e care at too very small value# it

    can *e heavy for mo*ile

    ./; 2 and 5 Start

    /!2 %tart value is the distance you want change the /!5 /*:ects *y the /! 2 /*:ects + C to this value# only the /!5/*:ect will *e visi*le# after this value# the /!2 /*:ect will re&lace the /!5 /*:ect

    %ame thing *etween /!2 and /! + *etween /!2 value and /! value# it will *e the /!2 that you can see# *ut after/! %tart value# the /! /*:ect will re&lace the /!2

    A7T&HAT) Button7lick on it# to activate the /! function# the T4M will seek all /! o*:ect on the scene# to *e a*le to manage /! /*:ects.

    Think to reacti>ate it% when you wi p ant other ./; /=ject *

  • 8/10/2019 T4MTutorial

    30/35

    I*2 ./; 7/MP/S)8

    A menu to create a T4M com&ati*le /! o*:ects.

    ./; Pre$a= ame

    The name of the new /! /*:ect.

    ./; Me he

    ./;@ 7 o e # &ut the most detailed mesh here

    ./;2 Medium # &ut the medium detailed mesh here

    ./;5 "ar # &ut the less detailed mesh here

    ./; Setup

    P ace the Me h7o ider on thi ./; # ike said# choose one /! Mesh to &ut the meshcollider# or not.

    ./; Shader

    ew # 7reate a new material for this /! MeshA ready )+i t # 7hoose a material who e'ist in the &ro:ect# for this /! Mesh

    &n =oth ca e% you can modi$y the Te+ture o$ the materia and u e Su= tance materia too* =ecau e o$ ack o$ ''=ui din hader '' in the i t% rather pre$er to create the materia manua y =e$ore*

    Eou can use directly the %u*stances shaders too.

  • 8/10/2019 T4MTutorial

    31/35

    ./; @

    ./; 2

    ./; 5

  • 8/10/2019 T4MTutorial

    32/35

    After finishing the /! setu you can &ress on the >>7onstruct>> (utton.

    Eou can find your /! /*:ect here +

    In this case I haven>t create a new material# if i t the case# you can find the new material in the >>Material>> folder.

    ;, (I (/A !

  • 8/10/2019 T4MTutorial

    33/35

    1*@ Bi Board Mana(er

    7u in( Bi Board /=ject Mode

    Ma+ Hiew ;i tance # The T4M will *e culled the (ill*oard o*:ect *y %cri&t# *ut if the ayer7ull!istance is activated and thatthe distance layer of the o*:ect is less than >>Ma'imum Biew !istance>> value# the Ma'Biew!istance function won>t have any effect#*ecause the ayer7ull!istance will make the culling *efore the scri&t.

    .ayer 7u ;i tance # :ust let the ayer7ull!istance make the cull ing.

    Bi Board 8otation A+iThis value is very im&ortant# *ecause it is the interval of the refresh status of (il l*oard o*:ects. (e care at too very small value#

    it can *e heavy for mo*ile

    Bi Board 0pdate &nter>a in Seconde

    C A+i # ?ust turn facing to &layer with U& A'isorma Po ition

    0p Po ition

    A A+i # Turn facing to &layer with all a'is

    orma Po ition

  • 8/10/2019 T4MTutorial

    34/35

    0p Po ition

    Ma+Hiew;i tance

    This value is used with Ma'Biew!istance function# think to &ut a less value than ayer !istance value of your ( ill*oard/*:ects# if you want use it.

    A7T&HAT) Button7lick on it# to activate the (ill*oard function# the T4M will seek all (ill*oard o*:ect on the scene# to *e a*le to manage (ill*oard

    /*:ects.Think to reacti>ate it% when you wi p ant other Bi B/A8; /=ject *

    1*2 Bi Board 7reator

    Bi Board Pre$a= ame # The name of the new (ill*oard /*:ect.

    ew Bi =oard Type7 a ic T4M # 7reate a sim&le *ill*orad with a single &lane# to make grass for e'em&le

    7ut om # Im&ort your own geometrie to make the *ill*oard o*:ect.

    Bi Board Shader

    ew # 7reate a new material for this (ill*oard MeshA ready )+i t # 7hoose a material who e'ist in the &ro:ect# for this (ill*oard Mesh

    &n =oth ca e% you can modi$y the Te+ture o$ the materia and u e Su= tance materia too* =ecau e o$ ack o$ ''=ui din hader '' in the i t% rather pre$er to create the materia manua y =e$ore*

    After finishing the (ill*oard setu you can &ress on the >>7onstruct>> (utton.

  • 8/10/2019 T4MTutorial

    35/35

    Eou can find your (ill*oard /*:ect here +

    In this case I haven>t create a new material# if i t the case# you can find the new material in the >>Material>> folder.

    BoilJ K This is the end of the T4M Interface tutorial# I ho&e my english is not too *oring to read.

    %ee you soon# if you have others uestions.

    %t &hane >Azert2k> ?amin1rom 1rance L)