Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

Style your city in Unity

$
0
0

New tools and styles for urban landscapes

By: Greg Lemon

Use the Maps SDK for Unity 1.4 to make buildings look awesome right out-of-the-box. We’ve added a fresh look and powerful new tools for custom styling.

In previous versions of the SDK, styling buildings was done directly with Unity’s native materials using a standard surface shader. Buildings had limited UV layout options and no support for texture atlases. We’ve improved the default visual style of buildings as well as the tools for creating your own styles.

Default visual style

We built our new default style on the idea of detailed simplicity. It provides enough detail to feel like real architecture without unwanted visual clutter. We also wanted to give buildings a variety of looks, so we’re now supporting texture atlases with our custom AtlasInfo class.

The resulting facade texture atlas is below with twelve different building facades in a range of classical and modern styles. The atlas also includes facades of different dimensions, with unique window and floor counts.

Building facade atlas texture — colorization is done in Unity

The roof texture atlas uses four different roofs. While our building facade UV mapping greatly reduces texture stretching on most buildings, our roof geometry does not use the same mapping algorithm. We used strictly linear shapes for the roofs since these features would look better if stretched than circular or diagonal shapes.

Roof texture atlas

Building colorization

The latest version of the SDK gives you robust methods for colorizing various features of buildings. Create custom color palettes by hand or procedurally, and then save them as Scriptable Palette objects in the Unity project.

Colors from the palette can be assigned to building features specifically or randomly, and custom textures can be used and colorized as well.

Custom palettes allow for a wide variety of colorization options and themes.

Custom texture atlas

The AtlasInfo class allows developers to define the parameters of a texture atlas, including sprite count and sprite size, along with Mapbox-specific parameters such as floor height and the number of window columns. Subsections of atlas cells, like floors and windows, can be defined and repeated within the same building. This allows for multiple building textures of varying sizes, subsections, and proportions to be packed into a single image. You get more visual variety, efficient use of texture space, and strong performance.

To help you create and test custom atlases, we developed the Atlas Template Generator, accessible from the Mapbox menu in Unity. By providing an AtlasInfo file, you can quickly render the proportions of each atlas section and subsection into a savable texture. This allows you to open it in an image editing/painting program and use it as a guide for painting correct atlas proportions.

Developers can generate atlas templates to use as a sizing guide in the image editing program of their choice.

Get started

Making your location-based games and experiences look great is now possible with minimal setup using the Maps SDK for Unity 1.4. Developers can fully customize the look with custom colors, layers, and atlas textures.

Download the SDK and start building. Headed to GDC? Drop by our booth in the South Hall and say hello or catch one of our lightning talks to learn more about our Maps SDK for Unity.

Greg Lemon


Style your city in Unity was originally published in Points of interest on Medium, where people are continuing the conversation by highlighting and responding to this story.


Viewing all articles
Browse latest Browse all 2230

Trending Articles