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,978
    It may work. If not, you will have to use Unity 2017.4.10. It is the minimum required Unity 2017.x version for this asset.



    VacuumShaders - Facebook Twitter YouTube
     
  2. acrossthestars

    acrossthestars

    Joined:
    Oct 17, 2017
    Posts:
    10
     
  3. acrossthestars

    acrossthestars

    Joined:
    Oct 17, 2017
    Posts:
    10
    4.10 works just as fine :)
     
  4. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hi,

    I'm using Unity 2017.4.10f1 (64bit) on Mac with latest Materializer build. I have a Unity terrain using Standard Unity terrain material. I have 4 textures painted onto the terrain. When I run the Terrain2Mesh and select the Basemap option it completes and generates NewTerrain_Basemap_Diffuse. However this texture is of a single green colour (first texture in my terrain) and no other colours. Am I missing a step here. I have Export Terrain Maps and Terrain To Mesh selected. Splatmap and Basemap are both set to PNG.

    Also when I take a height map it is completely black colour. Any ideas what is going on?

    Regards.
     
    Last edited: Oct 18, 2018
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Problem is with Terrain To Mesh asset or with Mesh Materializer?
    Do you have both assets installed?



    VacuumShaders - Facebook Twitter YouTube
     
  6. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    I have Mesh Materializer which includes Terrain To Mesh. The Mesh get's created fine by the way, it's just the height map and the base map bake that doesn't work for me. I'm not sure if I'm doing something wrong, there are not that many things to adjust and I've tried various settings. My terrain is nothing special, just some green small hills with brown road painted on. Height map comes out completely black, basemap is just single green colour no brown road on it. I have latest version of Materializer installed running on Unity 2017.4.10f1. I could update it latest I think it's .13 if you think that would make a difference. By the way the splat map export works just fine.
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Package includes example terrain Mesh Materializer\Example Scenes\Files\Terrain To Mesh\SnowTerrain.asset
    Does it has the same problems?
    Can you share your terrain asset with all its textures as package?



    VacuumShaders - Facebook Twitter YouTube
     
  8. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    I've tried SnowTerrain and am still seeing the same problem. The base map comes out one single colour and normal is also one single value. The colour is a shade of the first texture in the terrain paint. The height map looks good though, so the height map works correctly, perhaps my terrain is too flat to see the difference in height by eye. In any case, the basemap still exhibits a problem I get one single value for the basemap. The type is PNG and Resolution set to default 2K.
     
  9. kapyar

    kapyar

    Joined:
    Dec 13, 2014
    Posts:
    8
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
  11. kapyar

    kapyar

    Joined:
    Dec 13, 2014
    Posts:
    8
    I am using Unity 2017.4.6 LTS
     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Upgrade to 2017.4.10 and re-download asset.

    upload_2018-10-24_14-45-31.png


    VacuumShaders - Facebook Twitter YouTube
     
  13. cj-schultz

    cj-schultz

    Joined:
    Mar 24, 2016
    Posts:
    1
    Hi, I am having this same problem. I am using Unity 2017.3.1f1. I downloaded it for the first time through the editor, when I clicked "Generate", i got this error:

    NullReferenceException: Object reference not set to an instance of an object
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.ClearConsole ()
    ...

    and the meshes weren't generated. I cleared my Asset Store cache folder at location user_name\AppData\Roaming\Unity\Asset Store-5.x, I deleted VacuumShaders/Editor and VacuumShaders/Terrain To Mesh folders. I re-downloaded and re-imported via the editor and I'm still getting the error.

    Note, I already have the Advanced Dissolve package in my project. Thanks.

    - Colin
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    There are 3 versions of the asset on the store: for Unity 5.6, Unity 2017 and 2018, but you need Unity editor version to be the same as asset has been submitted or newer.



    For Unity 5.6 you need editor version to be 5.6.4 or the latest
    For Unity 2017 - 2017.4.10
    For Unity 2018 - 2018.2.5

    Update Unity to appropriate version and re-download asset.



    VacuumShaders - Facebook Twitter YouTube
     
  15. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @Arkhivrag I'm having the same problem as @CJ-shultz with the following error in 2017.1.5f1:

    NullReferenceException: Object reference not set to an instance of an object
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.ClearConsole ()

    I know you said to update to 2017.4.10, but that's not possible for me. I am developing for the Wii U and the highest version I can get is 2017.1.5f1. Is there no way to get a fix for this on that version? I've been using this tool for a while and it has never failed me before until now and I really need it.
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Download package for Unity 2017.4.10, it should work with 2017.1.5



    VacuumShaders - Facebook Twitter YouTube
     
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Of course. I should have realized that I need to download from Unity 2017.4.10 and then copy back over to the lower 2017 version. Thanks.
     
  18. Archie747

    Archie747

    Joined:
    Jan 7, 2015
    Posts:
    25
    Hi Im very interested in buying this asset, but does it support mobile (andro/ios) for opengles 2 and 3 ?
    thanks
     
  19. Arkhivrag

    Arkhivrag

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



    VacuumShaders - Facebook Twitter YouTube
     
  20. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    145
    Hello, I am trying to use T2M on 2018.3.0b9 and hitting this exception when trying to Generate. I understand it's a beta so not expecting an answer right away -- I am doing experiments with the new terrain system and will take what I can get for now.

    Code (CSharp):
    1. MissingMethodException: UnityEngine.Object UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(UnityEngine.Object)
    2. VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.Generate (UnityEngine.Terrain _terrain, System.Boolean isGameObject, System.Single progressBarMultiplier) (at <2cca62fccbed45409b988fdb319582d5>:0)
    3. VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.Draw_GenerateButton (System.Boolean _isReadyToGenerate) (at <2cca62fccbed45409b988fdb319582d5>:0)
    4. VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.OnGUI () (at <2cca62fccbed45409b988fdb319582d5>:0)
    5. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    6. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    7. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    8. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    9. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    10. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    11. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:310)
    12. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:363)
    13. UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:322)
    14. UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    15. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    16. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
    17. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401)
    18. UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511)
    19. UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
    20. UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
    21. UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
    22. UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    23. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    24.  
     
  21. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Hi,

    Just to check if this plugin is perfect for me: I have a 10000x10000x1400 map representing a hill and I have made a complex Procedural Texturing, now I need to export it as a 3D model with the resulting texture. I have tried myself to access the resulting basemap, but, at the end, I couldn't found out how to access the resulting material of the Terrain (it does not seem to be the same that you set on materialTemplate), so I can't get the basemap set to it, only an empty one from an empty material referenced by the terrain, but on the Shader I can see that the basemap exists.

    If the plugin can export the Terrain as a 3D model with the resulting texture, it is exactly my need!

    Thanks in advance.
     
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Terrain To Mesh can generate Basemap texture only if terrain asset uses Unity built-in terrain shader.



    VacuumShaders - Facebook Twitter YouTube
     
  23. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Thanks. I've managed to get the base texture, as expected it is not very detailed (even because it is limited to 2048x2048), but enough for a small terrain (which is, definitely, not my case). If you don't mind answering (it may be an important point of your plugin, so I understand) (may be in private too) , do you know if there is a hack to increase basemap resolution above 2048? I was able to programmatically modify the basemap distance but not the resolution.

    Thanks very much and congratulations on the plugin.
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    I have never tried to 'hack' Unity terrain system to increase its Basemap resolution.
    Terrain To Mesh plugin does not extract Unity terrain Basemap, but generates new one based on splatmaps and paint textures.
    It is identical to the Unity terrain Basemap, but can be generated in any resolution.



    VacuumShaders - Facebook Twitter YouTube
     
    fcloss likes this.
  25. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Nice! Congratulations on the results achieved. Do you have examples of exported models from Unity terrain with Terrain to Mesh on Sketchfab or anyother 3D viewer? Thanks and sorry for disturbing.
     
  26. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hi Arkhivrag,

    Thanks for all your hard work on the Terrain to Mesh asset - it's really great. I know you've addressed this issue in this thread earlier, but I want to bring it up again. The fact that we need to maintain a "VacuumShaders" folder in the root of our assets folder is a huge problem for us. We create quite complex projects for multiple platforms simultaneously, all of which are created through a fairly robust build system which sorts it's assets based on where they live. For example, we have files automatically included/excluded from the project based on whether they belong to a particular platform, are editor-only, belong to a particular platform variant (i.e. Steam), is dev/release build, etc.

    Enforcing VacuumShaders to be in the asset root is a big problem for us. We made a special case for it in our previous project, but for the next one we are enforcing a rigid folder structure to help us scale. As it stands, Terrain to Mesh is getting deleted due from our VCS because of this. To be blunt, it's a real pain.

    I know you mentioned that you wanted to have a common root between all projects, but that's clearly achievable without enforcing a strict folder structure like this. Either make your stuff reference relatively (preferred), or at the least provide a ScriptableObject which contains the root path which we can edit ourselves.

    Would really appreciate your help with this. Thanks again for all your hard work on this, and for listening to my comments.

    Ben
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    No Sketchfab files, but you can check this videos, to see how Unity terrain is converted into mesh.





    VacuumShaders - Facebook Twitter YouTube
     
    fcloss likes this.
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Will remove that restriction in the next updated.



    VacuumShaders - Facebook Twitter YouTube
     
  29. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    That's great to hear. Thank you very much indeed, really appreciate that.

    Ben
     
  30. Fabien224

    Fabien224

    Joined:
    Sep 18, 2015
    Posts:
    5
    I get pixels on weak android devices, how do I fix this error?
    I use Shader 3 texture (layers)
     

    Attached Files:

  31. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Check your build settings, may be there is mesh vertex data compression enabled
    Is Vertex Compression for Tex Coord 0 enabled in Player build settings? Try with it disabled.
    Also check texture compression format for mobile platform, especially for exported SplatMap.



    VacuumShaders - Facebook Twitter YouTube
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    This worked for me before, but I tried to do this in a new project and I am getting the following error again:

    NullReferenceException: Object reference not set to an instance of an object
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow.ClearConsole ()

    I even went into my Unity store cache, completely removed the package and re-downloaded from Unity 2017.4 and tried importing directly into 2017.1, but no success.
     
  33. Fabien224

    Fabien224

    Joined:
    Sep 18, 2015
    Posts:
    5
    It did not help me, I have something like https://forum.unity.com/threads/terrain-texture-on-android-device-pixelize.163834/ , the first layer is displayed perfectly, and the rest is not. How can this be solved with your shader? Mobile-> Diffuse-> 3 textures
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    If it does not help, you have to update Unity to 2017.4.10 or later version to use this plugn.


    Texture pixelation is due to poor mobile GPU that can not handle correct data precision, and I can not help here, only suggest to bake Basemap texture and use it on such cases.



    VacuumShaders - Facebook Twitter YouTube
     
  35. Fabien224

    Fabien224

    Joined:
    Sep 18, 2015
    Posts:
    5
    I also get black textures once or twice. I still use Mobile-> Diffuse -> 3 Texture (there are no such bugs on the standard initial terrain)
     

    Attached Files:

  36. DarkDeivel

    DarkDeivel

    Joined:
    Aug 31, 2016
    Posts:
    127
    Hello! When using Terrain To Mesh can not move the grass from the terrain?
     
  37. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Grass is not be exported. It is not part of the terrain asset, but generated using terrain shaders.



    VacuumShaders - Facebook Twitter YouTube
     
  38. DarkDeivel

    DarkDeivel

    Joined:
    Aug 31, 2016
    Posts:
    127
    There is no way to transfer it?
     
  39. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    I have many 2k terrain tiles that is splitted from a 16k terrain, can this tool nicely convert them all to mesh and seamlessly put them together like I have now?
     
  40. Zvky

    Zvky

    Joined:
    Sep 22, 2017
    Posts:
    2
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Only if generate it manually.
    But do not think it is a good idea as you will end up with millions of mesh instances in the scene without Terrain LOD system. You do not count painted grass, do you?


    Generated meshes are placed in the same location as the source terrain.


    Not blurry, but stretched. Try adjusting UV scale parameter inside material editor.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Feb 20, 2019
  42. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
     
  43. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    any option to add all unity terrain to a list and hit generate and go for lunch?
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Drag and drop folders from project window inside T2M editor window. All terrains inside sub-folders will be detected.



    VacuumShaders - Facebook Twitter YouTube
     
  45. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Cool!
     
  46. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm getting the follow error in 2017.4.16. any idea how to fix it?

    Convertion failed for Terrain (UnityEngine.GameObject)
    Could not load type 'UnityEditor.PrefabAssetType' from assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    UnityEngine.Debug:LogError(Object, Object)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:Draw_GenerateButton(Boolean)
    VacuumShaders.TerrainToMesh.TerrainToMesh_EditorWindow:OnGUI()
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  47. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Seems you are using asset for Unity 5.6 or Unity 2018
    Remove asset from the project, clear Asset Store cache folder and re-download package using Unity 2017



    VacuumShaders - Facebook Twitter YouTube
     
  48. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi, do you have any tips for modifying your shaders to make the texture tiling in our game less apparent? We have huge levels and camera can sometimes get quite far from the terrain mesh. And then the texture tiling starts to be quite visible.

    Maybe just rotate the texture randomly? This would help us a lot. Any ideas will be appreciated :)
     
  49. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,978
    Texture tiling is read directly from Terrain asset. Those parameters are used by terrain material itself and are copied to generated T2M material. But you can control tiling scale for each texture inside T2M material editor.



    VacuumShaders - Facebook Twitter YouTube
     
  50. gamesjust007

    gamesjust007

    Joined:
    Jan 3, 2017
    Posts:
    13
    Hi the documentation and API doc isn't there. Can you please submit it again? Need to go through the documentation.

    Thanks.