Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

► Terrain to Mesh ◄

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

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Yes, I will help you.

    Unlit shaders do not interact with light and lightmaps at all.
    One Directional Light has the same lightmap interaction as Unity built-in Mobile/VertexLit (Only Directional Lights)

    Mobile/Unlit (Supports Lightmap) shader that you use is very old (so cold fixed function shader), it has its own unique algorithm, but is limited to the only 1 texture.
    Terrain To Mesh will not support fixed function shaders, never. Technique is very old and will be removed by Unity soon.

    To help you, I've just submitted update v 1.46, that adds Lightmap Multiplier option to the One Directional Light shaders.
    Using 4 value will have about the same LM result as the unlit shader you use now.



    VacuumShaders - Facebook Twitter YouTube
     
  2. OcypodeStudios

    OcypodeStudios

    Joined:
    Aug 24, 2015
    Posts:
    6
    Thank you so much. I update now and try. You said Mobile/Unlit(Supports Lightmap) shader was very old. Can I ask you a simple question? Which one should I use for android with u5. Mobile/Unlit (Supports Lightmap) shader or diffuse or another one that is your idea. I will use with lightmap? Thank u again for the update of T2M package..
     
  3. OcypodeStudios

    OcypodeStudios

    Joined:
    Aug 24, 2015
    Posts:
    6
    Which is the best in terms of performance?
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    1. Unlit
    2. One Directional Light
    3. Legacy Shader
    4. Standard

    Even better to bake all terrain textures into one BaseMap, then you can use any shaders.



    VacuumShaders - Facebook Twitter YouTube
     
  5. LeeJiHoon

    LeeJiHoon

    Joined:
    Aug 4, 2016
    Posts:
    10
    I have a problem with mobile. (Galaxy s4)

    Example Scenes 1. SnowTerrain works well.

    However, the problem occurs in 2. Runtime.

    The terrain looks pink.

    I wasted time because of this.

    Help
     
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Example 2 scene contains:
    1. Terrain mesh.
    2. Run-time generated mesh (Converted_2x2_100) using T2M material.
    3. Run-time generated mesh (Converted_1x1_50) using Legacy Bumped shader.

    Which one of this is pink? and what Unity version are you using.



    VacuumShaders - Facebook Twitter YouTube
     
  7. LeeJiHoon

    LeeJiHoon

    Joined:
    Aug 4, 2016
    Posts:
    10
    2. Converted_2x2_100 <--- Pink
    3. Run-time generated mesh (Converted_1x1_50) <---- Only White

    Unity Version Unity 5.6.0b3
     

    Attached Files:

  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Unity beta versions are not supported. Use official releases e.g 5.5



    VacuumShaders - Facebook Twitter YouTube
     
    theANMATOR2b likes this.
  9. LeeJiHoon

    LeeJiHoon

    Joined:
    Aug 4, 2016
    Posts:
    10
    Last edited: Mar 2, 2017
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    UVs are in [0 ,1] range.
    Check your build settings, may be there is mesh vertex data compression enabled



    VacuumShaders - Facebook Twitter YouTube
     
  11. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hi,

    you don't really telling us why we should use this asset. Maybe you name in your description some use cases.

    If I understand it correctly, one terrain has 4 maps for different purposes. Two of them are in the scene and two of them are in files. My biggest problem is that the maps in the files will be changed/overridden at runtime. At the next start of the scene these two maps are changed (correct me, if this isn't true).

    4 Maps:

    - Height map (in file)
    - Splat Map (in file)
    - Tree Map (in scene)
    - Grass Map (in scene)

    I'm working on an RTS game where I want to change the splat map and the height map. Short version, I need some terrain deformation at placing buildings and also need some texture changes under the buldings and e.g. if the shot hit the terrain.

    If you change the terrain to mesh, then you have a copy of these 4 maps (in a way). I would then copy the terrain to mesh at starting the game, then I would play on this, change the mesh and texture. I guess I could save the mesh terrain for my saved games and if the player re-starts the scene, I copy again. So the terrain should be un-touched.

    Could your asset provide that what I wrote?

    Edit: ***Height, Splat, Tree, Grass all in TerrainData.
     
    Last edited: Mar 14, 2017
  12. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    555
    I would like to request the ability to move this asset anywhere in the project instead of just the root. It gets really messy and I prefer to put all of my asset store items in a folder called "thirdparty"
     
    mh114 likes this.
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Terrain To Mesh will convert any terrain into mesh, regardless used texture count or custom material.
    Converter works in editor and run-time.

    If you are using custom terrain shader and want it to be used on generated mesh then you will have to rewrite it to be compatible with mesh.

    As for deformations is its up to you. You can first deform terrain and then convert it to mesh or modify generated mesh (using script or custom shader).



    VacuumShaders - Facebook Twitter YouTube
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    All my assets are interconnected and I need some kind of 'root' for their flawless functionality. This 'root' is the main Assets folder inside project and all my plugins have to be there.
    E.g. Terrain To Mesh is connected to Encode To TGA and Curved World assets.

    Unfortunately what you are asking currently can not be done.



    VacuumShaders - Facebook Twitter YouTube
     
  15. WQ-Charles

    WQ-Charles

    Joined:
    Feb 27, 2017
    Posts:
    5
    Your plugin is very good, but I try to bake lightmap, the result is not perfect.There are many seams between in chunks.
    I think it is a question of uv2,or something else?

    Another problem, can support the chunk directly exported to obj?I want to editor the uv2 in Max
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      38.2 KB
      Views:
      523
    • 2.jpg
      2.jpg
      File size:
      18.7 KB
      Views:
      550
    • 3.jpg
      3.jpg
      File size:
      82.4 KB
      Views:
      540
    Last edited: Mar 18, 2017
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Do you use mesh compression? Seam should be fixed automatically when enter game mode.
    For individual mesh exporting you can use free obj exporters from the Asset Store.



    VacuumShaders - Facebook Twitter YouTube
     
  17. Kazuya-Chang

    Kazuya-Chang

    Joined:
    Feb 1, 2016
    Posts:
    2
    There are many plants(grass, tree, flower) on my current terrain. Do I need to replant them on a new mesh?
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Trees can be exported from original terrain. Grass will have to be replant on a new mesh.



    VacuumShaders - Facebook Twitter YouTube
     
  19. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    hi,
    I have converted terrain and trees,because when the player is far the main terrain is disabled and a low mesh of the terrain a bit lower than the terrain appears.When i am near the original terrain , the main terrain is enabled over the mesh and works , but , are the trees billboards ?if the mesh with trees that i have converted has the trees enabled, the polycount is really big, seems that they are not billboards.

    Another question.I have terrains with 10 and 14 textures, is possible somehow to generate all the splatmaps?
    thanks
     
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    T2M exports tree meshes from the terrain, not billboards. (BTW good idea for future update).

    T2M exports all splatmaps, but T2M material can blend maximum 8 textures using only 2 splatmaps. You can bake them all inside one Basemap texture.



    VacuumShaders - Facebook Twitter YouTube
     
  21. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Yes, i think because to use it as a far replacement of the terrain and trees would be usefull in multi terrain .Meanwhile there is an update with this feature, any idea how to convert the tree prefab in a billboard prefab somehow?anybody can give a suggestion on this?
    thank you
     
  22. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    642
    I'm pretty sure I understand this asset's functionality, but want to make sure. Will it allow me to convert a single terrain into, say, 9 chunks (meaning your asset would split the mesh into 9 tiles), and then spit out global diffuse, normal, etc. maps for each? It's not immediately apparent if this is the case.
     
  23. luis29vm

    luis29vm

    Joined:
    Oct 25, 2016
    Posts:
    164
    helo i have a huge terrain and I use the asset to convert to a mesh, al works very good, but my problem is that my terrain is split in 4 parts and went I test the terrain shows all 4 parts in the terrain, how I can fixs that? I want all terrain in 1 terrain, Than you.
     
  24. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    642
    Wait, does this asset require working in Gamma? I use Linear exclusively.
     
  25. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    642
    Hmm, I might make this more clear in your presentation/documentation. I distinctly got the impression that this tool would allow you to split the terrain into tiles while converting to mesh.
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Terrain can be converted into any amount of chunk mesh.
    All maps extracted from a terrain (splatmaps, heightmap, basemap diffuse/bump) are a single textures and not e.g. 9 textures for individual 9 chunk mesh.

    Basemap baking requires Gamma. You can switch back after baking it.

    Terrain is not split only generated meshes.



    VacuumShaders - Facebook Twitter YouTube
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    T2M does not combine terrains or meshes.



    VacuumShaders - Facebook Twitter YouTube
     
  28. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    Hi , is it possible for future version to add a min sea level, this way we could create mesh and exclude any terrain below sea level.
    Thanks
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    I think, no.
    You can export meshes in OBJ format and modify them for your needs.



    VacuumShaders - Facebook Twitter YouTube
     
  30. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    But TTM creates 16x Unity Meshes with 10k verts, but only one obj for the same terrain.
    Should it not create 16 obj as well?
    How would I replace mesh in each tiles?

    Thanks
     
  31. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    T2M OBJ exporter does not work with chunks, but only with one mesh asset with unlimited vertex count.
    Other meshes can be easily exported with free OBJ exporters that you can find on the Asset Store.



    VacuumShaders - Facebook Twitter YouTube
     
  32. gibmation

    gibmation

    Joined:
    Dec 1, 2014
    Posts:
    311
    So basically your obj exporter is useless for tiled terrains. Surely you can see how misleading this is.
    I understand you don't want to add an ignore height level.
    Perhaps then you could revise the obj export facility to create an obj per chunk.
    The reason ppl buy your asset is to make things easier for them, by adding an ignore height you save hours of work for them.
    Thanks
     
  33. Cuttlas-U

    Cuttlas-U

    Joined:
    Apr 11, 2017
    Posts:
    22
    Hi
    tnx for nice plugin;
    it helps me a lot cause my fps really become better from 220 to 310 and it a lot difference;

    but i still have 2 problems;

    1 - when i use the shader with 8 texture ( no diffrent wich one ) the whole texture wont work on terrain and its there but has no texture ;

    i did try shader with 5 textures and it works; i just dont know its shader problem or the texture ;

    2 - my second problem is in android test the textures look like pixels and its a bad thing :(

    i did search a lot for this and did some advice like reducing the resolution of textures or other thing but it still has problem;


    any way tnx for this plugin i like it :)
     
    Last edited: Apr 13, 2017
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Would you mind emailing me at vacuumshaders@gmail.com (with asset purchase invoice from the Asset Store).



    VacuumShaders - Facebook Twitter YouTube
     
  35. cyberwhip

    cyberwhip

    Joined:
    Jun 7, 2015
    Posts:
    9
    Can this conversion to mesh help to create a hole in mesh to add cave? I have the asset but haven't really looked at it yet. Any pointers to make a hole would be helpful.
     
  36. zwcloud

    zwcloud

    Joined:
    Mar 15, 2016
    Posts:
    341
    I'm afraid you will have to do that in 3D modeling software instead. Or try MTE. It can cut a hole in mesh vertically.
     
    Last edited: Apr 21, 2017
  37. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    315
    I may but this, but just want to make sure if will do what I want. I want to be able to convert a terrain, and it's associated textures into a mesh with a material. Essentially I want to reproduce my current terrains, and have them look close to the original as possible. I'd like to have this functionality so that I can scale and rotate the terrain in the game. Strangely, there seems to be no way to rotate a Unity terrain, and scaling them also doesn't seem to work very well (if you scale a large terrain to a small size, the geometry changes drastically).
     
  38. JecksonLiu

    JecksonLiu

    Joined:
    Nov 25, 2016
    Posts:
    6
    Hello, I would like to ask this after the draw draw with the number of face will be a lot of Well?
     
  39. crypt0

    crypt0

    Joined:
    May 25, 2015
    Posts:
    55
    Good morning together,

    @Arkhivrag Do you have an idea, why I can't baked lightmaps? It's getting stuck at 5/11 Clustering | 1 Jobs. When I activate my original Terrain, it works fine. For testing, I have only the TerrainMesh activated in the scene. I will add a screenshot.

    terrain_mesh_bake.png

    I don't understand whats going wrong... with the original Terrain, it takes 3min for baking.

    Cheers
     
  40. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Can not be T2M problem.
    May be game object scale does not equal to 1. Unity has problems calculating lighting for such objects.



    VacuumShaders - Facebook Twitter YouTube
     
  41. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    114
    Hi, do you have a video example of convertion of terrain with trees ?

    How is the LOD of trees managed after de conversion ?
     
  42. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Have no video, it's just a one button click 1sec process.
    From terrain are extracted original tree prefabs. There is no LOD.



    VacuumShaders - Facebook Twitter YouTube
     
  43. Favor_89

    Favor_89

    Joined:
    May 15, 2013
    Posts:
    8
    Hi!

    I have the following problem: I want to use TerrainToMeshConverter static methods to achieve the same effect as while using Window->VacuumShaders->Terrain to Mesh->Generate. Unfortunately it looks like code implementing your editor mechanism is inside DLL. The only available reference script is RunTime_Terrain_Convertion.cs.

    While using my script (based on RunTime_Terrain_Convertion implementation) I was getting game objects that look good, however when I made prefab of them and dragged onto the scene again I saw the Mesh objects are missing. I improved my script to save each Mesh as an asset, which helped with Meshes, but now after making prefab and dragging onto the scene the terrain mesh is pink. I tried to create an asset from shared material, but then the mesh becomes black (because of some reason Control Map of shader becomes none).

    Could you please either tell me how to fix my issue or (the best) provide source code of generating Meshes by your editor mechanism?
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    So TerrainToMeshConverter static methods generates and returns converted mesh and then you are using your custom script for creating prefabs, mesh assets, materials and something goes wrong?

    I can only help with TerrainToMeshConverter method (if it does not work), but I can't with your custom scripts.



    VacuumShaders - Facebook Twitter YouTube
     
  45. Favor_89

    Favor_89

    Joined:
    May 15, 2013
    Posts:
    8
    Actually what I need is functionality of Window->Vacuum Shaders->Terrain to Mesh->Generate, but in code. I thought RunTime_Terrain_Convertion.cs is something like that, but it doesn't work if I want to make prefabs of generated terrain, and in case of Window->Vacuum Shaders->Terrain to Mesh->Generate it works with prefabs (all meshes and materials are saved as assets and hooked up well).
     
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    RunTime_Terrain_Convertion.cs script shows how to export everything from Unity terrain(meshes, textures, material). All you have left is save them as assets using AssetDatabase.CreateAsset, setup gameobject and finally create your custom prefab with PrefabUtility.CreatePrefab.



    VacuumShaders - Facebook Twitter YouTube
     
  47. aliakbo

    aliakbo

    Joined:
    Jan 28, 2012
    Posts:
    35
    Hi,

    I'm running into issues with the Unlit 8 Texture Shader from Terrain to Mesh. It works fine in the editor but is pink on some android devices. Any idea what might be causing this?
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,555
    Unlit 8 Texture shader requires 10 texture rasterization inside shader (8 paint textures + 2 control textures). Some mobiles just are too 'weak' for that.
    Solution: Reduce paint textures count inside terrain or bake them all inside one Basemap.



    VacuumShaders - Facebook Twitter YouTube
     
  49. aliakbo

    aliakbo

    Joined:
    Jan 28, 2012
    Posts:
    35
    Thank you, I changed the shader to a 6 texture shader and it worked perfectly on the device it was previously showing pink.
    Does this mean the 6 texture shader could show pink on lower end devices?
     
  50. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    291
    Hi @Arkhivrag , thanks for this useful asset! One feature request (apart from having it function outside root Assets): any chance for adaptive mesh simplification? So basically when you have lots of flat regions in the terrain mesh, reduce the amount of quads (probably just reduce the vertices and triangulate) on the flat parts where the extra vertices are not needed. I know this can be done with a modeling program using the OBJ-export, but I don't want to do that, complicates the workflow quite a bit.
     
unityunity