Search Unity

  1. 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. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    524
    GAIASCREENSHOT01 copy.jpg This is taken using the new Gaia product plus Mesh Materializer. The Terrain piece would be the same as what's in this product as it's a part of Mesh materializer.
     
    Arkhivrag and AdamGoodrich like this.
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Splatmaps are used by Unity terrain system for diffuse and bump texture blending.
    One splat map can blend four textures.
    If exporter found 5 splatmaps, it means that you are using about 20 textures on your original terrain.

    Unity terrain shading system is multipass requiring dozens of draw call.

    Terrain To Mesh shaders require one pass and one draw call for rendering converted terrain mesh. You can find them very fast on mobile ;)
    Check SnowTerrain example scene to see how shader works.
    Original terrain there is using only 4 textures and that's why it has only one splat map.
    Untitled-1.png
    Control map is used for texture (Layers) blending using R, G, B and Alpha channels (here you can assign your exported splat map).

    Max available texture blend amount is 8 textures. Achieved using two control textures.

    You do not need OBJ files unless you want to edit them inside external 3D modeling software.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 18, 2015
  3. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    Looking forward to this leeching into MM :)

    Nice work.
     
  4. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    14
    http://imgur.com/nXx8NTG Hey Arkh, any idea how to fix this black textures? EDIT: It seems that this new update where you add 4+ textures, is faulty, all textures on 2nd splat map does not work and appear as black missing textures.
     
    Last edited: Nov 19, 2015
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Update v1.03
    • Fixed 'NaN' tangents, appearing on multi-chunk converted mesh edges.

    tangents.png



    VacuumShaders - Facebook Twitter YouTube
     
    twobob likes this.
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Confirm 4+ texture bland shaders bug. Working on fix.



    VacuumShaders - Facebook Twitter YouTube
     
    twobob and mbrindic like this.
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Update v1.04
    • Terrain splatmaps can be exported at run-time (only in Unity 5. Check API.pdf file inside Doc folder).
    • Fixed 4+ texture blend shaders.



    VacuumShaders - Facebook Twitter YouTube
     
    twobob likes this.
  8. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    14
    Last edited: Nov 20, 2015
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    May be one of layer textures inside material is missing? Or may be original terrain has more diffuse textures used then Terrain To Mesh shader can handle? Max layer textures blend count = 8.
    If you are sure that everything at your side is correct, can you share exported splatmaps?



    VacuumShaders - Facebook Twitter YouTube
     
  10. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    14
    Just checked all things noted, everything seems to be in order, sending you link with package of splatmaps http://www.filedropper.com/splat . First file uploader google suggested, if its not valid il upload to another place. Thank you
     
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Shaders work correct. It was texture compression issue. Changing compression even to 16 bits fixed it.
    splat.png



    VacuumShaders - Facebook Twitter YouTube
     
    mbrindic likes this.
  12. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    14
    Wow, awesome man, thank you for the support, really appreciated! Great job!
     
  13. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,215
    As a terrainer, these tool seems interesting to me <3
     
  14. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    @Arkhivrag
    I used many terains in my project and bundle size goes up alot with splatmap and terrain data itself.
    Does Converting terrain to mesh will reduce the bundle size ? does it terrain the quality of splatmap ?
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Terrain To Mesh generates:
    1. Mesh assets, where you have precise control of vertex count. Asset size can also be optimized be excluding uv, uv2, normal or tangent buffers.
    2. Splatmaps - size is defined by Unity terrain engine itself, but after exporting it as texture, you can reduce its size manually.


    VacuumShaders - Facebook Twitter YouTube
     
  16. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    Well Sounds cool. And what happens to created trees foliage and detail meshes on terrain ? I want to create them with the terrain and convert the terrain to mesh but retain painted trees and grass. Can we achieve this ?
     
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Trees and grass are not converted to mesh, only terrain.



    VacuumShaders - Facebook Twitter YouTube
     
  18. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    451
  19. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    oh k.
    So do you hv any suggestions for trees and grass placement
     
  20. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
  21. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    451
    Quickbrush work fine with Unity4 and Unity5.
    You can only use it to put prefab or your mesh(T2M or other mesh), to hide your trees or grass if your camera is far,you need to create a script on the camera, and put in 2 arrays your trees and grass to calculate the distance to hide or not your grass, trees.
     
  22. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    So here is the plan. I want to create a large 4kmX4km terrain. Create roads with easyroads. Convert the terrain to mesh chunks. Paint the terain with Quick brush for plants and foliage. Hope this gives me good performance compared to terrain
     
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    One more step for optimization, next update will include terrain Basemap exporter too.
    Basemap is a single texture with all terrain textures baked inside.



    VacuumShaders - Facebook Twitter YouTube
     
  24. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    that's nice. Do you have any dates for next update !
    Btw i already made the purchase. Now playing with the tool. Keep up the good work
     
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Next week, after releasing Unity 5.3 (Dec 8). Need to ensure that tool has no problems with new Unity.



    VacuumShaders - Facebook Twitter YouTube
     
  26. GarbageCat

    GarbageCat

    Joined:
    Jul 31, 2012
    Posts:
    233
    this tool could work great with GAIA if it would also export trees / objects from the terrain
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Will add it to a 'wish list'



    VacuumShaders - Facebook Twitter YouTube
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Update v1.1
    • Added Heightmap extractor.
    • Added Basemap extractor. Tool bakes all terrain textures into one.
    Extracts diffuse and normal maps separately. (In Unity 5 works in editor and run-time, in Unity 4 only in editor).
    • Editor now creates fully setup T2M material with Splatmaps, proper uv scale for multi-layer textuers or single texture material with Basemap only. (Material will be created only if is enabled Export Unity Mesh and Export Basemap or Export Splatmaps(One file (RGBA)) are selected).
    • Editor tool will output conversion report, if it finds some exceptions.
    • Added run-time functions - ExtractHeightmap() and ExtractBasemap(). Check API.pdf
    • Example script now creates proper T2M material.







    VacuumShaders - Facebook Twitter YouTube
     
    sathya likes this.
  29. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Hi, this tool definitely reduces draw calls, Im curious whats better or different about using basemap for 1 texture or using splatmaps? Only that splatmaps can use your shader right? Also, I am using one directional light diffuse 6 textures for mobile shader and it looks nice in the project but when I build and on phone it looks fuzzy, I built for two phones one newer and older, do you know what it could be?
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    For mobile it would be better to use basemap, it means - one texture in project and one texture sampling in shader.
    If you use splatmap with 6 diffuse textures, it will be - 8 textures in project (2 splatmap + 6 diffuse textures) and 8 texture sampling in shader.



    VacuumShaders - Facebook Twitter YouTube
     
  31. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Ok yeah thats what I was thinking but the Vacuum shaders only use splatmaps.Should I use a Unity mobile/diffuse shader with the basemap?
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Basemap is just a texture, you can use it in any shader.



    VacuumShaders - Facebook Twitter YouTube
     
  33. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,145
    I'm afraid using only a basemap will produce poor results. What if using one splatmap with 4 diffuse textures, for mobile?
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    It's up to you, I just give tools.



    VacuumShaders - Facebook Twitter YouTube
     
  35. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Yeah, I know but on the Asset page it says supports mobile shader. If splatmaps aren't for mobile, and only basemap works, then where is there a shader for that? Basemap doesn't look too good and splatmap even with a couple textures doesn't look good either.
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    I do not know where you read that splatmap shaders (included T2M shaders) are not for mobile.
    Here is what is written about shaders on the Asset Store page:
    With splatmap you can achieve exactly same effect as Unity terrain paint textures, but basemap is faster.




    VacuumShaders - Facebook Twitter YouTube
     
  37. pepone3d

    pepone3d

    Joined:
    Jul 5, 2012
    Posts:
    18
    TerrainConversion.jpg

    Hi Davit, I totally love your shader work! (they seem to be the fastest I have found for mobile devices)
    Right now I am playing with Terrain to Mesh and then run Per-Vertex Ambient Occlusion over it...
    If I want to bake the shadows of static object on the terrain, I still need to generate a lightmap.
    (and have to use one of the Legacy shaders, cause your Unlit/ One Light Vertex Color Shaders don't have
    an option for enable lightmapping, right?)

    For best (fastest) results I would like to use a Detail texture + the basemap like in the screenshot -
    But I think if there would be a possibility to directly burn the lightmapping shadows from the other static objects in the scene into the vertex colors that would mean one drawcall less (!?) Unfortunately I can only achieve this, if I set the raycaster to combine meshes - which makes me losse my textures on the other objects, cause everything attached together and then uses the terrain texture.

    Here are some ideas I would like (whatever works fastest on mobile devices ;) )

    1) Is it possible to also have the layers option like in Occlusion Render in Raycast Mode?
    2) Is it possible to have both features of ambient occlusion generator burned into the vertex?
    (Like Raycast + 25% Occlusion Render, blended into the vertex layer)
    3) Can you add a Detail Texture Option to your Unlit + One Light Shaders?
    4) Can you add a feature to your shaders to additionally use lightmaps in the scene?

    Many thanks and best regards,

    pep
     
  38. mk1978

    mk1978

    Joined:
    Dec 27, 2009
    Posts:
    276
    A couple of beginner questions.

    My idea has been to create a terrain in Unity with the help of Terrain Composer and RTP terrain shading and finally take the terrain model into Unreal Engine. Do you think that I would be able to that with the help of this Asset? I assume that I can export the terrain Heightmap and use that in UE. But how is it with terrain texturing that I have created with RTP? Am I able to bake that outlook with this asset and export the terrain texture as Basemap?
     
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    1) No, it is not possible.
    2) From editor no, but you can bake 25% Raycast, then select new generated mesh as source object (with Original Vertex Color enabled) and bake Occlusion Render above it.
    3) I'll try, but after holidays.
    4) Both T2M and Vertex Color shaders (One Directional Light, Legacy and Standard) support lightmaps.

    Terrain To Mesh bakes all terrain paint textures in one - Basemap. It does not matter which plugin is used for their painting into terrain.
    If terrain paint textures use normal maps too, two Basempas will be baked one for diffuse and another for normal map.



    VacuumShaders - Facebook Twitter YouTube
     
  40. mk1978

    mk1978

    Joined:
    Dec 27, 2009
    Posts:
    276
    Does this mean that it is possible to bake the "texture properties/outlook" achieved with RTP Shader? For example with RTP shader it is possible use global color map to create irregularity into terrain textures and also control the sharpness of the border between the textures.
     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Only paint textures properties (scale and offset), custom shader properties can not baked anyway - it is shader properties not textures.



    VacuumShaders - Facebook Twitter YouTube
     
  42. luciano182

    luciano182

    Joined:
    Oct 26, 2012
    Posts:
    28
    Can this export all trees or only the terrain?
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Everything asset can do is in the description.
    Tree exporter is not ready yet, but by the end of this week I think I'll add it too.



    VacuumShaders - Facebook Twitter YouTube
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    hopeful likes this.
  45. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    @Arkhivrag
    Cool. How does it work by the way ? does it extract trees from terrain and place it on generated mesh terrain?
     
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    Trees are extracted as a separate prefab containing groups of tree prototypes, if terrain is also exported than tree prefab is attached to it as a child.
    Extracted trees receive correct scale and rotation, even in cases where for some reasons Unity terrain does not transform them.
    trees.jpg



    VacuumShaders - Facebook Twitter YouTube
     
  47. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    249
    Awesome. Was waiting for this feature. Time to optimize my game. Will Update you with performance improvements
     
  48. luciano182

    luciano182

    Joined:
    Oct 26, 2012
    Posts:
    28
    The last question before buy your excellent package... Will increase my performance using the exported terrains instead of Unity Terrains?
     
  49. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,472
    It's made for that.



    VacuumShaders - Facebook Twitter YouTube
     
  50. Vegaaa

    Vegaaa

    Joined:
    Mar 12, 2014
    Posts:
    3
    Sorry for my ignorance, i'm a Vray artist, i already know Unity basics but is my first time with Terrain and i want to know if this asset is what i'm needing.

    I'm doing a archviz project in Unity, i have a little piece of terrain around the house (90mx90m), i use the asset "Mesh to Terrain" (from Infinite Code) to convert and paint manually, but i think the Unity Terrain increases the drawcall unnecessarily for my project, so i can paint normally and export the splatmaps/basemap to the original mesh, or i have to use your "terrain to mesh" to go back to mesh again to use correctly these splatmaps/basecolours? I never used this splatmaps/basemaps, so i dont know how to use correctly in this case of converting.
     
    Last edited: Feb 12, 2016
unityunity