Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Unity for Architectural Visualization

You're reading from  Unity for Architectural Visualization

Product type Book
Published in Sep 2013
Publisher Packt
ISBN-13 9781783559060
Pages 144 pages
Edition 1st Edition
Languages
Author (1):
Stefan Boeykens Stefan Boeykens
Profile icon Stefan Boeykens

Chapter 3. Let There be Light!

Adding a basic directional light is a simple start, as illustrated in Chapter 2, Quick Walk Around Your Design. However, chances are that you expected much more from a game engine like Unity. The basic lights only get you so far. While the free version of Unity lacks some of the features of the pro-version, we will show you how you can still get convincing lighting in your project. After all, if all you would get looks flat and dull, why use Unity in the first place?

In this chapter, we will cover:

  • Basic lights

  • Shadows

  • Lightmapping

  • Using pre-rendered models (Lightbaking in an external software)

Basic light sources


You use lights to give a scene brightness, ambience, and depth. Without light, everything looks flat and dull. Use additional light sources to even-out lighting and to set up interior scenes. In Unity, lights are components of GameObjects. The different kinds of light sources are as follows:

  • Directional lights: These lights are commonly used to mimic the sun. Their position is irrelevant, as only orientation matters. Every architectural scene should at least have one main Directional light. When you only need to lighten up an interior room, they are more tricky to use, as they tend to brighten up the whole scene, but they help getting some light through the windows, inside the project. We'll see a few use cases in the next few sections.

  • Point lights: These lights are easy to use, as they emit light in any direction. Try to minimize their Range, so they don't spill light in other places. In most scenes, you'll need several of them to balance out dark spots and corners...

Shadows


Most current games support some form of shadows. They can be pre-calculated or rendered in real-time. Pre-calculation implies that the effect of shadows and lighting is calculated in advance and rendered onto an additional material layer. It only makes sense for objects that don't move in the scene. Real-time shadows are rendered using the GPU, but can be computationally expensive and should only be used for dynamic lighting. You might be familiar with real-time shadows from applications such as SketchUp and recent versions of ArchiCAD or Revit.

Ideally, both techniques are combined. The overall lighting of the scene (for example, buildings, street, interiors, and so on) is pre-calculated and baked in texture maps. Additional real-time shadows are used on the moving characters. Unity can blend both types of shadows to simulate dynamic lighting in large scenes. Some of these techniques, however, are only supported in the pro-version.

Real-time shadows

Imagine we want to create a sun...

Lightmapping


Real-time lighting is computationally very expensive. If you don't have the latest hardware, it might not even be supported. Or you might avoid it for a mobile app, where hardware resources are limited. It is possible to pre-calculate the lighting of a scene and bake it onto the geometry as textures. This process is called Lightmapping, for more information on it visit: http://docs.unity3d.com/Documentation/Manual/Lightmapping.html

While actual calculations are rather complex, the process in Unity is made easy, thanks to the integrated Beast Lightmapping. There are a few things you need to set up properly. These are given as follows:

  1. First, ensure that any object that needs to be baked is set to Static. Each GameObject has a static-toggle, right next to the Name property. Activate this for all models and light objects that will not move in the Scene.

  2. Secondly, ensure that all geometry has a second set of texture coordinates, called UV2 coordinates in Unity. Default GameObjects...

Pre-rendered models


While Unity has a very well integrated Lightmapping system, it might make sense if you do the baking in dedicated rendering software, such as to use advanced Global Illumination. Most current DCC applications support light baking, including CINEMA 4D and 3ds Max.

When you use, for example CINEMA 4D, this is available for texture/light baking. This can be achieved by following these steps:

  1. When a scene is set up, select the object and choose Bake Object from the Objects menu inside the Objects browser.

  2. In the dialog, activate Ambient Occlusion and Illuminate and choose an output folder to save the textures to.

  3. When you press bake, CINEMA 4D will render the lighting and materials onto the object and create a new mesh, with optimized UV mapping. The original mesh is kept hidden if you ever wanted to make any changes.

  4. When the baking is done, check that it works, by disabling GI and lights and call render. In a fraction of a second, the model will be re-rendered.

  5. When you load...

Summary


This chapter took our starting scene a big step further. Lighting is essential in architectural visualization and Unity provides several options to tweak and improve the visual quality of your scene.

While you can get quite far with the free version, lighting with the pro-version is more advanced with Area lights, Bounced lighting, and Sky lights to improve Lightmapping results. In addition, the full screen image effects give a more polished effect to the result. Luckily for the users of the free version, real-time hard shadows were added for Directional lights in Unity 4.2, which could be used in any architectural scene. But use them sparingly, when you need interactive lights.

The next chapter looks at navigation in our project, using character controllers.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Unity for Architectural Visualization
Published in: Sep 2013 Publisher: Packt ISBN-13: 9781783559060
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $19.99/month. Cancel anytime}