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

World Building EasyRoads3D v3 - the upcoming new road system

Discussion in 'Tools In Progress' started by raoul, Feb 19, 2014.

  1. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Looking at the warning message, did you check the markers of this particular road by moving them. Are indeed two markers placed at about the same position? You can also see this in the Inspector. Does it actually show 3 for total markers instead of two?

    Thanks,
    Raoul
     
    Last edited: Sep 26, 2018
  2. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    it only shows just the one in each location. Also I noticed when I combined the road back together a new marker appears that wasn't there before.
    I split a road create 2 markers
    I combine the road back and now there are 3 markers there in that spot I split the road at lol.
    Thinking that was the invisible marker that is now showing idk lol

    I decided cause my machine keeps crashing. Its crashed about 60 times today. Not over estimating that number either.
    I'm just gonna remove all the roads and rebuild this road.
    I can probably do it much faster now since im better with using easy roads now then when I first made that road.
     
  3. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Oh ya you are right Raoul. There is markers on top of each other. I see where it says that in the inspector now.
    Then wen and I could find the one that was on top of each other.
    I don't know how that happen though. Probably related to that past bug I had.
    I'm gonna have to just remove all the roads anyways cause removing markers crashes my computer.
     
    raoul likes this.
  4. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    And perhaps check the video on the previous page or my other comments about the HD Roads package. It seems you do not have this package fully active, including side objects. You really want to use the HD Roads road types because they have decals etc. auto setup in the road type settings.

    Thanks,
    Raol
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    oh does it handle doing double lines for around curves and back to dotted on straight a ways? This road is actually on another planet and not on earth lol. That's why I'm in need of side objects.
     
  6. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    @raoul Follow-up on the road width question: When I change the overall road with value, all the per-point width tweaks I've done are undone. Is there any way to prevent this, or to maybe export the per-point values so that I can reload them after they're lost?
     
  7. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Yes, the package include side objects with various additional line. These can be activated/decativated per marker for curves.

    Thanks,
    Raoul
     
  8. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi SpencerPDX,

    Yes, global road width changes will overwrite individual marker road shape changes. What could be added is showing a dialog box asking whether this should be done. Or change the width of these changed shapes relative to the global road width change? .

    It is probably too late but Undo will restore the marker settings.

    Thanks,
    Raoul
     
    SpencerPDX likes this.
  9. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Hi @raoul

    Thanks a ton for all the speedy replies.

    Understood, and yes, I could see the value of either approach. In my case just now, I changed the global width and very much hoped the changed shapes were going maintain their relative sizes. But I could also see someone not wanting to be locked into that approach, preferring instead to start over with a new global size.

    Not sure how best to present those options, but one way could be like you say, have a dialog box: "Maintain relative sizes or start over with a new global size?" Or you could default to having sizes change relative to the global size, and then have a way to undo the custom per-marker sizing. I imagine something like a check box in each point's inspector that would get checked when you start tweaking the marker's size, but when unchecked would remove the custom changes. (Then I guess you could always check it again and those custom changes would reappear?)

    And I did try undo, and it did work just fine (after a bit of delay, I assume because the road is pretty long). But in this case the global width really needed to be changed so there was no getting around having to just changing it and redoing the per-marker sizing.



     
  10. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Can anyone suggest a reason I'm getting this dark edge along the edge of the road?



    It's there regardless of whatever material or road type I switch to.

    I created another road in another project and when I switch to this material on the road I have there I don't see the dark edge:



    I feel like I must have started with a certain road type or just hit a checkbox I shouldn't have but I can't think of what it would have been.
     
  11. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Completely agree with this, that detail changes should be (where possible) maintained if the user decides to change a global value.
    There are a couple ways to do this, that are probably the most useful:
    1. Changing the global value will affect all the handles EXCEPT those where the user has detailed different values.
    2. Changing the global value will affect all the handles and add/subtract in proportion with the new value in respect to the old one. In example, if my road was 10m large and I change it to 11m globally, and I had a couple of handles that I modified to be at 8m large, they will be changed into 8.8m large instead than 11m.
     
  12. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi SpencerPDX,

    Which material / shader, road type, road shape is involved?

    This looks like a result of the shape / normals. For terrain related side objects, snapping objects to the terrain will set the normals to the terrain normals for these vertices. This could be added as an option for roads as well.

    Or is the road in the first image flat?

    Thanks,
    Raoul
     
    SpencerPDX likes this.
  13. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi megmaltese,

    I made a note yesterday, this will be added for the next update.

    Thanks,
    Raoul
     
    PolyMad likes this.
  14. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    This is throwing me off today.
    Using a T connection in the HD pro package
    Its not letting me do a connection. It allowed me to do a connection on one side as shown in the picture.
    The road that its not allowing me to is the same exact road type.
    Has 2 segments to. Shouldn't be an issue there.

    The dot on the connection only turns red when I go to drag the road on to it. Unlike the issue I had in the past with wrong segment amounts it was red just by simply selecting the road. Which leads me to believe its a new reason why I can't connect.



    Edit: Interesting it doesn't allow me to connect on the other side either. So only allow me to connect to a single side.

    I changed it to a 4 way crossing and still same thing only lets me connect to one side. The same side to oddly enough.


    So I added another T connection on the other end of the parking lot. The same T connection that exists on the other side and it let me connect to it but it won't let me connect to the other two sides. Same situation but with a different connection side.




     
    Last edited: Sep 26, 2018
  15. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    The setup of the HD Roads package is that all HD Road types can connect to all HD road prefabs provided that no critical data like sub segments is altered on either of the two.

    Can you pull out a new road from that connection?

    Can you create a new road using the same road type, can this road be attached to that connection? If not, can you try another HD Roads road type.

    Can this road be attached to any of the other connections of this prefab or to any connection of another HD Roads prefab.

    Does this happen for that specific connection on any instance of that specific prefab or only this instance?

    From these questions it should become clear if this is related to the crossing prefab (and perhaps this instance only) or the specific road.

    Thanks,
    Raoul
     
  16. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Great! :)
     
  17. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Hmm, first off, I may have stumbled upon a fix just in trying to take screen shots for this post

    To answer your question, I think it's flat. That is, the terrain is conforming to the road:



    You can see my settings there too.

    You can also see how that dark edge seems to be some kind of an intentional edge texture, assigned to an ribbon of polygons along the side of the road. Not sure how that came to be, but I can tell you that I built this road as I was trying to figure out EasyRoads, and tried a lot of different things. I tried different roads in the Road Type drop-down, and swapping in my own material in the slot below "Road Material."

    I just tried switching to Asphalt_Dotted or something like that - at which point it said something about losing side objects - and then back to these settings, and the edge seemed to disappear, but I lost the terrain contours (I'm hiding the terrain to take these shots). Then I unhid the terrain, toggled Follow Terrain Contour on and off and it seemed to affect the terrain correctly, AND the edge ribbon is still gone.

    So I suspect in trying different road types, I stumbled upon one that puts that edge of polygons with some kind of blend texture on it - is there a road type that does this? Could adding a bridge have caused it? - and then when I switched to other types or materials that edge never went away. Until I switched to asphalt_dotted or whatever it was, while writing this post.

    I'll keep at it and make sure this has indeed fixed itself, but in the meantime if you have thoughts on how this came to be so I can avoid it in the future, that could help a lot. Thanks!
     
  18. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi SpencerPDX,

    Looking at this screenshot it seems side objects are created on the road edge.

    You can see this in the side object settings for the road (just below the bottom buttons in your screenshot), please check all side object tabs for active side objects. You can also press the "Select Object in Hierarchy" button visible near the bottom of your screenshot. This will select the actual road game object. Are there any additional child objects parented to it?

    Thanks,
    Raoul
     
  19. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Aha, that was it. Under "props" Dust Left and Dust Right were checked. Not sure when I did that, but needing to learn EasyRoads quickly I did a lot of trial and error, and probably turned those things on and didn't think to turn them off again. (I think I expected them to spread dust outward from the road, I probably tried them with a dirt road active so they weren't very visible, and not seeing them I left them on to see if I'd figure how to work them later.)

    Thanks a ton for the speedy reply and for clearing that up.
     
    raoul likes this.
  20. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Dust Left and Dust Right are side objects part of the HD Roads package. I didn't realize you had this package imported as well. Glad this is resolved!

    Thanks,
    Raoul
     
  21. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    I don't understand why connections are that complicated though.

    I looked at the connection prefab and each connection has 3 sub segments.
    3 green dots.
    Each road that I'm trying to attach is the same road type set to 2 sub segments.
    What other requirements are there for connections?

    The road must match the amount of segments as connection prefab
    Every road connecting must be the same road type

    How can the same road type connect to one side of the prefab but not the other two sides.

    The only difference there is to the connection is the rotation of the connection prefab.
    I tried a T and a Y connection. So weird?
     
  22. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    I restarted my computer and now I was able to do the connection on the 2nd side shown in picture
    I go and try to drag the last unconnected side and its doing the same thing saying can't connect.
    Either restarting unity or my computer fixed it for one side and then it went back to bugging out again.
    I'm gonna restart Unity to if it will then let me connect. If not then try a computer restart again.
    maybe a bug in Unity 2018.2.8f1?



    Edit: Restarted Unity and even tried restarting my computer seems to have nothing to do with the fix for it ha. Idk why i was able to do that one more connection when I was away from my computer for several hours.
     
    Last edited: Sep 27, 2018
  23. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    In my last post I asked some questions. Please answer these questions if you want to find out what was wrong.

    To answer your question, because of its flexibility in supporting different, shapes connections cannot be compared, they all have data specific to that connection. When the connection shape and road shape match, the only other situation that will result in a red connection handle is when the angle with the road is too sharp. But that is not the case in the screenshot you posted.

    So now, attaching this particular road to the connection does work? What has changed? If the roads now can connect to that same connection then the problem seemed more road related.

    To answer that, what are the answers on my questions in my previous post? That sort of tests will isolate this issue. I would love to see your workflow. You seem to jump from one problem in another, or are things generally working well?

    Thanks,
    Raoul
     
    Last edited: Sep 27, 2018
  24. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Hi again @raoul,

    I've moved on to placing grass near the road and am trying to use the "Paint Details" feature to do this. For some reason the blue paint reticle doesn't even appear on this terrain. I can paint trees onto this terrain using the "Paint Trees" tool, but not grass. An issue I've seen mentioned by people having trouble painting grass is that the grass is simply being culled because it's too far away, but that's not the case here - like I said, I can't even get the blue paintbrush to show up. And if I create a new terrain from scratch in the same scene, I can paint grass onto it.

    Kind of a long shot I realize, but is there anything about the way Easy Roads affects terrain that might be preventing grass from being painted on it?

    EDIT: Just realized the detail resolution on the terrain objects that make up this overall terrain is set to 0. I can't imagine Easy Roads causing this, and I'm using a plugin to create the terrain from satellite data so that's a more likely culprit. But covering all bases: Could you imagine Easy Roads changing that setting? Thanks!
     
    Last edited: Sep 27, 2018
  25. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    I've had that issue before Spencer with not using easy roads.
    What Unity version you use?
    Had that issue back when I was using Unity 2027.3. think that was the version.
     
    SpencerPDX likes this.
  26. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi SpencerPDX,

    Indeed I dont think this is related to EasyRoads3D. It does not include any code related to altering terrain settings like heightmap resolution or, in this case, detail resolution.

    It does optionally bake the road shape in the terrain splatmap, but that is based on the current detailResolution.

    Thanks,
    Raoul
     
  27. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Interesting. I'm on 2018.20f2.
     
  28. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    OK, thanks for the confirmation!
     
  29. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    I'm on version 2018.2.8f1 and I can't paint details right now either.
    Completely dead feature.
    I think I tried it when I was using 2017 LTS version and it worked just fine.
    Also I should mention I've seen painting grass not work on past versions as well even before the 2017.3 version.
    Nice to see someone else having that issue to though. Should report that to Unity.
    I don't have much use for it though cause it only paints one type of grass at a time.

    Just curious why you even painting grass. have you tried vegetation studio out? Its so amazing :)
     
  30. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    @Shadowing , you might have missed that I figured out the source of the problem: "EDIT: Just realized the detail resolution on the terrain objects that make up this overall terrain is set to 0. I can't imagine Easy Roads causing this, and I'm using a plugin to create the terrain from satellite data so that's a more likely culprit."

    Thanks for the suggestion on vegetation studio, I'll have to check it out.

     
  31. Sk4tOoR

    Sk4tOoR

    Joined:
    Sep 19, 2018
    Posts:
    14
    Hi there,

    i've got a serious bug regarding EasyRoads. Whenever i select the RoadNetwork in the hierachy, there is a ArgumentOutOfRangeException spaming in the console. The Editor is slowing down and it is hard to keep working with ER. Deselecting the RoadNetwork stopps spaming the console.

    Here's the full text of the error:

    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <e1a80661d61443feb3dbdaac88eeb776>:0)
    System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <e1a80661d61443feb3dbdaac88eeb776>:0)
    System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <e1a80661d61443feb3dbdaac88eeb776>:0)
    EasyRoads3Dv3Editor.ODCCQDCOOO.DoGrid (System.Int32 windowID) (at <5205e3830edb4393aef8789e366ce867>:0)
    UnityEngine.GUILayout+LayoutedWindow.DoWindow (System.Int32 windowID) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:517)
    UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Modules/IMGUI/GUI.cs:1676)
    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr)
     
  32. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hello Sk4tOoR,

    The error points to drawing the grid box in the Scene View Window. This is related to:

    General Settings > Scene Settings > Grid Control

    As a start and to deal with the error?, What is the status here? Are grids active? Does the error indeed disappear when deactivating grids?

    Thanks,
    Raoul
     
  33. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Hi Raoul, I've got road segments to join end-to-end as shown, but I was wondering if there is a way of creating a T-junction that is just as easy. I thought I had seen something like that in a video somewhere. Otherwise, the main option is to place a T-junction object and attach roads to it?
     
  34. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi SpencerPDX,

    There are three options:

    1) With no road selected, select a crossing from the crossing / connections tab in the Inspector and Shift + Click in the scene to instantiate it.

    2) With any road marker selected, open the same crossing / connections tab. This time only matching prefabs will be displayed. Selecting a prefab will auto attach / insert it to the selected road.

    3) Move road markers over other road sections. When a prefab match exists for the involved roads a blue circle will appear, releasing the mouse button will auto connect the roads.

    Depending on how many roads are connected, it is possible to auto rotate / swap connections in the Inspector. This can be useful for T crossings.

    Thanks,
    Raoul
     
    SpencerPDX likes this.
  35. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    168
    Fantastic, I'll give those a shot. Thanks again, @raoul!


     
    raoul likes this.
  36. Sk4tOoR

    Sk4tOoR

    Joined:
    Sep 19, 2018
    Posts:
    14
    Hey Man,

    Thanks for your answer. I was able to avoid the error quickly!

    Right now the Global Grid is deactivated and i created a Local Grid which is activated. In this status there are no errors. As soon as i deactivate the Local Grid, errors are spaming again when working with Easy Roads. I'm working with a Local Grid now which is OK at the moment.


    Another problemcame up recently. How can I activate the handles to adjust added Side Objects on a road? The handles disappeard once. Got no idea what happened there :(
     
  37. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Sk4tOoR,

    I think I was able to replicate the grid issue. It is indeed related to no local grids being available while local grid display is switched on (the L key triggers that).

    Side object handles display is triggered by the H key. Since this is related to fine tuning offsets, the handles only display when the scene cam is close enough to these handles.

    Thanks,
    Raoul
     
    Sk4tOoR likes this.
  38. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Where can I get a dirt road texture like this at where it has tire tracks in it. Not talking about the snow part of it.

     
  39. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Hi shadowing,

    It looks like the dirt track from the free demo project (if you have the Pro version), Please import in a new project as it includes many additional assets.

    https://assetstore.unity.com/packages/tools/terrain/easyroads3d-demo-project-105045
    .



    Or



    Thanks,
    Raoul
     
  40. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Doesn't it look like the trees are not casting shadows on the road?
    I have shadows in the 2nd picture so I don't believe its an issue with easy roads.
    Vegetation studio isn't casting shadows on the roads?
    My light source is set to cast on all layers except UI atm.




     
  41. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    What shader are you using?

    As you can see from the screenshot in my previous post the dirt track does receive shadows from the tree. The ER Road Transparency shader is used here. The Unity Standard transparency shader for example does not receive shadows.

    Thanks,
    Raoul
     
  42. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Alright I have narrowed down the issue.
    I'm using shader EasyRoads3d/Unity2018

    if I change Rendering Mode to Opaque I have shadows.
    The shadows goes away if I change Rendering Mode to Fade or Transparent.
    In this case I'm using Fade. Which is allowing it to render the alpha channel on the sides of my road.

    I just realized I have shadows when im in edit mode.
    Shadows goes away if I build terrain with using update Terrain Splatmaps.

    If i don't add a splat map when building terrain I'll have shadows.

    so it has something to do with applying splat texture with the road when using Rendering Mode: Fade
     
    Last edited: Oct 4, 2018
  43. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Do you mean the adapted Standard shader? That shader is based on the Unity Standard shader, the same applies, shadows are not supported in Transparent mode,.

    It is not very likely the splatmap option has any effect here. The only thing it does is updating the terrain splatmap.

    Have you tried the ERRoad Transparency shader, or the version in the HD Roads package?

    Thanks,
    Raoul
     
  44. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    adapted Standard shader?
    Idk what ever the shader is at location Easyroads3d / Unity2018

    I just know if I click Update Terrain Splatmaps before clicking Build Terrains i lose shadows
    I tried it 4 times happens every time. If I unclick it before Build Terrains I'll have shadows.
    Also after shadows are removed when adding a texture with the road if I hit back to edit mode I get shadows back.

    If I use ERRoad Transparency shader I get shadows with using Update Terrain splatmaps. The issue with that though is I lose specular on the road. so I lose the wetness look on my road.

    I don't see a transparent shader in the HD Roads package.
    Only Standard_Metalic_road_shader and Standard_Metalic_Road_Shader Parallax


    So I guess I just need a specular option added to ERRoad Transparency shader
    Is that a easy thing to add?

    Edit: I tried uncommenting Glossiness on your shader but that slider didnt give me back the wet look lol.
     
    Last edited: Oct 4, 2018
  45. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    All I am saying is that there is no logical explanation for different behaviour of road materials in Edit Mode / Build Mode directly related to updating terrain splatmaps. The road mesh / gameobject is not involved in this process.

    For HD Roads the shader is located in: /Assets/NatureManufacture/Shaders/

    For specular in the EasyRoads3D Transparent shader you need a new specular texture selector (_Specular) in the properties block and declare it. Have a look how this is done for example for _MainTex and _BumpMap

    near the bottom in void surf() add something like:

    half _spec = tex2D(_Specular, IN.uv_MainTex);
    o.Specular = _spec;

    Thanks,
    Raoul
     
  46. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Do you have more than 4 shaders in there Raoul?


    sorry man I wasn't trying to get hostile when I worded the steps I was doing. Was just showing my exact steps in how I was duplicating my problem. It doesn't make any sense to me either. Adding the texture with the road build is definitely tripping the shadows on and off though.
    Either way your transparent shader works I just need to get it looking shiny now. so I'll ignore whats tripping it. :)

    I haven't messed with shader code before. I don't know Cg.
    I'll see if I can fiddle with it by looking at the other properties.

    If i look closely it looks like the shadows is going under the road.
    so they are going through the road and onto the terrain.
    Maybe its a Unity bug.
     
  47. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    Yes, I understand :) The problem here is that 1) as mentioned, there is no direct relation between the road object / materials and the terrain splatmap and 2) There is no history of this. It makes it hard to give feedback. And as far as I know only the Opaque and Cutout rendering modes receive shadows in the Unity Standard shader and yes, shadows will still cast on the terrain below the road. This is all Unity behaviour, the same will happen with for example a plane primitive. But if you want you can email a link to the project so we can look at it.

    The HD Roads packages is mainly created by the NatureManifacture team, probably more shaders will be added. We ourselves currently focus on expanding the tool itself with more features. Shaders is external more material related so there is no direct dependency on EasyRoads3D. But for sure more shaders will be available in the future.

    Only the mentioned 3 steps to adapt the EasyRoads3D Transparency shader is what is required, 4 lines of code. You can indeed take the other textures as an example. The shader is simple just search on "_MainTex" or "_BumpMap"

    Thanks,
    Raoul
     
    Last edited: Oct 4, 2018
  48. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    undeclared identifier '_Specular' at line 55
    Idk can't figure out why its saying this is undefined

    Thinking I need to add this sampler2D _Specular;
    but now Im getting hit with invalid subscript 'Specular' on line 63

    Code (csharp):
    1.  
    2. Shader "EasyRoads3D/ER Road Transparency" {
    3.     Properties {
    4.         [Header(Road Texture)]
    5.         _MainTex ("Road", 2D) = "white" {}
    6.         _Color ("Color", Color) = (1,1,1,1)
    7.         _BumpMap ("Road Normal", 2D) = "bump" {}
    8.         _Metallic ("Road Metallic/Smoothness", 2D) = "black"{}
    9.         _Specular ("Specular", 2D) = "white" {}
    10.         _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
    11.     }
    12.     SubShader {
    13.         Tags {
    14.             "SplatCount" = "3"
    15.             "Queue" = "AlphaTest"
    16.             "RenderType" = "TransparentCutout"
    17.             "ForceNoShadowCasting"="True"
    18.         }
    19.         LOD 200
    20.         Offset -2, -2
    21.         CGPROGRAM
    22.         #pragma surface surf Standard  fullforwardshadows decal:blend
    23.         #pragma target 3.0
    24.         #pragma multi_compile_fog
    25.         #pragma exclude_renderers gles
    26.         #include "UnityPBSLighting.cginc"
    27.         half _depthThresh;
    28.         uniform sampler2D _Control;
    29.         sampler2D _MainTex;
    30.         sampler2D _BumpMap;
    31.         sampler2D _Metallic;
    32.    
    33.         half _NormalStrengh;
    34.         struct Input {
    35.             float3 worldPos;
    36.             float3 worldNormal;
    37.             float2 uv_MainTex : TEXCOORD0;
    38.             float2 uv4_BumpMap : TEXCOORD1;
    39.             float2 uv_Metallic : TEXCOORD2;
    40.             float4 color : COLOR;
    41.             INTERNAL_DATA
    42.         };
    43.         fixed4 _Color, _Color2;
    44.         half _Threshold;
    45.         void surf (Input IN, inout SurfaceOutputStandard o) {
    46.             fixed4 alb = 0.0f;
    47.             float4 c = IN.color;
    48.             float4 _main = tex2D (_MainTex, IN.uv_MainTex) * _Color;
    49.             float4 _main1 = tex2D (_MainTex, IN.uv4_BumpMap) * _Color;
    50.        
    51.             fixed4 nrm = tex2D(_BumpMap, IN.uv_MainTex);
    52.             half alpha = 0;
    53.             alpha = _main.a * c.a * IN.color.a;
    54.             float4 _met = tex2D (_Metallic, IN.uv_Metallic);
    55.             half _spec = tex2D(_Specular, IN.uv_MainTex);
    56.        
    57.             o.Normal = UnpackNormal(nrm);
    58.             o.Albedo = _main.rgb;
    59.             o.Alpha = alpha;
    60.             o.Smoothness = _met.a;
    61.             o.Metallic = _met.r;
    62.             o.Occlusion = _met.g;
    63.             o.Specular = _spec;
    64.         }
    65.         ENDCG
    66.     }
    67.     Fallback "Standard"
    68. }
    69.  
     
  49. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    This compiles without errors but not fully tested

    Code (csharp):
    1.  
    2. Shader "EasyRoads3D/ER Road Transparency" {
    3.     Properties {
    4.         [Header(Road Texture)]
    5.         _MainTex ("Road", 2D) = "white" {}
    6.         _Color ("Color", Color) = (1,1,1,1)
    7.         _BumpMap ("Road Normal", 2D) = "bump" {}
    8.         _Metallic ("Road Metallic/Smoothness", 2D) = "black"{}
    9.         _Specular ("Specular", 2D) = "white" {}
    10.         _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
    11.     }
    12.     SubShader {
    13.         Tags {
    14.             "SplatCount" = "3"
    15.             "Queue" = "AlphaTest"
    16.             "RenderType" = "TransparentCutout"
    17.             "ForceNoShadowCasting"="True"
    18.         }
    19.         LOD 200
    20.         Offset -2, -2
    21.         CGPROGRAM
    22.         #pragma surface surf StandardSpecular  fullforwardshadows decal:blend
    23.         #pragma target 3.0
    24.         #pragma multi_compile_fog
    25.         #pragma exclude_renderers gles
    26.         #include "UnityPBSLighting.cginc"
    27.         half _depthThresh;
    28.         uniform sampler2D _Control;
    29.         sampler2D _MainTex;
    30.         sampler2D _BumpMap;
    31.         sampler2D _Metallic;
    32.         sampler2D _Specular;
    33.    
    34.         half _NormalStrengh;
    35.         struct Input {
    36.             float3 worldPos;
    37.             float3 worldNormal;
    38.             float2 uv_MainTex : TEXCOORD0;
    39.             float2 uv4_BumpMap : TEXCOORD1;
    40.             float2 uv_Metallic : TEXCOORD2;
    41.             float4 color : COLOR;
    42.             INTERNAL_DATA
    43.         };
    44.         fixed4 _Color, _Color2;
    45.         half _Threshold;
    46.         void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
    47.             fixed4 alb = 0.0f;
    48.             float4 c = IN.color;
    49.             float4 _main = tex2D (_MainTex, IN.uv_MainTex) * _Color;
    50.             float4 _main1 = tex2D (_MainTex, IN.uv4_BumpMap) * _Color;
    51.        
    52.             fixed4 nrm = tex2D(_BumpMap, IN.uv_MainTex);
    53.             half alpha = 0;
    54.             alpha = _main.a * c.a * IN.color.a;
    55.             float4 _met = tex2D (_Metallic, IN.uv_Metallic);
    56.             fixed3 _spec = tex2D(_Specular, IN.uv_MainTex);
    57.        
    58.             o.Normal = UnpackNormal(nrm);
    59.             o.Albedo = _main.rgb;
    60.             o.Alpha = alpha;
    61.             o.Smoothness = _met.a;
    62.         //    o.Metallic = _met.r;
    63.             o.Occlusion = _met.g;
    64.             o.Specular = _spec;
    65.         }
    66.         ENDCG
    67.     }
    68.     Fallback "Standard"
    69. }
    70.  
    Thanks,
    Raoul
     
  50. CrIxX91

    CrIxX91

    Joined:
    Sep 9, 2015
    Posts:
    9
    hi everyone i need your help,yesterday finally could buy this asset but i have a big problem, i was tried to add the prefab "roundabout 4 connection", i need add but can't. why is generated a infinity bucle and i can't finish? (1)

    also have another problems, the road disappear in some places on my terrain(2) and when i try to see the rest of the road (in white lines (3)).

    i add the screentshots waiting for help.


    01*
    Captura de pantalla (8).png

    02*
    2018-10-04_11-34-14.jpg

    03*
    2018-10-04_11-34-39.jpg

    Cheers and thanks :D