Creating accurate 3D building shadows in Unity

Mapbox
maps for developers
2 min readAug 31, 2016

--

By Siyu Song

The new Mantle plugin for Unity, which adds real world terrain and streets to games, allows full control over lighting. Being able to simulate real world lighting conditions is key for creating immersive environments. I’ve been matching sun angles, getting highly realistic shadows to go with the accurate building footprints within the Unity game engine.

Using a directional light, I was able to match the lighting in this scene to what we see in our satellite layer. On the top you can see the morning sun and shade on Fort Mason, San Francisco, as the DigitalGlobe satellite passed 2 million feet overhead. And on the bottom is Mapbox powered terrain and streets data imported into Unity via the Mantle plugin:

mantle_compare

These buildings are imported into Unity as real geometries and integrate into my project as any other asset does. This allows me to use Unity’s lighting engine to dynamically recreate lighting to match any time of day.

Check out yesterday’s blog post on 3D fantasy environments in Unity which shows a sneak peek of the new 3D terrain and maps that Mantle is adding to Unity.

If you want early access to the new plugin, email Sean Heffernan at heffernan@mapbox.com.

--

--

mapping tools for developers + precise location data to change the way we explore the world