StreetMkr is designed to provide an easy what-you-see-is-what-you-get interface for laying out city streets and sidewalks, while allowing for a great deal of customizability and modifiability. StreetMkr also helps to bootstrap the design process by allowing the import of OpenStreetMap data, making it easy to import entire towns.
StreetMkr consists of a few primitives:
– The terrain (a standard unity terrain)
– The “street network” (a container object for streets and intersections)
– Street “themes” (A collection of street and intersection prefabs)
– Intersections
– Streets
– Sidewalks
Generally, you place intersections on the terrain, and then connect those intersections via streets. Each intersection has a customizable number of connection points (known as intersection edges), which can be moved and resized. So you can have a 3 way intersection, 4 way intersection, and so on. Think of intersections more as “places where streets meet up” than “places where cars would stop”. For instance, in StreetMkr the place where a highway onramp/offramp meets the highway itself would be considered an intersection, even though cars aren’t stopping there (hopefully!).
Streets are defined as curves connecting intersection edges, with however many control points are desired.
You can also specify that streets have sidewalks, which are automatically generated, and the various properties of the sidewalk (width, height, etc.). Connecting sidewalks between streets is done automatically.
That’s all pretty jargony. Basically, you put down intersections and then connect them via streets, and customize things as you go along. Almost everything is changable, so StreetMkr can easily be used to prototype how you want a city layout to look, along with also giving you a usable set of meshes for the final product.
While I won’t make a direct comparison, imagine if you could play certain well-known city building games within your Unity editor. It’s not quite like that, but that level of ease-of-use is the intent. The idea is to be able to layout a city very easily by thinking about how your city connects.
Right. So let’s make a city.
First thing we need to do is make a Terrain. Street networks are always attached to terrains. In the future we’ll allow for arbitrary meshes, or groups of terrains, but we’re not quite there yet.
After you create a terrain that you’re satisfied with, we need create a “Street Network”. This can simply be done by going to the menu: “GameObject->Create Other->Street Network”.
Now that you have a Street Network object in your scene, you need to attach it to the terrain. Go to the “Hiearchy” window, and drag the “Street Network” on top of the Terrain, making the Street Network a child. It should now recognize that it’s attached to the Terrain.
The next step is you need to give the Street Network a “theme”. Currently, there’s only one theme bundled, although there’s no reason you can’t make more! Each theme is a single prefab. In the project window, navigate to “StreetMkr/Themes/Default Theme”. Drag the Default Theme into the appropriate receiver in the inspector for the Street Network.
The theme object essentially defines what street and intersection objects are available in your street network, so if you want to make a new street type available in your scene you’ll want to add it to the theme you’re using.
Now that you have a theme attached, a toolbar should appear in the inspector window when the street network is selected. At the moment it consists of four tools:
[ Hand (Select/Move) ] [ Add Intersection ] [ Add Street ] [ Add Street Node ]
The hand tool allows you to select and drag around intersections. The Add Intersection tool does about what you’d expect it to do, adding an intersection wherever you click. Add Street will connect two intersections, by clicking on one edge node, and then clicking on another. Keep in mind that a street *cannot exist independent of intersections*. A street always exists between two intersections. You can indeed use a street to connect an intersection to itself, although this is rarely useful. (But not entirely useless either.) Add Intersection and Add Street both work off what prefab is selected below them when the tool is active (you’ll see a modal toolbar with the various intersection/street options).
“Add Street Node” allows you to customize a street further. By default a street is a simple curve, although you can add nodes in the middle to further define it’s shape. Although you can place nodes anywhere, you should keep in mind that sharp curves tend to result in funky geometry. (Not to mention dangerous roads!) It’s better to keep your streets smooth and relaxed. If you want a really sharp turn, it’s generally better to create an intersection than it is to pinch a road at a sharp angle.
Selecting any of the streets or intersections in this mode will update the inspector to allow you to change general properties about each selected thing.
The street network is the “high level” editor, which generally lets you edit anything, although if you were to select each street or intersection individually in the scene hiearchy, they have editors that are scoped to that particular object which act similar (but not exactly the same) as the high level street editor. For instance, if you have an intersection object selected, you can drag around its intersection edges, along with adding or removing new edges.
All intersections can be moved and rotated, but not scaled. Streets themselves cannot be moved or rotated, as their location is defined in terms of their connecting intersections (however, the nodes within the street can be moved, though not rotated.) It’s generally easiest to think of movement as being 2D along the heightmap. This isn’t exactly true, but it’s “true enough” to be a useful mental model.
All streets and intersections will try their best to conform to the terrain they’re on. Occasionally, you’ll see z-fighting or geometry clipping through. There are a few things you can do to help address this:
* Adjust the “height offset” on the connecting intersections upwards. You want to be careful here not to get carried away, but this generally helps quite a bit.
* Adjust the “Detail Bias” on the road itself. This helps more with clipping than with z-fighting. Essentially this creates more geometry, which samples the terrain more frequently.
* Use a material shader with a higher z-offset or delayed rendering.
LEAVE A COMMENT