Search Unity

► Terrain to Mesh ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Oct 1, 2015.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Basemap is 'final texture' you see on terrain. It is only one texture and its takes only one texture sampling and one pass inside shader. While Unity terrain needs multiple rendering passes with multiple texture sampling.
    Splatmap is RGBA type texture used by terrain for texture blending. For each 4 textures blend is used one splatmap. Terrain To Mesh includes special shaders to use splatmaps, they can blend max 8 textures in one pass of rendering.

    Here is example video of exporting map from terrain:




    VacuumShaders - Facebook Twitter YouTube
     
  2. Vegaaa

    Vegaaa

    Joined:
    Mar 12, 2014
    Posts:
    3
    Thanks. One more question, in this vídeo you show a Mesh Materializer window to export the textures, i have this same feature in Terrain to Mesh right?
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Terrain To Mesh is part of Mesh Materializer.
    Terrain To Mesh is up-gradable to Mesh Materializer.



    VacuumShaders - Facebook Twitter YouTube
     
  4. tapticc

    tapticc

    Joined:
    Jan 16, 2014
    Posts:
    365
    Hi, is it possible to take a terrain with texture applied and export to OBJ with the tris having a material id set? The reason I ask is I would like to use PBR materials on the mesh :)
     
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Exported obj file doesn't include material, but you can export material separately with Basemap or Splatmap.



    VacuumShaders - Facebook Twitter YouTube
     
  6. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    13
    Hello,

    I am having trouble with textures. I exported terrain to mesh, and import textures properly, but in the game my textures are pixelized. This is a really strange behavior, I don't have any clue what to do, so please help me!
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    I have fixed that bug and already submitted update v1.21



    VacuumShaders - Facebook Twitter YouTube
     
  8. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    13
    That's great news man! Ok, currently I see v1.2, so probably update will be submit very soon...
     
  9. SteveRyu

    SteveRyu

    Joined:
    Apr 9, 2014
    Posts:
    121
    Hi,
    Is there any plan to add terrain grass to mesh feature?
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Currently no.



    VacuumShaders - Facebook Twitter YouTube
     
  11. jonayoung

    jonayoung

    Joined:
    Dec 4, 2013
    Posts:
    3
    Hi I bought this plugin for a project we are doing. Seems like it is a great plugin! But in our case it did not work. It was unable to export the splat map and base map so we have changed our workflow to adjust accordingly. It came up with a warning saying "Terrain does not use any diffuse or normal textures." and instead a blank standard material is created in the temporary folder. I noticed that the material on the Terrain object I am trying to convert does not seem to reside anywhere in the project so perhaps it is a Material object which has been generated. Also the shader is some custom shader not a standard one. Anyway, as we have changed our workflow we no longer require the plugin so I would like to request a refund. Is this the right place to do that?
     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Basemap is a collection of Unity Terrain paint textures baked into one final texture.
    Splatmap is Unity Terrain texture used for paint textures blending (for each 4 textures Unity Terrain generates 1 splatmap).
    If terrain does not use paint textures - means that it has no Basemap and Splatmap - nothing will be exported.

    Refunds are done only if tool does not work and contains unsolvable bugs.
    It does not work with - I do not need it any more.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Apr 21, 2016
  13. jonayoung

    jonayoung

    Joined:
    Dec 4, 2013
    Posts:
    3
    Okay so the issue is not "I do not need it anymore". There is a gray area about splatmaps and basemaps. The shader which is used on the terrain appears to involve a splatmap and basemap. However it does not show up in the terrain object so I assumed it was being hidden under the hood somehow. The terrain was generated using the World Creator plugin. Seeing as I do not have access to World Creator's source code it was hard to tell what was going on. I took a chance because we have time constraints and got your plugin to see if it worked and it didn't. So it is hard to tell if your plugin is unable to access the splatmap and basemap under the hood (if that is what is going on) or if World Creator has some bespoke solution which is actually incompatible. In other words it is hard to tell if it is intended behaviour or a bug. Is it really that big an issue to get a refund especially when there is a gray area such as this?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Paint textures used by terrain define its splatmaps and basemap that current tool can export.
    If terrain does not have paint textures - means that it has no Basemap and Splatmap - nothing will be exported.
    Untitled-1.png

    It's really big issue to give refund in such case - where tool actuality works and has no problems - and only explanation you give is that you didn't know what Basemap or Splatmap means, and how your terrain was using them (it seams that your terrain does not have any of them, because of using custom rendering system).

    Refund does not work with - "I did not know" something. You must know.
    If I give you refund almost everyone can just copy/past your text and ask for refund.
    I hope you understand.



    VacuumShaders - Facebook Twitter YouTube
     
    theANMATOR2b likes this.
  15. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    Hi! I recently stumbled upon this and have a usecase where I am unsure if it will work with your asset, so hopefully you can bring in some clarification.
    We use on our terrains 8 splatmaps, gras and Speedtrees everything set up with the standard terrain tools and a prepass via Terrain Composer. No custom materials/shaders anything else on terrains.
    Now the question: If I run terrain to mesh over a terrain what is going to happen? What do I lose? What does the Tree Extractor do?
    Or in short: Will I end up with a bunch of chunks, gras game objects and Speedtrees as geometries instead of terrain objects? Or will something be lost?
    Point of my question is that I start to hate the terrain solution of Unity because it is clumsy, causes a s**t load of drawcalls and culling is breaking your neck on a regular base. So I need a solution to get rid of them but without flushing our hundreds (!) of terrains down the drain.

    Best regards
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    1. Terrain To Mesh can extract all 8 splatmaps as separate textures (if you need them).
    2. Package includes shaders that can render textures same as terrain does, but only in one pass (limited only by 2 splatmap)
    3. If #2 does not give desired result then all used paint textures can be baked into one final Basemap texture.
    (#1, #2, #3 work only with built-in terrain rendering system - no custom shader support).
    4. Extracted trees will be saved as one prefab (referencing to original tree meshes used with terrain). Of course exactly in the same position/rotation/scale as they are on terrain.
    5. Grass and detail mesh can not be extracted (they will be lost).
    6. You control chuck and vertex count of the converted mesh.



    VacuumShaders - Facebook Twitter YouTube
     
    toxtronyx likes this.
  17. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    Thanks for the clarification. Unfortunately we can't lose the gras. Regarding Point 4. so the SpeedTrees will still work with all those nifty features like wind and stuff?
    And last but not least if I chose a density that is somewhat equal to current highest LOD of the terrain how is the performance in comparison?
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Extracted trees will work with wind.
    All trees from terrain are extracted, density parameter is not taken into account.



    VacuumShaders - Facebook Twitter YouTube
     
  19. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    Yep I've seen that in your vids. Sorry for bothering you with the details. I just want to make sure that it will help me. I mean its ten bucks but will take time to try and find a workaround for the details problem.
     
  20. korbain

    korbain

    Joined:
    Sep 11, 2013
    Posts:
    5
    Hi there, Just bought the tool. It works well and is well documented. I have a small request. In your next version, could you add an option to change the pivot of the terrain to the centre (instead of the corner)? I need to rotate my terrains at runtime and because of this, I need to add a dummy game object pivot to all my terrains as a workaround. Thanks for considering.
     
  21. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    2,645
    Bought this months back and am trying a conversion test today. Clicking Generate does nothing except turn the Prefab name back to red.

    Settngs
    Export Maps checked -> Splatmaps one file RGBA
    Export Unity Mesh checked -> Chunk Count H=1 V=1, UV, UV2, Normal, Tangent ->Vertex Count H=32, V=32 (original is a 1025 Heightmap generated terrain

    Tried a number of different settings and the same thing happens. Click Generate and the Prefab Name returns to a red field. Tried it with a new terrain object and the original Terrain Asset as the terrains I need to convert are created as a prefab using Real World Terrain. I am using Unity version 5.3.5f1
     
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    If previously generated prefab is removed from project then prefab name in Hierarchy window will turn to red.
    Solution: Delete prefab with lost connection from Hierarchy window too.

    Do not use Real World Terrain and do not know what it's doing.
    Terrain To Mesh works with Unity terrains.

    Still do not understand your problem, may be capture video or provide some screenshots.



    VacuumShaders - Facebook Twitter YouTube
     
  23. asimov99

    asimov99

    Joined:
    Mar 13, 2015
    Posts:
    54
    Hi

    I would like buy your asset terrain to mesh for optimize performance in my game. I have a unity terrain with 8-10 textures.

    In your videos, we can't see the performance optimization with compare unity terrain and your asset.

    It's possible to see a video with terrain unity with 8 textures, trees and wind with stats performance and after, with your mesh, and trees mesh and wind?

    Thanks :)
     
  24. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    206
    Feature request please as I can not modify the script unfortunately. :(

    LOD Unity export, 3 levels all at different details levels with the appropriate appended string e.g. _LOD0 , _LOD1 etc. Or even better just set it up for me completely, it's kind of handy without the appended strings that will tell Unity to do it on import. ;)

    It would save me renaming 1024 tiles. Not major but could be a nice time saver. Thanks.
     
    Last edited: Jul 29, 2016
    transat likes this.
  25. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    443
    What happen with the last version on Unity 5.1.5?

    Convertion failed :(
    Could not load type 'UnityEngine.StackTraceLogType' from assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
    UnityEngine.Debug:LogError(Object)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:Draw_GenerateButton(Boolean)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:OnGUI()
    UnityEditor.DockArea:OnGUI()
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Exported mesh performance depends on its vertex count, tool has vertex count controller so it's up to you.
    Trees - there are exactly same tree prefabs used by terrain engine.
    Wind - trees use their own shaders where wind is calculated.

    Added to wishlist.

    Only Unity 5.3.x and 5.4.x are supported.



    VacuumShaders - Facebook Twitter YouTube
     
  27. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    443
    With your previous version that works fine, so I use only a older version
     
  28. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    237
    @Arkhivrag
    Hi, Is it possible to add mesh compression option to exported mesh. Right now i do not see much difference size wise when exported Obj. Thanks
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    There is no compression for OBJ files, its for exporting mesh into external 3d modeling software and from there you can save it binary format like FBX.



    VacuumShaders - Facebook Twitter YouTube
     
  30. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    237
    Yea but generated mesh asset can have mesh compression to save space using Mesh Utility
     
  31. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    I forgot about that tool. Add to wishlist.



    VacuumShaders - Facebook Twitter YouTube
     
  32. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    237
    Cool. Will be waiting for it. Wanted to do it myself but the source code for this is bundled in DLL.
     
  33. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Looking at this now. Now sure why we cant use chunk sizes of 256x265. That would be 65,536 vertices which conforms to the unity mesh limit. The message suggests you are checking against 65,000 instead, which means you limit your chunks to smaller than necessary.
     
  34. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    I use this plugin and now can optimize terrain completely
    All unity shaders has a big problem with Tiling o n Mali400!!! spatially terrain and detail shaders
    my shader can solve this completely on Mali400 GPU s
    I move tiling proces from pixel shader to vertex shader and solve this problem(i read this from Unreal Engine 4 Doc)
    Download Shader :Link

     

    Attached Files:

    Last edited: Jun 15, 2017
  35. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    Another great solution for optimizing terrain and other Objects, is Per-Layer Camera Clipping plugin

    Its not only hide Game Objects, Its also reduce draw calls in fast way.
    you can create 4-12 Chunk terrains and cull by distance. I test it and work Perfectly!!!

    below test is only on Game objects, not terrain
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Update will be available next week.



    VacuumShaders - Facebook Twitter YouTube
     
  37. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    v1.4 released.
    Generated mesh asset files can be optimized for faster rendering and smaller file size.



    VacuumShaders - Facebook Twitter YouTube
     
    sathya and Mayureshete like this.
  38. niandrei

    niandrei

    Joined:
    Sep 1, 2016
    Posts:
    3
    Hello!

    First of all, great plug-in! I have a problem with a Unity terrain modified by Easy Roads 3d. Your plugin converts the original terrain to mesh, not the one modified by Easy Roads. Is this a bug or your plug-in doesn't work on that type of (modified) terrain?

    Thank you.
     
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    No problems with 'modified' terrains. Seems you are doing something wrong or missing some step.

    Unity terrain modified by EasyRoads
    Or.png

    Converted mesh
    me.png



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Sep 1, 2016
    niandrei likes this.
  40. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Hi Thanks for the recent changes adding optimize and compression optimize they help alot!
    I have a question, Is there anything that can be done to reduce the seams when using chunking?

    Maybe the plugin could make the verts along edges match up between the different chunks.

     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Can you send me that terrain asset and settings you are using?



    VacuumShaders - Facebook Twitter YouTube
     
  42. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    514
    Hi,
    I'm interested in buying the asset but I have a few questions.

    - seeing the above screenshots with easyroads3D, it seems after conversion it looses the indents easyroads creates along the road, is it related to the converted mesh resolution (vertex count) ?

    - I have a big terrain (1 piece, 3km x 3km) with a quite high heightmap resolution (1025), and I plan to convert it to a splitted mesh with your asset (4 x 4 chunks maybe). Will I loose heightmap details ?

    What is worying me the most is that my road made with easyroads perfectly matches my terrain without raising it of a single centimeter, and I'd like it to perfectly match the mesh after converting it to a mesh (let's say raising the road to 2-3 cm is Ok).
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    There is one answer on all your questions - vertex count control system - more vertices you use more detailed will be resultant mesh.




    VacuumShaders - Facebook Twitter YouTube
     
    jimmikaelkael likes this.
  44. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    514
    Thank you very much for the quick answer ;)
    My wallet is ready :D
     
  45. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Thanks for quick reply OK, here goes....


    I've narrowed it down the new Mesh Compression. It only has this issue if you use "High".
    I will just avoid using High compression as there is no issue with Medium. I guess that's just a side effect of using High compression.

    Terrain asset:
    https://www.dropbox.com/s/hih6ikjd2tnvnfy/Market 00 Terrain.asset?dl=1

    Settings are:
    Export Map:
    Splat: PNG
    Base: None
    Hight: None

    Export Unity Mesh:
    Chunk Count H: 10
    Chunk Count V: 10
    Vert Count H: 15
    Vert Count V: 15
    Optimize: On
    Mesh Compression: High (Medium and lower seems fine)
    Attach Collider: On

    Something to note, the seams don't appear until you close the scene and reopen it.
    I'm guessing that's when unity applies the compression?

    Just after generation, all seems fine:


    After reloading the scene:

     
    Last edited: Sep 1, 2016
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Update v1.41
    • Includes run-time CompressedMeshLoader script fixing visible seams on high compressed chunks in Game mode.
    Component is automatically added by T2M converter to the mesh prefab (parent).
    • Optimize option is not necessary any more, removed.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Sep 2, 2016
  47. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    Excellent! Great job amazing turnaround there. I'm extrememly grateful.
    What's the overhead on the script? It's compiled so I can't see what it's doing.
    Is it just doing things during load or is it doing things during update?

    It does have an error though when I run my scene:
    Seems to happen when I mark as "Static" which I need to do for lightmapping, NavMesh baking & occlusion.

    CompressedMeshLoader: Total vertex count is not correct.

    UnityEngine.Debug:LogError(Object, Object)
    VacuumShaders.TerrainToMesh.CompressedMeshLoader:Start()​


    Thanks!
     
    Last edited: Sep 2, 2016
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    No overhead on script, it just matches compressed chunk edges in Start() function. That's all.
    Chunk and Vertex count must be the same as there were in T2M editor during conversion (to know exact chunk position and vertex count in it). Yes, marking it as static may be problem as overall vertex count that script works with will be different.



    VacuumShaders - Facebook Twitter YouTube
     
  49. pixxelbob

    pixxelbob

    Joined:
    Aug 26, 2014
    Posts:
    111
    @Arkhivrag unfortunately we're having issues with the runtime seam script.
    We've deployed a version of our game to our Android tester and alot are getting the vertex count error

    CompressedMeshLoader: Total vertex count is not correct.
    This is despite me making sure the terrain is NOT static.

    Is there no way this process can be done at the point the mesh assets are created?
    Thanks
     
  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,193
    Prefab with CompressedMeshLoader script must contain only terrain(mesh) chunks. If you add some additional meshes inside script will not work.

    Compressed mesh asset is created by Unity, script only fixes 'damaged' compressed edges.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Sep 7, 2016