Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Public Procedural Roads/Paths Tool

Discussion in 'Made With Unity' started by Chris Morris, Apr 30, 2010.

  1. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Hey here's something interesting:

    http://www.humus.name/index.php?page=3D

    "This demo solves these problems by applying a technique similar to the Volume Decals demo. A road segment is rendered as a box encapsulating the terrain. The depth buffer is sampled and back-projected into the local space of the box, and the .xz coordinates are used as texture coordinates"
     
  2. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    I only took a brief look over it, but that method looks super expensive. A stencil pass, 4 texture lookups, depth buffer... I'm probably overlooking something but at first glance it seems unreasonable (for our game at least). Also, I don't really like that the road can only be as smooth as the terrain since it's not it's own mesh.
     
    Last edited: Oct 23, 2010
  3. Synthetique

    Synthetique

    Joined:
    Feb 27, 2010
    Posts:
    10
    Hi, I have a slight problem with the script. It basically does nothing. The script and sub-folder is in my Assets folder.
     
  4. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    Hi Chris-

    Awesome, awesome script :D Or, so it looks...it isn't placing any nodes for me. I've tried a few different work-arounds, even dug a little into the code, but cannot figure out the source of my woes... I really hope to get this working soon, will be a big help to my project- thanks for the amazing tool!

    It simply won't place any nodes...arg...
     
  5. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    @yahodahan - Make sure to watch the tutorial video. Terrain has to be positioned at (0,0,0) would be the first thing I would check.

    @Synthetique -" AttachedPathEditor.cs" needs to be in the Editor folder as well. It's best just to keep the PublicRoadPathTool folder intact after unzipping.
     
  6. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    Hey Chris, thanks-

    The terrain is indeed at 0,0,0. I watched the vid several times to see if I missed anything, but if I'm the only one with this issue I must be missing something simple...any other common mistakes you can think of?

    thanks!
     
  7. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    I can't think of anything that would be causing that to happen as long as the terrain is positioned properly and the files and folders are placed properly so that Unity can find the editor scripts.

    Try restarting Unity or taking the folder that's unzipped and reimporting it, making sure it's directly in the assets folder.

    If you still can't get it to work, feel free to e-mail me: chris AT sixtimesnothing.com - some screenshots might help me identify the problem
     
  8. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    email sent, thanks!
     
  9. IQpierce

    IQpierce

    Joined:
    Jan 24, 2011
    Posts:
    43
    This is dependent on the Terrain system, correct? In other words, if I'm making an iOS game, this tool isn't applicable?
     
  10. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    @IQpierce - yes, that's true, this tool won't work with iOS. It requires a terrain object, and terrain is just too high poly for iOS :(
     
  11. the_Simian

    the_Simian

    Joined:
    Mar 13, 2011
    Posts:
    37
    I have a small problem. when I click finalize path, and have not clicked "FLAT?", the road appears deep in the void beneath my terrain, and does not actually render the path. I also get this error:




    here is a screenshot of what happens:





    I hope this helps. I'm new to Unity, so I'm probably making some noob mistake. in any case, any help is appreciated, and I should say that despite my troubles I am super excited you have offered this to us for free. You sir, are an internet hero.


    Thank you. :)
     
  12. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    Wow~~~more more tools...
     
  13. KlaRo115

    KlaRo115

    Joined:
    Feb 24, 2006
    Posts:
    675
    Hi, I was just asking myself if you also/still have a unity 2.x version of this, since there's written on your site:
     
  14. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    @the_Simian - Sorry it took me a bit to respond, I was on vacation last week. Are you still receiving this error? It may be that your path is too close to the edge of the map and the path is trying to sample outside of the available resolution. Send me an e-mail if you want and I'll help you out from there - chris AT sixtimesnothing DOT com

    @KlaRo - The update for Unity 3.x compatibility was primarily taking out some of the code that cleared trees and details in the path (Unity removed this functionality) and possibly using a 3.x style shader for the diffuse road. I don't have that old of a version on hand, but if you plug it into 2.x and you are getting errors you can e-mail me and I'll walk you through the steps to revert it. Should just be a step or two, but I forgot exactly what all I updated.
     
  15. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    Chris - I am trying to use the path tool (not doing roads), I can set the nodes, but when I click "finalize", no texture is painted. I have verified that the terrain is at 0,0,0 and that I have a valid index value for the terrain texture (no errors as well). Have you see this? I am on latest version of Unity (3.3.0f4).


    Stumped...
     
  16. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    @KrankyBoyGames - Hmmm, is the "wear" value turned up? The higher this value is, the more the path is blended with the terrain. This usually needs to be up above half way for the path to be visible.
     
  17. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    I have tried both ways (high and low). I used your terrain tools to create my terrain, so the Y value at where I am attempting to create the path is at about Y120, is that the issue (terrain obj is at 0,0,0)? Does it need to be at 0Y?
     
  18. KlaRo115

    KlaRo115

    Joined:
    Feb 24, 2006
    Posts:
    675
    @ chris morris: No problems when using it on unity 2.x, the shader isn't working, but the scripts don't report any problems... Now, I'm gonna check your river tool too :)
     
  19. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    @KrankyBoyGames - No, it should be able to create paths at any height (and the new version allows the terrain to be at any position).

    Perhaps you can e-mail me a screenshot or an example project? That'd make it easier to diagnose and find a possible bug. Chris AT sixtimesnothing DOT com

    @KlaRo - Ah, that's probably the 3.x style surface shader. You can simply replace it with a 2.x diffuse shader that has the same "offset" parameter that is in the 3.x shader.
     
  20. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    OK Figured it out - it has to do with the slope value for cliffs (using the terrain toolkit). By moving it low (which is what I have and need for my scene) I can get the path to disappear even though the path is NOT on a slope...Here are my values:

    $Image1.png
     
  21. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    Hmmm... I can't think of any correlation between those two functions. If you generate terrain textures with the toolkit AFTER creating the path, the terrain toolkit will overwrite the path texture. Other than that, I don't really know - I tried to reproduce the issue just now and can't find a problem relating to the slope value
     
  22. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    Yeah your right, it wasn't that =) I am uploading the scene to a file share and will email you a link.
     
  23. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    @ Chris Morris ok i've been trying your program for the last two days and i've got to say it's amazing! But one thing..after i make a road/path ..i always lose my ability look around using alt left click...is there anyway to fix this?..i've tried several times to see if it was a bug or fluke but i get the same results every time
     
  24. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    nevermind it works fine again after you let it play once ..i guess the look around button gets stuck but after you run the game and then go back to editing its fine again
     
  25. Mixality_KrankyBoy

    Mixality_KrankyBoy

    Joined:
    Mar 27, 2009
    Posts:
    737
    TeamWhiteSnow - I have the same issue.
     
  26. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    KrankyBoyGames- yea but it works fine after you press play once then exit your game and go back to editing
     
  27. forgottenmindset

    forgottenmindset

    Joined:
    Dec 3, 2009
    Posts:
    72
    Hey I think this is really cool, but it's not working on my pc. I've attached the script to the terrain, it's at (0,0,0). I created the new path, and then clicked add node, and then hit p and nothing. I did this several times and clicked finalize path and it said at the bottom "Not enough nodes to finalize path"

    I just can't seem to make a node. It doesn't throw any errors when I click it. I'm running the indie version of 3.3 on windows xp. Same deal with the river tool.
     
  28. Chris Morris

    Chris Morris

    Joined:
    Dec 19, 2009
    Posts:
    259
    @forgottenmindset - If you haven't yet, check out the video tutorials: http://www.youtube.com/sixtimesnothing

    After clicking "add node" you need to right click inside the editor (scene) window, to give it focus, before clicking P when your mouse is at the desired node's position on the terrain.
     
  29. forgottenmindset

    forgottenmindset

    Joined:
    Dec 3, 2009
    Posts:
    72
    Thanks Chris, I'm an idiot
     
  30. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    Hopefully you're still around. These are great tools!

    I have a question similar to another above. I've been trying to use the splatmap side of your tools, but when I finalize the path it seems like nothing happens. Even when the settings are set for a full blend (uniform texture enabled) I get the odd "polka-dot" effect pictured below. For reference, generating a real mesh works fine.



    Any ideas?

    EDIT: It seems as if every "dot" uses the smallest splat resolution, as if the "brush size" was set to 1, and each one is 5 units from the last.

    EDIT2: I figured out that this happens if there is a difference between the Heightmap Resolution and the Control Texture Resolution (alpha map resolution) for my terrains. (In this case, my Control Texture Resolution was 1024, or 4x my terrain's Heightmap Resolution of 257. If I decrease the Heightmap Resolution further, the dots become further spaced. If I increase it, the dots move closer together, the space being equal to the ratio between the two resolutions.) I've had a look at the source where the terrain cells for texturing are calculated. It seems like it should be straightforward to compensate for this, but I'll need a nudge.
     
    Last edited: Jul 29, 2012
  31. nbatothemax

    nbatothemax

    Joined:
    Mar 3, 2013
    Posts:
    3
    Hey Chris, how can I modify the script to let me choose a wear value lower than 0.5? 0.5 blends it too much with my terrain.
     
  32. Rileyjaxen

    Rileyjaxen

    Joined:
    May 4, 2013
    Posts:
    1
    Hi Chris

    I have been trying the road/path tool and the script has been coming up with "You can't add this script. You must fix all complier errors" I can't seem to to fix it. If you could help me please that would be greatly appreciated.

    Thanks
    Riley
     
  33. bernardfrancois

    bernardfrancois

    Joined:
    Oct 29, 2009
    Posts:
    373
    Nice tool for quick generation of roads! Thanks for sharing.

    However, we came across some limitations - explained in the following blog post:
    http://www.previewlabs.com/roadpath-tool-vs-easyroads3d/

    Do you have any ideas on what may have caused the issues we encountered - do you have any fixes or updates planned?
     
  34. Free Arm Studios

    Free Arm Studios

    Joined:
    Sep 13, 2013
    Posts:
    6
    It seems as though the link to this tool is gone... Bummer.
     
  35. Enrinor

    Enrinor

    Joined:
    Jun 18, 2014
    Posts:
    3
  36. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    your youtube video is set to private.
     
  37. One-Zero

    One-Zero

    Joined:
    Sep 7, 2015
    Posts:
    8