T4M Black Edition

Discussion in 'Assets and Asset Store' started by azert2k, Feb 14, 2012.

  1. larsbertram1

    larsbertram1

    Member

    Joined:
    Oct 7, 2008
    Messages:
    2,384
    hi there,

    a lightmapped unlit shader supporting bending and the necessary tweaks on Azert2k’s original palm model are done.
    dynamic batching is supported so all trees get drawn with just one draw call:

    $lightmapped_shader.jpg

    watch it in action: http://bit.ly/JalVNG

    lars
  2. Lars Steenhoff

    Lars Steenhoff

    Member

    Joined:
    Aug 7, 2007
    Messages:
    874
    Super cool! just what I was looking for!!
  3. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Hi,
    The link is broken, but great job :) I can't wait to try this !

    I'm not enough strong in shaders programming to make dynamic shaders, and I'm glad to see that.

    I believe I make an mistake, when I make the 2.0.5 version of my tool. I had modify the algorythm of the Unityterrain convertor to adapt correctly the brush projector, but it seems that before the Terrain Mesh converted had a best loading speed. I will make some tests on this, and if it's the case, I will make the modification to fix that.
  4. DanteFDV

    DanteFDV

    Member

    Joined:
    Mar 28, 2011
    Messages:
    10
    Hi,
    I've been testing the T4M demo for a while, but i'm having a few issues with the planting system. When i create the terrain I am able to plant some trees normally, but after i play the scene, select other objects and come back to add more trees, I cannot access the plant mode again. I was able to enter the plant mode only once after that. Any tips?
  5. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Wierd ! Don't worry, the next update will come soon and new demo (normally before this weekend)

    I keep you aware
  6. Lars Steenhoff

    Lars Steenhoff

    Member

    Joined:
    Aug 7, 2007
    Messages:
    874
    I have the same thing happening, looking to the next update
  7. DanteFDV

    DanteFDV

    Member

    Joined:
    Mar 28, 2011
    Messages:
    10
    Hey, i was wondering if the T4M tool has or plans to have a feature to 'slice' the terrain into smaller objects, keeping the UVs and the texture painter information?
    It would be extremely useful to avoid sending too much info to the GPU and can help optimize the terrain even more.
  8. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Not yet, I had try to make that but I failed... But it's a great idea
  9. nexxus

    nexxus

    New Member

    Joined:
    Dec 19, 2011
    Messages:
    2
    I made an environment in 3ds max and converted it to t4m and brushed on some textures. Everything worked like a charm but now later this day I noticed that I can't draw to geometry any more, neither can I place trees or bills whatever I try. If I open the tutorial scene I can start brushing to Volcano immediately but my own geometry doesn't respond to anything. There's no errors or anything it just doesn't work... Any help?
  10. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Hi Nexxus,

    Use you the full or demo version of T4M?

    Apparently, some people have a problem with the demo version...

    Anyway, I have some days of holiday so, I will make the update this weekend + new Demo version.
  11. Tiles

    Tiles

    Member

    Joined:
    Feb 5, 2010
    Messages:
    2,212
    I have updated to Unity 3.52 and am in the same situation than Nexxus now. I can`t paint the terrain anymore. The splatmap has read/write enabled. I can see the brush and the correct material at it. I can go across the geometry. But the brush simply doesn`t paint. At the end i get the sand clock that usually comes up when the painted pixels gets applied to the splatmap. And that was it. No result.

    And i get a NullReference Exception. Seems that the reimport caused by the upgrade has broken something.
    Last edited by a moderator: May 15, 2012
  12. DanteFDV

    DanteFDV

    Member

    Joined:
    Mar 28, 2011
    Messages:
    10
    Hey Azert2k,
    I managed to make a simple workaround to 'slice' the terrain in smaller parts.

    It's not pretty, but kind works: I created the terrain using the normal unity tools, converted it to T4M, then edited the resulting .obj into smaller objects and applied the T4M shader to each part at a time.

    Obviously this method has tons of downsizes like: Each slice used 1 draw call, there is no way to edit the terrain after the slicing, any change in the terrain mesh would require it to be sliced and have the materials applied again.And, since they are no longer T4M objects, you can't use any T4M features on them.

    If there was a way for the T4M tool to slice the .obj by itself, it would be amazingly helpful.
  13. Hero-

    Hero-

    Member

    Joined:
    Feb 17, 2012
    Messages:
    1
    Hey I vote too for this feature, but finish what you are working on now (and have some days off!),
    I can wait for next weekend (or next next) =)

    thanks!

    /H
    ps is there some other asset where they do just just this splitting/slicing that one can see how they solved it maybe
  14. larsbertram1

    larsbertram1

    Member

    Joined:
    Oct 7, 2008
    Messages:
    2,384
    hi there,

    i have tweaked the tree shader a little bit more, added a grass shader supporting bending and did a first test on a roughly modeled t4m terrain.

    $tm4_test.jpg

    the terrain uses directional lightmaps which means 3 textures plus 3 bump maps.
    all detail models are completely lightmapped plus baked in ambient occlusion (except for grass which is unlit) and use alpha test due to their complexity. the grass shader uses alpha blending.

    the number of draw calls (14–16) is not optimized at the moment:
    - i use a standard sky box (+4 draw calls)
    - trees and details like fern and nettles have their own material as i haven’t made a texture atlas yet, so they don’t get batched to a single draw call.

    the final number of draw calls should be around 8 – 10.
    but the number of vertices per frame is quite high: 8 – 18 k.
    i am not sure if lods would really help.

    the specs

    trees
    have been optimized for mobile
    spruce: 564 verts / 238 tris
    birch: 372 verts / 216 tris
    pretty heavy as the number of vertices is concerned but i need position, normal, vertex colors, uv0 and uv1 for the shader…

    details
    are more or less the same i use in my advanced foliage project for desktop
    fern: 204 verts / 140 tris
    nettle cluster: 1072 verts / 604 tris (uups)
    grass: 12 verts / 8 tris

    see the terrain in action:
    http://bit.ly/MhRKpI

    lars
    Last edited: May 16, 2012
  15. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Hi all, well, just one night for me, and a lot of requests ;)

    @Tiles / Nexxus
    Ok, no problem, certainly an incompatibility with the new Unity update, I will correct that very soon. Thank for warning.

    @DanteFDV / Hero
    Great Dante, if you can send me your codes, I will see that, I tweak it for T4M. azert2k@gmail.com
    Yes, each parts will give 1 drawcall like the UnityTerrain, its normal. But with that, I can make a Terrain LOD System :)

    @larsbertram
    Wow Amazing work ! I love that I see !
    Why I can't acces to the link ? Maybe becasue I'm at my work :) I will see that tonight
  16. Lars Steenhoff

    Lars Steenhoff

    Member

    Joined:
    Aug 7, 2007
    Messages:
    874
    Hi Lars I obsoletely love what you have made here,
    Any change I could use this shader ?
    will this be included in a new Advanced terrain shaders pack?
  17. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    I'm in holliday now (4 days), so I will make a lot of changes (maybe rewrite again the T4M)

    I just download the new version of Unity...

    Best Regards

    Stéphane

    EDIT : In fact, I don't have problem... for now...
    Last edited: May 16, 2012
  18. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    First Good news for next update :

    Before, the UnityTerrain converted by the T4M was loaded in a too long time (more than 15 sec), now the loading takes 2 sec. :)

    To be continued, tomorow.
  19. ThomQ

    ThomQ

    Member

    Joined:
    Nov 23, 2010
    Messages:
    285
    Hi

    Bought T4M yesterday.. I'm getting brilliant draw call reductions, and the tool works good! I'm very pleased :)

    I had two questions:

    1*) Am I correct that Billboards get de-activated whenever I start planting billboards?

    2*) How do I control the rotation at wich the billboards are being placed? I'm only used to using normal Unity billboards, wich places them always rotating towards the camera. With T4M i didn't find how to do that


    again, brilliant tool :)!
    Last edited: May 16, 2012
  20. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Hi, and thank a lot

    1) Yes, you right. But I think I will simplified that, for next version this weekend
    2) For now, you cant, because there are activated by an scripts, but don't worry I will try to fix that too.

    Best Regards

    Stéphane
  21. ThomQ

    ThomQ

    Member

    Joined:
    Nov 23, 2010
    Messages:
    285
    Thanks for the quick reply!

    We have some dev time to go, can't wait for nr2 to be implemented..

    Ow, and by the way, We are using EasyRoads as well, wich works just as fine with the unity terrain deactivated and replaced by a T4M terrain!
    I didn't get around to checking yet, but is it possible to import a heightmap to an already rendered T4M terrain?
    If so, that'll make a perfect workflow for T4M and EasyRoads: Build the roads on a unity terrain, import that terrain to t4m, and if you make changes to the road, import the heightmap into the T4M object, keeping splatmaps and vegetation the same. If it's not included yet, maybe a good feature for a future T4M version :)
  22. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    No, for now the T4M don't modify the geometrie, but maybe on the future updates (if I have more time) :)

    Yes, I know but the EasyRoad is based on UnityTerrain Heightmap, so I don't know if it possible...
    And yes it's a good idea :)


    I don't use UnityTerrain, because my convertor don't give a very good result sometime, I use earthSculptor Pro, the landscapes made with it are beautifull and with the Pro version you can export an optimized obj (low number of meshes, but very good quality) and import in Unity to paint/plant with the T4M.

    Best Regards

    Stéphane
  23. Tiles

    Tiles

    Member

    Joined:
    Feb 5, 2010
    Messages:
    2,212
    I have found the cause why my terrain became unpaintable for me. This issue is not caused by the upgrade to 3.52. I have changed the collidermesh because it needs to be different from the terrain for my needs. And then the terrain becomes unpaintable. No warning, no nothing, but the pencil doesn`t work then anymore. The collider mesh needs to be the same mesh than the terrain mesh, at least for painting mode.

    I´ve reapplied the original mesh and the terrain is paintable again :)

    I am not sure about the mentioned reference exception error though. Maybe it was coincidence, maybe it is really caused by the update. I have no idea. I will come back in case this issue happens again.
  24. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Last edited: May 17, 2012
  25. n8

    n8

    Member

    Joined:
    Mar 4, 2010
    Messages:
    147
    Just thought I would pop in and throw my 2 cents in on this. I am currently using t4m to create a very large terrain area to move around in. I went down a similar path as you but with a slight twist. I created an empty scene to work in and then created 16 unity terrains and laid them out in a grid with a naming scheme to match (i.e sector0-0, sector0-1). I then use the standard unity terrain tools to tweak each terrain till i got what I was wanting. I then use the terrain stitch tool from the asset store to make all of the edges line up. After all of the terrains are just how I want (with textures) I use the t4m tool to convert them, while telling the tool to keep my original terrain in the scene. Now I save off all of the terrains to prefabs and then set them up in my new scene.

    This solves a couple of your problems in that it lets you go back and tweak one of the sectors individually and then and just reconvert the terrain and then update the prefab. You still get the multiple draw calls, but with an occlusion culling system in place that can be mitigated. plus once you have the terrains converted you can adjust the scale to fit your project. This has worked for me so far, and there is probably other ways to do this. I still think there is a place for this kind of LOD tool in the T4M though.

    The one other downside that could happen in either of these workflows, is that after converting to T4M, depending on the quality that you select, you can end up with the edges not quite lining up correctly. At this point I am just covering up those cracks with props, but I am looking for better fixes to that problem.
  26. larsbertram1

    larsbertram1

    Member

    Joined:
    Oct 7, 2008
    Messages:
    2,384
    hi there,

    the work on the tree shader is progressing but right now i am looking for someone having a pro license for iphone/android (static batching is required…) willing to make some tests as far as performance is concerned.

    i would like to have 2 alternatives compared:
    a) using alpha testing (which is quite expensive on iphone/ipad) on a single mesh per tree
    b) using broken up models (in order to reduce visual artifacts) and alpha blending
    as broken up models would end up in a ridiculous high number of draw calls static batching is needed to combine the trees at runtime.

    if anybody is interested i could provide a unitypackage containing 2 different scenes for test purposes.
    just let me know.


    lars
  27. Lars Steenhoff

    Lars Steenhoff

    Member

    Joined:
    Aug 7, 2007
    Messages:
    874
    I have unity iphone pro
    iPhone 3gs and iPad 1.
  28. larsbertram1

    larsbertram1

    Member

    Joined:
    Oct 7, 2008
    Messages:
    2,384
    great. send you a pm.

    lars
  29. ThomQ

    ThomQ

    Member

    Joined:
    Nov 23, 2010
    Messages:
    285
    Great work Lars, if i had any mobile pro license, I'd be happy to test for you.. But I don't..

    Are you by any chance working on a free license version as well? :eek:
  30. larsbertram1

    larsbertram1

    Member

    Joined:
    Oct 7, 2008
    Messages:
    2,384
    the shaders work in both versions: free and pro, but as static batching will dramatically reduce the number of draw calls, it should speed up rendering pretty much.

    meanwhile lars steenhoff has done a first test:
    * 60 visible mesh trees + simple ground + custom skybox
    * 13.2 tris / 24.4 verts

    iPhone 3gs
    55 fps Alpha blending
    45 fps Alpha test

    IPad 1
    30 fps Alpha blending
    20 fps Alpha test

    lars
  31. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    THe same scenes with Unity Basic iOS/Android:

    Onda v610w (1Ghz, ICS)
    35/47fps Alpha blending
    58/63fps Alpha test

    iPhone 4
    More than 30 Alpha blending
    22/26fps AlphaTest

    The result is the same if you use classic transparent shaders on Mobile Devices, So, these shaders are very good and give you the wind effect.

    The transparents shaders are greatly not recommended on mobile devices, they are always heavy. But with future Unity Opimization and new mobile device, it will be a great advantage !

    Great work Lars ! (I know you don't have finish yet, but its very good !)

    EDIT: New OpenGLES1.1 Shader, now you can have 1 drawcall with lightmap + 2 textures
  32. Lars Steenhoff

    Lars Steenhoff

    Member

    Joined:
    Aug 7, 2007
    Messages:
    874
    I also used this script to get a higher frame rate than 30 in unity 3.5.2 .
    If you don't use this the frame rate is capped at 30.

    Code (csharp):
    1. function Start()
    2. {
    3.        
    4. }
  33. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Fine ;)
    I wondered where this was in the Xcode since last version...

    So, I will finish very soon the next update (sorry for late) :

    UnityTerrain Convertor:
    - Rewrited to avoid some problems with AssetImporter class
    Painter :
    - No more problem between "SHIFT" Key control and T4M control (for fast move)
    Update Menu :
    - Fix some problems
    Shaders :
    - 1 new Opengles 1.1 shader 2 textures + Beast lightmap in one drawcall (need to add the lightmap texture manualy in TexturesT4M Menu)
    - 1 new Opengles 1.1 shader 2 textures + External Lightmap in one drawcall(need to add the lightmap texture manualy in T4M Textures Menu)
    LOD/Billboard and LayerCulling (work in progress before the release)
    - Activate deactive LOD/Billboard preview in Editor Mode
    - No more need to Activat/Deactivate the LOD/Billboard after repaint a tree or grass.
    - Preview of LayerCulling in EditorMode
    Last edited: May 20, 2012
  34. gecko

    gecko

    Member

    Joined:
    Aug 10, 2006
    Messages:
    535
    I can't figure out how to plant trees. I somehow managed to do it once, but can't get it to work again. I select the T4M terrain in the hierarchy, then choose the Plant inspector, then click the first down-triangle under Add to List....and then what do I do? If I drag a tree mesh and drop it in the blue square, nothing happens, it is not assigned to that slot. If I drag and drop it into the prefab slot above the black down-triangles, it does get assigned there, and then if I click the black down-arrow, I get the pulldown LOD list...but I can't plant trees on the terrain, there's no planting-circle hovering over the terrain. I've read the manual but am not understanding how this works. Can anyone explain it to me in more detail? What am I missing?

    thanks
    Dave
  35. Tiles

    Tiles

    Member

    Joined:
    Feb 5, 2010
    Messages:
    2,212
    You select your tree in the None (Game Object) field. Then you need to click one of those black triangle buttons.This adds the tree into the slot. Then tick the checkbox below the tree. Haven`t found what the Close, Middle, Far and Background options are meant for. But when you load more than one tree into the slots, then you can paint with all selected trees at once, randomly.
  36. gecko

    gecko

    Member

    Joined:
    Aug 10, 2006
    Messages:
    535
    Thanks, Tiles -- but that's exactly what I'm doing, and the tree mesh never appears in the slot. I've got three or four assigned there (I guess they're assigned because I got the checkbox and LOD pulldown), but no tree is shown in the slot, and no planting-cursor appears on the terrain.

    Attached Files:

    • $t4m.png
      $t4m.png
      File size:
      36.8 KB
      Views:
      342
  37. Tiles

    Tiles

    Member

    Joined:
    Feb 5, 2010
    Messages:
    2,212
    Odd. Does it work in a fresh app?
  38. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Hi,
    Thank Tiles :)

    @gecko
    Wierd, maybe a broken object/preview... Can you show your selected object in inspector when you select it?
    Last edited: May 26, 2012
  39. gecko

    gecko

    Member

    Joined:
    Aug 10, 2006
    Messages:
    535
    Thanks for the replies. i figured out the problem -- I had set the T4M terrain to a different layer (necessary for other game functionality), and that of course broke the planting function. So I can set the layer back to T4M and do the planting. But does the terrain need to have the T4M layer at runtime, or is it okay to change it to another layer?
  40. gecko

    gecko

    Member

    Joined:
    Aug 10, 2006
    Messages:
    535
    Another question: If I add lots of trees, then I need to tweak my original Terrain and convert it to T4M, can I use the new T4M mesh with the already-planted trees, or do I need to start over? (Or rather, do I have to wait on tree planting until my terrain mesh is totally final?)
  41. Lars Steenhoff

    Lars Steenhoff

    Member

    Joined:
    Aug 7, 2007
    Messages:
    874
    @ gecko I think you have to start over, but I see your question and would like to see this too.
    Last edited: May 27, 2012
  42. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    @Gecko
    To plant the trees, you need to use the original layer(User Layer 30) of the T4M (I make a Raycast on this layer to plant and ignore all others colliders), but when you have finish your scene you can change it.

    Yes, you need to start over at this time, for now the converter support only to keep the splat textures, I think it's possible to keep the trees(like I made for splat textures), but I didn't try yet.
    Last edited: May 27, 2012
  43. megisto

    megisto

    Member

    Joined:
    Dec 25, 2009
    Messages:
    82
    I have just bought T4M and dowloaded it. Let's give it a try.
  44. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    Update :

    After a lot of tests, I can't integrate this feature, because performance issues :
    LOD/Billboard and LayerCulling (work in progress before the release)
    - No more need to Activat/Deactivate the LOD/Billboard after repaint a tree or grass.

    Reasons : the T4M seeks and assigns to an array all LOD/Billboard objects, all positions of objects and precomputed the first status between the camera and LOD objects . If I remove this, and make this process at start of applications, it can give a big laggy to make the same thing when you have a lot of trees.


    EDIT : Thank for buying Megisto, I hope you will like it
    Last edited: May 27, 2012
  45. megisto

    megisto

    Member

    Joined:
    Dec 25, 2009
    Messages:
    82
    Ok, looks promising. Here is my first questions:

    - I imported my mesh for conversion, but the mesh is too big, so Unity splt it. Can T4M manage terrain somehow as it is one (eg. for painting reason)?
    [edit because i SOLVED>]- in painter/material tab i only have four up arrow to add textures. In the tutorial i see you have many arrows. Can i add more textures slot?
    [edit because i SOLVED>]- how can i add bump? I can only see diffuse

    thank you
    Last edited: May 27, 2012
  46. tripknotix

    tripknotix

    Member

    Joined:
    Apr 21, 2011
    Messages:
    533
    ok can you please move the Activate/Deactivate option to the billboards menu then, at the bottom, so its very clear that it has been turned off, and make it easier to turn it back on.
  47. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    So,
    When unity slit the mesh, the T4M can using each parts like a single to paint/planting.

    You need to choice an shader in the MyT4M tab and apply before. The slots appears automatically (depend of the shader)
  48. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    @Tripknotix
    Can you make me an picture please and I make that
  49. Tiles

    Tiles

    Member

    Joined:
    Feb 5, 2010
    Messages:
    2,212
    What about an optional feature? So that the user can decide if he will use it?
  50. azert2k

    azert2k

    Member

    Joined:
    Jan 11, 2009
    Messages:
    664
    I will see that ;)

    Edit : LayerCulling, LOD, Billborad preview works fine.
    Last edited: May 27, 2012