Search Unity

[RELEASED] Wire Terrain

Discussion in 'Assets and Asset Store' started by Circool, Mar 5, 2018.

  1. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Hello everyone!
    I've made an asset that can convert Unity terrains into contour map mesh or wireframe rectangular grid mesh.
    WireTerrain.gif
    Wire Terrain: $19
    [Asset Store Link]
    [Web Demo]
    [Documentation]

    Thank you for reading!
    WireTerrainContoursMapElevated.jpg
    ContoursFlatten.jpg
    WireTerrainGridMesh.jpg
     
    Last edited: Nov 6, 2021
  2. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Update: Version 1.1 - Mesh optimization for contours map generation, now an algorithm can merge coincident vertices in produced meshes.
     
    Last edited: Mar 29, 2018
  3. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Reserved
     
  4. zeux-n00b

    zeux-n00b

    Joined:
    Nov 4, 2017
    Posts:
    73
    Hello!
    Q1. Is there a way that this 2 prefabs work with Map Magic? M.M. can spawn prefab in the center from a current parent terrain, its definitely possible with some scrip, but I havent taken my time jet to go study this topic.(it will come later)
    Q2. Is it possible that Wire Primitives asset can work with ACAD dxf lines in the future?
     
  5. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Hi.
    Answering Q1: I don`t have MapMagic plugin now, so I can answer this question after I'm testing how this plugin works. I'll need a couple of days for this.
    For Q2: It is possible for some AutoCAD primitives. Can you write which AutoCAD primitives you need to convert to Unity mesh?
     
  6. zeux-n00b

    zeux-n00b

    Joined:
    Nov 4, 2017
    Posts:
    73
    Q2: (Im not sure where we are going with this but...) Im not sure how that asset works, but my needs are that if I can convert Acad dxf lines in to MeshTopology.Lines since dxf line are not meshes (but I can convert them in to one) Or maybe it already does what I want in the end, and cant access documentation to know for sure. Im combining Space and Wireframe in my project btw
     
    Last edited: Aug 27, 2018
  7. jestermaximusJr

    jestermaximusJr

    Joined:
    Jan 12, 2013
    Posts:
    14
    Hello, I'm very interested in your asset. I'm streaming real world terrain information onto a unity terrain (using TerraLand 3), and I'd like to convert that terrain into a 3d topographic map at run time. Your asset looks like just what I need, with one question left unanswered. Real topographic maps have elevation numbers "embedded" into the contour lines, like this. So I've got to find a way to match up labels in unity's global space, with the contour lines generated on your mesh. Is there a way I can query the 3D position of points on each contour line in your generated mesh? I'm not sure how else to position labels that mimic those in real topographic maps. Thanks!
     
  8. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Hello. This asset produces contours as a unity mesh and algorithm tries to contain contours in a small number of meshes as possible. So you don't get separated contours, but you can access vertices and indices of the produced mesh by standard unity API for Mesh. By accessing vertices positions you can generate new meshes with contours separated by their Y coordinate. I've uploaded a generated mesh so you can examine it (WireTerrainContorsMesh.asset in WireTerrainContorsMesh.zip archive). Thanks.
     

    Attached Files:

  9. jestermaximusJr

    jestermaximusJr

    Joined:
    Jan 12, 2013
    Posts:
    14
    Excellent. Thank you for sample mesh!
     
  10. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Could this be used on a cube, where you can specify the grid size, the line color and the background being transparent and double sided?
     
  11. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    I don't understand what you are trying to achieve. Can you provide a picture? This package produces a unity mesh - so you can change material for this mesh in order to change color, and you can change position and orientation of transform where this mesh is lying.
     
  12. xzqsr

    xzqsr

    Joined:
    Feb 24, 2017
    Posts:
    3
    Hello, Circool. I just bought this and it's just what I need. Great asset!

    But one issue is, I want to generate two wire contours from one single terrain (or mesh) at runtime. One contour is flatten, and the other is not flatten, showing simultaneously. That's why I want to have two wire contours at the same time. So I created two game objects and added corresponding scripts to them and contours showed. However, when I toggled `Flatten` in Inspector of one contour, two contours got flatten together (althought another one was still Flatten untoggled)! I tried to change other fields in Inspector, unfortunately, I also had no idea to make them different because they always acted the same way.

    I've seen example scenes, in which two wire contours from one single terrain can be created correctly. That is achieved by prefabs. But I can't use prefabs because I wish my contours could be created and updated at runtime according to their source dynamic terrain or mesh.

    I guess it may be caused by `Mesh.sharedMesh` or whatever shares a common mesh or variable somewhere inside the scripts. This happens in both terrain and mesh scripts. And sadly I cannot find and fix it by myself. So, could you please give me a solution or fix this if it's a bug on next update? Thanks. :)
     
    Circool likes this.
  13. xzqsr

    xzqsr

    Joined:
    Feb 24, 2017
    Posts:
    3
    Well, I've found the solution, I guess...

    Modify the script "WireTerrain\Scripts\WireTerrainUtils.cs", comment out Line 19 and Line 143. These two lines check if `sharedMesh` of the result is null to instantiate a new mesh. However, it should have been instantiated a new mesh even if it is NOT null (because the second coutour mesh has already been sharing the sharedMesh created by the first one).

    After doing this, every instance of contours sharing a common source works separately as I expected, for both terrain and mesh script.
     
    Last edited: Feb 7, 2021
    Circool likes this.
  14. Nakel

    Nakel

    Joined:
    Sep 28, 2017
    Posts:
    106
    Great asset, so far unique on the unity environment.

    I really want to acquire it but I’m working purely on meshes and not terrains;

    Does it support converting contour lines from meshes?
     
  15. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Yes. In the package, there is a folder "Experimental" and in it a script named WireMeshContours.cs.
     
    Nakel likes this.
  16. Yuanyz

    Yuanyz

    Joined:
    Jul 19, 2018
    Posts:
    2
    Hello, how can i adjust line width?
     
  17. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Hello. There is almost no solution to render this line mesh with the width thicker than one pixel. I have tried one shader that draws lines several times with small displacement.
     
    Last edited: Nov 18, 2021
  18. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
  19. Yuanyz

    Yuanyz

    Joined:
    Jul 19, 2018
    Posts:
    2
  20. sylvain

    sylvain

    Joined:
    Feb 19, 2013
    Posts:
    46
    Hello,

    I bought this asset. It corresponds to my need : make contour lines from a terrain. Flat mesh on output.
    But, may be a stupid question, how can I export the result in a PNG, in a Texture2D ?
     
  21. Circool

    Circool

    Joined:
    Feb 5, 2013
    Posts:
    56
    Hi, Sylvain. You can get texture from camera or capture entire game view screenshot (https://docs.unity3d.com/ScriptReference/ScreenCapture.CaptureScreenshot.html).
     
  22. sylvain

    sylvain

    Joined:
    Feb 19, 2013
    Posts:
    46
    Ok, thanks !
     
    Circool likes this.