Search Unity

► Terrain to Mesh ◄

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

  1. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    Hello @Arkhivrag, Terrain To Mesh is saving me a lot of time. Thank you for making it so fabulous.

    I am having trouble with the trees conversion, however.

    I am converting 400 terrains with thousands of trees across them. The trees are SpeedTree, but I have tuned them for performance. When Terrain To Mesh runs, it triggers a re-import grabs the original prefab (or something I am not really sure). Anyway, I would like to be able to have a way to specify which tree prefabs it uses when generating the meshes with trees.

    Best regards,
    Tony
     
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Yes.

    No. Only baked shadows.



    VacuumShaders - Facebook Twitter YouTube
     
  3. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    321
    fine... HOW?
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Included shaders support maximum 8 paint textures blending using 2 Splatmaps. You can not use 4 Splatmaps.
    You can bake all textures into one Basemap.
    From just an image it is difficult to help you, use support e-mail: vacuumshaders@gmail.com


    Grass and detail meshes are not saved inside Terrain asset and can not be exported. They are generated by Unity.
    Adding that feature (not planed for now) means to manually generate and instantiate millions of game objects into a scene (you do not count Grass and Details when drawing them on terrain, do you?). And without Unity Terrain LOD system again. Do you really need this?


    All trees are exported. They are original prefabs and have no Terrain LOD system.


    Just drag and drop terrains into converter window. You can even drag entire folders and editor window will manually parse them to find terrain assets there.



    VacuumShaders - Facebook Twitter YouTube
     
    MaximilianPs likes this.
  5. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    I have done the T2M conversion with trees twice now, and that is not my experience. I am getting trees with LOD system and Rigidbodies and it is killing performance.
     
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    LOD system can not be exported as it is Unity terrain feature and can not be applied to the mesh.
    However, if original prefab (used as tree inside terrain), has it's own LOD system with Rigidbodies and other components, then of course, they will be exported too, as they are part of original prefab.



    VacuumShaders - Facebook Twitter YouTube
     
  7. LunguM

    LunguM

    Joined:
    Jul 19, 2012
    Posts:
    17
    With Unity 2018.1 when I try to compile I get this error :

    Shader error in 'VacuumShaders/Terrain To Mesh/One Directional Light/Bumped/4 Textures': '' : 'UNITY_PASS_FORWARDBASE' already defined at line 46 (on gles)
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Fixed. Download new version.



    VacuumShaders - Facebook Twitter YouTube
     
  9. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    83
    I just bought the asset and it is amazing. I got it as part of your Mesh Materializer asset. I am using to convert MapMagic generated terrains into meshes, and i particularly found of being able to get the textured material out. MapMagic is compatible with CTS, Complete Terrain Shader and although i read the note "Basemap baking works only with Unity built-in terrain shaders.", by any chance could you confirm that CTS would not work? It is on sale and would grab it if it works just fine. Thanks!
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Custom terrain shaders can not be baked.
    Reason: I have to include those shaders inside my package and it will be copyright infringement.
    CTS is custom terrain shader.



    VacuumShaders - Facebook Twitter YouTube
     
  11. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    83
    Thanks, just wanted to make sure, i am quite new to terrain stuff.
     
  12. Ali_unity

    Ali_unity

    Joined:
    Jul 22, 2015
    Posts:
    7
    ConvertedToOBJ.JPG Unity_Terrain.JPG Hi, I have roads on top of my terrain and when I convert a terrain to OBJ mesh , my roads looks messed up, what I need is the exact number of tris/verts to match the roads. Is it Possible ? I tried increasing the numbers of verts/tris but no solution, Please check the Uploads
     
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    In your case I can suggest to increase the exported mesh vertex count.



    VacuumShaders - Facebook Twitter YouTube
     
  14. spoutnix

    spoutnix

    Joined:
    Dec 12, 2015
    Posts:
    8
    Hi Davit,
    1 : I just test for the 1st time T2M to get a splatmap from terrain, the thing is I was able to see the PNG file fine inside Unity but it is a blank PNG file outside Unity... is it a 2018 bug? So I bought the TGA encoder, then I was able to get the TGA fine outside Unity. Hum...
    2 : Newb question, how to reimport/re-assign the modified TGA/PNG splatmap texture to my terrain ?

    Thanks in advance for your response and your very nice tools !
    Olivier
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    1. Splatmap texture is exported in RGBA format. Most image preview/editing apps read PNG file's Alpha channel not as separate channel but as Transparency. So if Alpha channel is empty you may see 'blank' image even it contains RGB data.
    TGA format stores Alpha in separate channel.
    2. Terrain To Mesh does not offer such feature.



    VacuumShaders - Facebook Twitter YouTube
     
  16. LunguM

    LunguM

    Joined:
    Jul 19, 2012
    Posts:
    17
    I've run into an old problem once more. Though at this point I'm not sure if its an issue with the fact that I didn't upgrade further from Unity 2017.3.0f3 (due to some issues with shaders when going to 2018 versions) or if its just something related to how the T2M shaders works.

    On Android devices, versions 4.4 and 5.0, the terrain does not render when using Standard/Diffuse/7 and 8 Textures and the same issue happens when using Legacy Shaders/Diffuse/7 and 8 Textures. I have a terrain that uses 4 textures and that one rendered (Standard/Diffuse/4 Textures) however the terrains that require 7 or 8 textures do not render.

    Also, another strange thing happened: The textures assigned to the material swaped placed between each other. I don't know how or why but after converting a new terrain with T2M all my old terrains had their materials switch their textures around.

    Looking through the Logcat I get this when the terrain is supposed to appear if I'm not mistaken on the timeframe:

    GLES20: vprog textures are used, but not supported.
     
    Last edited: Jul 19, 2018
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    It may be due to hardware limitation when certain GPU can not rasterize more then several textures.
    T2M shaders with 8 textures need 10+ texture rasterization (8 paint textures + 2 control textures + some Unity textures like shadow or light maps). Your device just can not work with so many textures.
    Solution: you have to reduce texture count.



    VacuumShaders - Facebook Twitter YouTube
     
  18. LunguM

    LunguM

    Joined:
    Jul 19, 2012
    Posts:
    17
    Thing is that when I set the Editor to Gles2.0 the same thing happens. The terrain has 7 textures and all other terrains have 8.

    Also, in the Editor with 2.0 activated, if I use only 6 textures the terrain renders but the last 2 textures (of the 2nd controller) will be black. With max 5 textures its alright but insufficient for what I'd like to have.

    blackspot.jpg
     
    Last edited: Jul 20, 2018
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    That's right. GLES 2.0 supports 8 textures only. If you use emulation inside editor there will be warning inside Log window telling you about that.
    T2M shader with 6 textures needs 8 rasterization (6 paint maps + 2 control textures), and Unity may add some more textures for shadow or light maps, so that one mesh in the end may need 8+ textures. GLES 2.0 does not support more than 8 and rendering will fail.
    Solution: reduce used textures count on terrain or change build target.



    VacuumShaders - Facebook Twitter YouTube
     
  20. LunguM

    LunguM

    Joined:
    Jul 19, 2012
    Posts:
    17
    That's a shame ... I've gone ahead and changed all my levels to have only 6 terrain textures since I really need to include 4.4 and 5.0 in the build to not lose out on 30% of the market. Terrains looks underwhelming but I'll just have to live with it.

    On a side note, for some reason only One-Directional and Unlit works with 6 textures, the others work only with 5 and less. I'm asuming that's because Unity is adding more to the list.
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Next week I'll update T2M shaders with new fallback shader, that will automatically change shader from multi-texture T2M shader to one BaseMap texture render shader guaranteed to be executed on all devices including GLES 1.0 :)
    But for that you will have to bake BaseMap too.



    VacuumShaders - Facebook Twitter YouTube
     
  22. LunguM

    LunguM

    Joined:
    Jul 19, 2012
    Posts:
    17
    Oh sweet, luckily I backed up the old terrains so I will be able to recreate them if needed.
     
  23. acrossthestars

    acrossthestars

    Joined:
    Oct 17, 2017
    Posts:
    10
    Is it possible to blend 12 textures via 3 control maps ? ( theory question ). As for the asset - supperb tool !
     
  24. acrossthestars

    acrossthestars

    Joined:
    Oct 17, 2017
    Posts:
    10
    Or in that regards 8 bumped diffuse textures ?
     
  25. amit-chai

    amit-chai

    Joined:
    Jul 2, 2012
    Posts:
    80
    Hello! I am using your asset with LW Render Pipeline. It is working only with Unlit Shader. I want to bake the scene so is there any other option?? I can't use the LW materials, only Vaccum. Thanks!
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    It is possible but such shaders will mostly do not work on mobile devices, while this asset is mostly for mobiles.


    SRP are not supported yet.



    VacuumShaders - Facebook Twitter YouTube
     
  27. bgrz

    bgrz

    Joined:
    Mar 22, 2015
    Posts:
    59
    I found out that
    TerrainToMeshConverter.ExtractBasemap
    and
    TerrainToMesh_EditorWindow.ExtractBasemapInEditor
    give very different results. Is this a bug or there's a reason/use-case for it?
     
  28. Balmyrian

    Balmyrian

    Joined:
    Dec 14, 2012
    Posts:
    18
    Hello, I am getting the following error with Terrain to Mesh and am not sure what to do to overcome it. It is happening both in Unity 2017.1 and 2018.2, whether I use a simple terrain with no textures or a complex, fully textured one and pretty much regardless of settings (maps, no maps, obj, fbx, etc).

    NullReferenceException: Object reference not set to an instance of an object
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.ClearConsole ()
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.Draw_GenerateButton (Boolean _isReadyToGenerate)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.OnGUI ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)

    Help please?

    Cheers.
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    TerrainToMesh_EditorWindow.ExtractBasemapInEditor is used to save generated texture inside project as file and uses slightly different algorithm.
    TerrainToMeshConverter.ExtractBasemap is dedicated to use in runtime as Texture2D class for various shaders.



    VacuumShaders - Facebook Twitter YouTube
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Seems you are using old version.
    Remove plugin from the project. Clear Asset Store cache folder and re-download plugin from the store.



    VacuumShaders - Facebook Twitter YouTube
     
  31. Balmyrian

    Balmyrian

    Joined:
    Dec 14, 2012
    Posts:
    18
    Thanks, thing is it was a fresh install of the latest version, on a pc on which the plugin was never downloaded or installed before.

    Went to the other PC, salvaged an older version of T2M (2017.2) and tested it in 5.6, it worked. Installed same 2017.2 version into 2017.1, to no avail:

    Convertion failed :(
    Object reference not set to an instance of an object
    UnityEngine.Debug:LogError(Object)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:Draw_GenerateButton(Boolean)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:OnGUI()
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    So for the time being, I'm probably going to install 5.6 on this computer and import T2M 2017.2 into it and work that way.
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Just tested on Unity 2017.3.0f3 and Unity 2017.4.1f1 and everything works.

    Do not import plugin manually. Let Unity Engine download it from the Asset Store.
    Remove plugin from the project. Clear Asset Store cache folder and re-download it from the store using Unity editor.

    Package has been submitted using Unity 5.6.4, 2017.1.1, and 2018.1.0 to improve compatibility within the range of these versions of Unity.



    VacuumShaders - Facebook Twitter YouTube
     
  33. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Hi, I just bought this because it said: "Shaders support mobile (Unlit and One Directional Light), Legacy and Unity 5 Standard shading models." But your standard shader does not support Occlusion or Metallic/Smoothness texture inputs like the Unity Standard shader. Any chance of these texture inputs being added in the future?
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Unity standard shader used in terrain has no Occlusion or Metallic/Smoothness texture options. Otherwise T2M shader would have them too.
    Adding additional textures support into T2M shaders currently is not possible, as those are dedicated for mobiles and they have limited texture registers, that's why 8 textures T2M shaders have no Bump texture options, but 4 textures shaders have.



    VacuumShaders - Facebook Twitter YouTube
     
  35. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    336
    Oh I see, darn. Ok, thanks
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Last edited: Sep 26, 2018
  37. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    Sorry if this has been asked before, but is it possible to bake the terrain texture splatmap to the mesh vertex colors?
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    No, Terrain To Mesh does not bake textures inside vertex color.
    You need Mesh Materializer asset, or if Low Poly Mesh Generator.



    VacuumShaders - Facebook Twitter YouTube
     
  39. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    OK thanks. Just to confirm Low Poly Mesh Generator / Mesh Materializer will bake the splatmap, and not the resulting blended texture?
     
  40. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Mesh Materializer will bake any texture used by mesh material into vertex.
    You first extract splatmap from the terrain and convert it into mesh, then assign splatmap as common texture to the mesh and bake it into vertex color (another mesh will be generated).

    Low Poly Mesh Generator also will bake any texture used by mesh, but resultant generated mesh additionally will have flat normals creating faceted/lowpoly look.



    VacuumShaders - Facebook Twitter YouTube
     
    adslitw likes this.
  41. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    OK great, thanks.
     
  42. SkandYxyz

    SkandYxyz

    Joined:
    Mar 13, 2015
    Posts:
    83
    Hi,

    have problems to create mesh from map magic terrains.

    'Assets/(Temporary)/Terrain 40 (ID_74784)/.asset' is not a valid asset file name.
    UnityEditor.AssetDatabase:CreateAsset(Object, String)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:SaveMeshAsset(Mesh, String)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:ExportUnityMesh(Terrain, String)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:Generate(Terrain, Boolean, Single)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:Draw_GenerateButton(Boolean)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:OnGUI()
    UnityEditor.DockArea:OnGUI()

    Convertion failed for Terrain -4,0 (UnityEngine.GameObject)
    Creating asset at path Assets/(Temporary)/Terrain 40 (ID_74784)/.asset failed.

    UnityEngine.Debug:LogError(Object, Object)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:Draw_GenerateButton(Boolean)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:OnGUI()
    UnityEditor.DockArea:OnGUI()

    Best,
    Andre
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    What Unity version do you use?
    What OS?
    Can you send me terrain asset with all its textures as package?



    VacuumShaders - Facebook Twitter YouTube
     
  44. peterhowell

    peterhowell

    Joined:
    Mar 7, 2015
    Posts:
    7
    I'm getting this error after clearing my cache. On 2017.4. Super disappointing for a single use asset store item.
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Are you using Unity 2017.4.10 (or later version)? Clearing cache folder will not work if using earlier versions.



    VacuumShaders - Facebook Twitter YouTube
     
  46. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    I updated to the latest version and "Generate" is not working:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.ClearConsole ()
    3. VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.Draw_GenerateButton (Boolean _isReadyToGenerate)
    4. VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.OnGUI ()
    Reproduce
    • Start Unity 2017.4.9f1 on Windows 10
    • Create new project
    • Import "Terrain To Mesh" from Unity Asset Store
    • Click "File > New Scene"
    • Click "GameObject > 3D > Terrain"
    • Click "Window > VacuumShaders > Terrain To Mesh"
    • Drag&Drop Terrain from Hierarchy to Terrain To Mesh window
    • Enter "lod" for sub-folder name
    • Select "Export Unity Mesh" or/and "Export OBJ Mesh"
    • Click "Generate"
    Observe the tool output an error and nothing is being generated.

    Also, using the "Check for Updates" functionality outputs this error:
    Code (CSharp):
    1. Can not connect to the Update server.
    2. UnityEngine.Debug:LogError(Object)
    3. VacuumShaders.PluginUpdateCheck:Update()
     
  47. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Package is submitted using Unity 5.6.4 and 2017.4.10
    You need to update engine to 2017.4.10 (or later version), otherwise you will get asset for Unity 5.6, that does not work with 2017.4.9
    Before downloading asset using Unity 2017.4.10 - clear asset store cache folder.



    VacuumShaders - Facebook Twitter YouTube
     
  48. DarkDeivel

    DarkDeivel

    Joined:
    Aug 31, 2016
    Posts:
    127
    Hello! I have been using your asset for a long time, but now the question has arisen, will there be support for any mobile shader? I use the terrain in a game with 8 textures of size 250x250, but the FPS on android still falls, when disconnecting the terrain FPS becomes maximum, thanks!
     
  49. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Does it work if I download it using 2017.4.10 and then just copy the imported files in my 2017.4.9 project? Or does it actually work with 2017.4.10 and newer only?
     
  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Do you use Standard shaders?
    Package already includes mobile Unlit and One Directional Light shaders.



    VacuumShaders - Facebook Twitter YouTube