Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

► Terrain to Mesh ◄

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

  1. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    161
    When using the TTM in 2021.2.7f1 + latest URP (12.1.6), the exported terrain mesh remains black. Any idea?
     
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Unity 2021.2 is not supported yet. It is quite new "tech release", with many experimental features and API changes, and because of it, currently it is very unstable and full of bugs. I have to wait for several patch releases for it to become more stable and developer friendly.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Dec 25, 2021
  3. HASSANHR

    HASSANHR

    Joined:
    Feb 23, 2018
    Posts:
    16
    Hello, Does this Shader supports mobile Running on OpenGL ES 2.0
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    If terrain uses less than 5 paint textures, then yes.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Jan 4, 2022
    HASSANHR likes this.
  5. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    "Note, TTM does not generate mesh with holes.
    Holes are supported as Alpha Cutout effect using shaders – the same way as it is done by Unity terrain system."

    I think this totally breaks my idea. I am an idiot. LOL

    Will rethink that last part.
     
    Last edited: Jan 11, 2022
  6. unity_4WvA9Jx6T7Uezw

    unity_4WvA9Jx6T7Uezw

    Joined:
    Nov 19, 2018
    Posts:
    1
    Hi! Iam considering purchasing this asset for Unity 2021.1.7 using URP? Will this asset work with that version ? :)

    Sorry if its a dumb question, but havent been able to locate a list of compatible Unity Versions
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Asset supports only the latest Unity versions. In the case of 2021.1.x - it is Unity 2021.1.28.
    It may work with previous versions too, but I can not guarantee it, or provide support for them.



    Amazing Assets - YouTube Facebook Twitter
     
  8. NibbleByte3

    NibbleByte3

    Joined:
    Aug 9, 2017
    Posts:
    59
    Hello,

    I've just purchased the plugin and I can say that is awesome!
    I have a small issue with it on Android. Using URP.

    I have two old phones that I test on: Lenovo P70 and Sony Xperia Z3 Compact.
    I converted simple Unity terrain to a mesh terrain with 2500 vertices of splatmap material type. No grass, no trees. No holesmap.
    I tested on both phones:
    - the Lenovo works fine with expected 30 FPS.
    - the Sony keeps rendering using the fallback shader.

    I can't make the Sony render the splatmap properly. The terrain has 3 layers. I've manually removed the normal maps from the exported material. The texture usage info shows: "Material uses 4 terrain textures (3 textures + splatmap)". So according to the documentation, I should be good (below 6 textures). I've tried with png and tga format.

    I've tried using 2D Texture Arrays with "ETC2_RGBA8" format (I think that's the right one for Android, I have no idea?). In the editor looks ugly as hell. On the Sony - fallback again. :(

    I expected Lenovo to have issues as a cheaper crappier phone, but no.
    I'm sure I'm seeing the fallback because I drew red lines on it.
    I recompiled the shaders as instructed in the documentation.

    Any ideas what I could be doing wrong or easy way to fix this? I don't care that much about these phones, but still, it will be good if it worked. :)

    Unity 2020.3.25f1, URP 10.7.0
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Are you using lit shader? Beside those paint textures (in your case 4), lit shaders additional need textures for shadows, lightmaps, etc. As I can not test shader exactly on Sony Xperia Z3, I can make assumption that it can't sample so much textures. Too old. Try baking Basemap texture and let Sony render it in the fallback shader.



    Amazing Assets - YouTube Facebook Twitter
     
  10. NibbleByte3

    NibbleByte3

    Joined:
    Aug 9, 2017
    Posts:
    59
    I use the default terrain lit shader, did not change it. I tried reducing the terrain layers to two (so splatmap materail can be used for the mesh). It still didn't work :( Basemap texture works but that's the same as the fallback.
    I guess fallback it is. Thanks for the quick response.

    Works great on my modern Samsung S10e :)
     
  11. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,204
    Hi, does this work with Vegetation Studio pro ?
    Edit: found on their website that it supports Mesh Terrains, so assuming it would be good to go!
     
  12. NibbleByte3

    NibbleByte3

    Joined:
    Aug 9, 2017
    Posts:
    59
    Hello, me again.

    I'm trying to export my terrain with the grass I've placed. It uses grayscale image that I colorize with the dry and health color. Here is how it looks:
    upload_2022-2-2_21-19-36.png

    Sadly, when I export the terrain with grass from the editor window, the color doesn't stick - the grass is white, affected by scene lighting. Here is how it looks:
    upload_2022-2-2_21-22-4.png

    Exported grass is with 2 sides, no shadows, using the default shader "Amazing Assets/Terrain To Mesh/Shaders/Grass/Grass.shadergraph", i.e. nothing special. In the documentation it says that the plugin exports the dry and health color in the mesh vertex color in the RGB channels. In the shader I see that it takes the vertex color and plugs it in the base color, so grass should have color? When I select the grass mesh (individual quads), they don't seem to have vertex color in the preview, as everything is white:
    upload_2022-2-2_21-31-15.png

    So, is this a bug or I don't get how it should work?

    And another small issue: check again the screenshot with exported grass. Some pieces of grass are bright white, while others are dark gray. After some debugging I realized that this happens because of the quad normals pointing away from the front face. The front faces of the quads become bright lit, while quad backs remain much darker, which looks unnatural. So it would be nice if the exported normals point up (for example), to eliminate this issue, or fix the shader to replace the normals with up.

    Still using Unity 2020.3.25f1, URP 10.7.0.
    Thanks :)
     
    Last edited: Feb 2, 2022
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Exported grass needs to use Combine option to have vertex color baked.
    Do included 6. Run-time (Export Trees, Grass and Details) example scene export it correctly?



    Amazing Assets - YouTube Facebook Twitter
     
  14. NibbleByte3

    NibbleByte3

    Joined:
    Aug 9, 2017
    Posts:
    59
    Your sample scene works correctly, although it uses colorful grass, not a grayscale texture. So it looks fine.

    I did use the combine feature, but for the screenshot above I wasn't. You're right, I can see vertex colors with the combined mesh. And in the preview window of the mesh they look fine.
    upload_2022-2-3_21-25-29.png
    When I place them in a scene with neutral lighting and your grass shader, I now started noticing a very pale green color.
    upload_2022-2-3_21-24-17.png

    So color is present, just not recreated correctly. I noticed that in your grass shader you multiply the vertex color by 2 which would result in whiter colors, even capped by the Saturate node. Can you tell me why do you need that multiplier? If I set the multiplier to 1, grass color looks closer to the original.
    upload_2022-2-3_21-28-43.png

    EDIT: I now see that the grass in the sample scene looks very dark with multiplier of 1. I guess this was a fix for that case, but it broke mine :( I'm not sure what the correct formula should be...
     
    Last edited: Feb 3, 2022
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Duplicate grass shader and modify it for your needs. You can use any "grass" shader you want.



    Amazing Assets - YouTube Facebook Twitter
     
    NibbleByte3 likes this.
  16. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    542
    Is there someone who managed to export a terrain with Microsplat?
    I'm looking to buy this assets but can't find any info about microsplat
     
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Custom terrain shaders cannot be baked or exported. Only Unity's built-in terrain shader.



    Amazing Assets - YouTube Facebook Twitter
     
  18. codevisionary005

    codevisionary005

    Joined:
    Nov 15, 2021
    Posts:
    17
    Hello... I am currently getting an error... it seemed fine yesterday when I closed unity last time.. but today when I opened unity I got this error message "Assets\Amazing Assets\Terrain To Mesh\Example Scenes\Files\Scripts\ExportMeshAndBasemapByPositionIndex.cs(143,22): error CS0103: The name 'Utilities' does not exist in the current context" Because of this, Terrain to mesh does not appear in the windows panel.

    Edit: Fixed! Since I use URP, I simply went to the installer folder and re-imported the urp installer again... It worked.
     
    Last edited: Feb 24, 2022
    Arkhivrag likes this.
  19. Niroan

    Niroan

    Joined:
    Jun 16, 2019
    Posts:
    105
    I have a problem with Terrain with high walls. Is like Terrain To Mesh ignores the walls and make them flat?
    Cna anyone help me regain my heigh on terrain?
     
  20. IanFrel

    IanFrel

    Joined:
    Sep 19, 2019
    Posts:
    1
    I'm currently trying get export mesh and base map to work on iOS 15. It currently only shows up white on builds on mobile, but shows up with the correct shading in editor.

    Are there any specialized recommended settings or shaders I should be using for iOS mobile builds?
     

    Attached Files:

  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    For run-time texture export always include AllTerrainTextures.shader from Terrain To Mesh \
    Shaders \ All Terrain Textures
    folder into the build.




    Amazing Assets - YouTube Facebook Twitter
     
  22. seldemirov

    seldemirov

    Joined:
    Nov 6, 2018
    Posts:
    46


    Hello, I have a strange error after using TTM. The grass is stretched and looks like the picture below.
    Do you know what could be causing this and how to fix it?
    I am using the Forest Environment - Dynamic Nature object from NatureManufacture.

     
    Last edited: Apr 8, 2022
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Do included example scenes have the same problem?
    It may be related to the third party grass system or Unity 2021 (that is not supported yet).



    Amazing Assets - YouTube Facebook Twitter
     
  24. seldemirov

    seldemirov

    Joined:
    Nov 6, 2018
    Posts:
    46
    No. This issue only appears after I use TTM in Unity 2020.3 and then export the scene to Unity 2021.2.

    Whether this problem exists in unity 2020.3 immediately after applying TTM, I don't know. Shaders of my assets do not support 2020.3.
    Does TTM know how to work with non textured grass? I suspect this is the problem.
     
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    If terrain uses grass that is part of the TerrainData.asset, then TTM reads it and converts to a mesh.

    If terrain uses some external or custom grass that is not part of the TerrainData.asset, then TTM will ignore it or convert it incorrectly (depends what is saved and how, inside TerrainData.asset).

    To check if your grass is saved and is part of the TerrainData.asset, remove all external tools that were used for that grass creation and if after that grass is still rendered by terrain system, TTM must convert it.



    Amazing Assets - YouTube Facebook Twitter
     
    Last edited: Apr 8, 2022
  26. seldemirov

    seldemirov

    Joined:
    Nov 6, 2018
    Posts:
    46
    OK. I removed all custom shaders and ran TTM on the demoscene from the Forest Environment - Dynamic Nature. Now I am getting a very strange result.
    There is grass on the stage, but it is not displayed. And if you turn on the playmode, then the scene crumbles into layers along the Y coordinate.

    My TTM config

    Errors


     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    1. Duplicate terrain asset and remove trees from it completely. Leave only grass and detail meshes.
    2. Drag and drop that new terrain asset into the TTM editor window.
    3. Highlight it inside TTM editor window and from the context menu choose to export it as a package.
    4. Send me that package on support e-mail (support@amazingassets.world) with asset purchase invoice.
    I will check it manually. Just from screenshots it is difficult to find where is a problem.



    Amazing Assets - YouTube Facebook Twitter
     
    seldemirov likes this.
  28. TrentSterling

    TrentSterling

    Joined:
    Jan 4, 2013
    Posts:
    90
    Trying to get the most out of as little textures as possible. I see support for diffuse alpha as smoothness? How is this applied? I've got alpha-channels on all my diffuse textures. The sliders values are applied uniformly across the layer? I don't see alpha channel has any effect.
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Generated TTM material imitates the same shader rendering effect as the Unity's built-in terrain shader. It reads and uses same texture values.
    Does texture's alpha channel (in your case) affect layer in the source terrain asset?
     
  30. TrentSterling

    TrentSterling

    Joined:
    Jan 4, 2013
    Posts:
    90
    Yes and I was able to replicate it by switching to debug mode and changing smoothnessFromDiffuseAlpha from 0 to 1 on each layer. So its working now, but perhaps should've been set automatically? Not sure.​
     
  31. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    68
    Hello,
    I am using this asset with Unity 2021.3 LTS and URP. I followed the instructions to remove the shader errors and this was done successfully. However, when I convert the terrain, the resulting mesh appears black in color.

    The material inputs seem ok, except for the resulting color being black. Any thoughts?

    upload_2022-8-14_23-49-52.png
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Does the package included example terrain has the same problem?
     
  33. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    68
    Yes, I went to the Quick Start sample scene and converted the terrain and got the following.
    upload_2022-8-15_10-51-7.png

    I don't see any errors in the console.

    Other, than referencing the Terrain, and adding a file suffix, I didn't make any other changes to the input dialog.

    upload_2022-8-15_10-53-3.png

    Again, the Material inputs look fine, other than the final output being black.

    upload_2022-8-15_10-54-42.png

    If it helps, my specific versions are:
    Unity: 2021.3.6f1 (2021.3 LTS)
    Terrain To Mesh: 2022.10 (latest version available in package manager)
    URP: 12.1.7 (latest version available in package manager for 2021.3 LTS)

    thanks.
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    It looks like Splatmap shader is not imported correctly. Did you recompile it as described in the Manual file?
     
  35. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    68
    I did. Since I am using 2021.3 LTS, I followed the instructions where one clicks on "Copy Shader" on the .shadergraph file and then executing "Generate Shader" on the .shader file.

    I will note that when I click on "Copy Shader" there is no apparent effect. Should this be generating a new file?

    I do see the following warning when I generate the shader, however it does not seem to be critical.

    upload_2022-8-15_17-52-13.png

    I also repeated these two steps for the "holes" shader.

    The Material itself shows a warning that the "Material uses 5 terrain textures". Not sure if this is a problem. Also, seems odd, since the original terrain only has two layers and 4 textures.
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Ok, I am out of the office until Thursday and will check asset using Unity 2021.3.6 after arriving and will better know what the problem may be.
     
  37. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    68
    ok, thanks.
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Just test using Unity 2021.3.8 and no problems found. At my side everything works correctly, as expected.

    However, if trying to use TTM designed for Unity 2019.4 - 2020.3 inside Unity 2021.3 then similar problems appear.
    So, I can make assumption that you are using incorrect package. Solution, delete TTM from your project, clear Asset Store cache folder and using Unity 2021.3 download TTM from package manager.
     
  39. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    68
    ok, I followed your instructions and it worked. Thanks.

    Maybe the issue is that despite the asset being called "Terrain To Mesh - 2021" which would seem to indicate it would work with Unity 2021, there are multiple versions under that 2021 name?

    This was what my Unity Asset Store Cache Folder showed before and after deletion and re-download.

    upload_2022-8-19_2-45-37.png

    upload_2022-8-19_2-46-7.png


    Clearly these are different packages. But even the older one was TTM-2021. Odd.

    So, if one has say a Unity 2020 project and a Unity 2021 project one has to

    a) Do an initial download of TTM-2021 in Unity 2020 from the package manager
    b) Import TTM-2021 in Unity 2020
    c) Delete from the Asset Store Cache
    d) Re-download TTM-2021 in Unity 2021 from the package manager
    e) Import TTM-2021 in Unity 2021

    Following your instructions above, I have effectively done steps a-e.

    Now, let's say you put out an update to Terrain To Mesh - 2021. If I try to update in Unity 2020, this will presumably not work? I would again have to go through Steps a-e on any update if I want to have projects with both Unity 2020 and Unity 2021?

    Not sure how this is normally handled with Asset Store packages.
     
    Last edited: Aug 19, 2022
  40. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    2021 in the name indicates asset's release year (before that was old one released in 2015), not Unity version.

    Terrain To Mesh 2021
    asset contains multiple packages for different Unity versions (from 2019.4 to 2021.3).

    If package has not been downloaded yet and it is not registered in the cache folder, then when you first try to download and import it, package manager checks currently used Unity version and based on it downloads appropriate TTM package from the server, compatible with that Unity version only.
    If one of the packages from the asset is already downloaded, then package manager automatically offers it to import, without checking currently used Unity version (this is a problem).
    That's how package manager works, not quite acceptable, but currently it has no feature for developers to somehow indicate that asset contains multiple packages for different Unity versions.
     
    Last edited: Aug 19, 2022
  41. villaman

    villaman

    Joined:
    Apr 21, 2021
    Posts:
    68
    Makes sense. Seems like a major package manager limitation. Anyway, I now know what to do if there has been an update to TTM 2021 and I need to deploy it to both a Unity 2020 Project and a Unity 2021 Project.
     
  42. gatsbyyang0

    gatsbyyang0

    Joined:
    Aug 30, 2022
    Posts:
    1
    i cant find vacuum shader in window button in unity.
     

    Attached Files:

  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Check ReadMe file inside installer folder.
     
  44. jeff_kumo

    jeff_kumo

    Joined:
    Feb 9, 2022
    Posts:
    9
    Hello, I am about to make purchase on your product, and I really want to ask you a question.

    I am planning to use the mesh terrain in combine with the SensorSDK package to get some pointcloud map of the enviroment. I have checked the current terrain, it can not be scanned by the lidar due to no 'mesh renderer'. Do you think with the converted mesh file, I may apply the mesh renderer onto the mesh terrain to get the pointcloud?

    Really looking forward to you reply.
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    Have not used SensorSDK and don't know how it works, but TTM generates two type of mesh files: Unity mesh (.asset format) and OBJ file (that can be used in any 3D modeling software).
     
  46. jeff_kumo

    jeff_kumo

    Joined:
    Feb 9, 2022
    Posts:
    9
    Hello, I have bought your product, the virtual lidar did work with the mesh terrain.

    I am not a skilled programmer myself, so may I ask a very amerture question:

    May I use the API to write a script to control the conversion process?

    Many Thanks
     
  47. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    If you are asking about making any changes inside TTM editor tool, then it is not possible as all scripts are packed in dll.
    However package offers run-time API, methods that are described in the Manual file (page 15) and demonstrated in the included example scenes. You can use this API for your own editor tools or inside builds.
     
  48. logic-cpp

    logic-cpp

    Joined:
    Mar 11, 2013
    Posts:
    24
    Hello, bought your asset recently

    Can you please make the Splatmap shaders compatible for SRP Batcher

    upload_2022-9-18_16-17-21.png

    https://docs.unity3d.com/Manual/SRPBatcher.html

    Trying to use these terrain meshes in ECS/DOTS and take full advantage of Hybrid renderer SRP batching. As of now - the terrain simply does not render at all n ECS/DOTS...

    Would be highly appreciated - thanks!
     
    Last edited: Sep 19, 2022
  49. crowmaster

    crowmaster

    Joined:
    Jul 6, 2012
    Posts:
    42
    I am currently my own terrain shader, it is compatible with basic Unity terrain shader. Can i use it on converted terrain mesh?

    Also what about holes, i need mesh collision data to also account holes in terrain.
     
    Last edited: Oct 10, 2022
  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,843
    As you are using custom shader, I can't know if it will be compatible with generated mesh. Mostly no, as it is a terrain shader and not a mesh. You have to manually modify your custom shader to make it compatible with mesh rendering.

    TTM doesn't cut holes in a mesh. Holes are rendered using Alpha Cutout shader.
     
    Last edited: Oct 11, 2022