Preface

This book introduces architects and designers to using Unity for Architectural Visualization. Unity is gaining popularity as a versatile and accessible game authoring system. You get a condensed overview of the workflow between typical architectural design applications and how 3D models exported from those systems can be integrated in real-time environments.

This book takes mostly a hands-on approach and explains the exact steps that are required to complete several aspects of the setup of an interactive, real-time scene. Even though a single introductory book cannot cover everything, you get a complete overview, from the import of 3D models, over improving materials and lighting, up to the writing of several example scripts to add custom interactivity.

While many architects currently rely primarily on traditional 2D drawings and, to a lesser extent, renderings or animations, there is a growing interest in real-time presentations. Led by the development of increasingly complex computer games, many users are familiar with real-time 3D environments. This book cannot possibly teach you how to create a full computer game, but focuses instead on the most important features of computer games to develop compelling, interactive scenes for the so-called serious games.

Luckily for you, the reader, such technology has become very accessible and available without any financial investment. Unity is at the forefront of a new generation of game engines, which rival traditional commercial turnkey systems, such as the Unreal Engine or CryEngine. Interestingly, these other systems have also become more accessible in recent years, probably not by coincidence.

With the examples in this book, you can present to your clients or friends an interactive visit to your own designs and increase your presentation potential.

What this book covers

Chapter 1, An Integrated Unity Workflow, introduces the main concepts of Unity and how it integrates with CAD and BIM software. The concept of Assets and model loading is explained and several recommendations are made about model conversion and file formats to use. This is the most theoretical chapter in the book.

Chapter 2, Quick Walk Around Your Design, explains a complete example going from exporting a 3D model up to adding lighting and navigation, so you can run around freely with very little effort. The following chapters revise these techniques in more detail.

Chapter 3, Let There be Light! shines some light on the scene. You learn about the use of different light sources and shadow calculations. To avoid the heavy burden of real-time shadows, you'll use the Lightmapping technique to bake lights and shadows on the model, from within Unity.

Chapter 4, Promenade Architecturale, explains how you can navigate a 3D character from a third-person perspective. In addition, you will use a second camera to display a mini-map and add overlay information on the screen.

Chapter 5, Models and Environment, discusses the use of models imported from the internet, and the setup of a basic landscape with a custom tree and a skybox environment. There is also an important section on model optimization and performance improvements.

Chapter 6, Shaders and Textures, further dresses up the model. You'll learn about the difference between some of the default shaders and how to integrate an example glass shader. To improve the quality of materials, you will load higher-quality texture maps and experiment with procedural textures.

Chapter 7, Full Control with Scripting, introduces the Unity scripting system and its different scripting languages. We can extend projects with custom functionality writing a few basic short scripts. Some programming experience is helpful, but the examples written in C# are fairly simple and reusable.

What you need for this book

To learn about Unity, you can use any recent version of the Unity game authoring software. This book was written using the free version of Unity 4.2, but the majority of the examples work fine in the previous version, 3.5, of the software. It doesn't matter if you are a Mac or PC user, as they are treated equally by Unity.

Some examples illustrate functionality of the Pro version. To be honest, they were illustrated with the free 30-day trial that you can activate from your free license.

During the writing of the book, two very important updates to Unity became available: the inclusion of the basic iOS and Android add-ons for every Unity license and the addition of real-time shadows in the free version (since release 4.2). Who knows what newer updates will offer…

In addition, you'll need a 3D CAD or Building Information Modeling (BIM) system, such as AutoCAD, ArchiCAD, Revit, Rhino, or SketchUp. Trial-versions are available for all these applications, but chances are that if you are reading this book, you'll be familiar with at least one of them. The examples are elaborated using ArchiCAD and CINEMA 4D, but the concepts translate well to other systems, such as 3ds Max or Maya.

Finally, it is always good to know how to use Photoshop, GIMP or similar image editors.

Who this book is for

This book is primarily written for students and professional architects who know how to model buildings in 3D and have a need to turn their designs into interactive models, even if you never used Unity before.

To be fair, this book is not an introduction to professional game level development, as the methods for highly performing optimized models are often in conflict with the approach of architectural modeling and the constant need for including design changes. The way an architect creates a 3D model of a building is completely different from how a game designer would approach it, for example, using mesh topology optimization, texture atlas editing, or UV unwrapping, applied in non-CAD or BIM software.

Experience with visualization software and programming in any language can be helpful, but is not required to follow along. You will learn all the basics with the step-by-step examples.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "To react on collisions with a trigger, we use the OnTriggerEnter method."

A block of code is set as follows:

using UnityEngine;
using System.Collections;
public class loadLevel : MonoBehaviour {
  void Example () {
    Application.LoadLevel("Level1");
  }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

using UnityEngine;
using System.Collections;
public class loadLevel : MonoBehaviour {
  public string level;
    void Example () {
    Application.LoadLevel(level);
  }
}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt Publishing book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt Publishing books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt Publishing, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.