In this tutorial you will learn how to create lighting in a Unity 2019 HD Render Pipeline project using the Tridify BIM Tools. The workflow differs from the Unity 2018 version.
Explore the benefits of the Tridify BIM Publishing Service and start a FREE 14-day trial (no credit card required)
Version used in this tutorial: Unity 2019.1, High Definition RP package 5.7
Note: The settings and values used in this tutorial work in this example project. You might need to experiment with different settings to better suit your needs.
Setting up the scene
Create a new Unity Project, select High-Definition RP Template.
Prepare the scene. In the Hierarchy window delete Example Assets, Scene Post-process and Directional Light. Create new Directional Light (menu: GameObject > Light > Directional Light) to simulate sunlight in your scene. Select the light and in the Inspector window set Intensity to 6. Enable shadows (Shadows > Shadow Map) and increase the Shadow Map Resolution to 2048.
Delete ExampleAssets folder in the Assets directory (Project window > Assets).
In the Lighting Settings (menu: Window > Rendering > Lighting Settings) untick Baked Global Illumination and make sure Auto Generate is Off. Enable Realtime Global Illumination.
Unity 2019 and current HDRP package versions (5.7, 5.13) have some issues with Procedural Sky. You can use a background color or, as in this tutorial, Skybox to give the impression of scenery. Import HDRI image* to the project (Project window, create new folder, menu: Assets > Import New Asset…). Select the image file and in the Inspector change Texture Type to Cube and click Apply.*Tip: To find an HDRI image you can use words '360 HDRI' in an online search.
Select Default Post-process (Hierarchy window) and in the Inspector uncheck Exposure.
Select Rendering Settings (Hierarchy window) and uncheck or remove Procedural Sky and Volumetric Fog. Click Add Override and add HDRI Sky. In Visual Environment component change Type to HDRI Sky. In HDRI Sky component enable Hdri Sky and assign your HDR Cubemap to it. Enable Sky Intensity Mode and Exposure. Set its value to 3. In Static Lighting Script component change Static Lighting Sky to HDRISky.
Save the scene.
Import your BIM
Download and import the Tridify BIM Tools into your Unity project. To ensure that you have the latest version of the Tridify BIM Tools, check that the version number in your project (Unity menu: Tools > Tridify > About Tridify BIM Tools) is the same as on Tridify BIM Tools download page.
Import your model into the project with the Tridify BIM Tools (menu: Tools > Tridify > Conversion Projects). Note that the IFC file has to be processed in the Tridify BIM Publishing Service before the import.
Upgrade the materials
The imported model uses Unity’s built-in render pipeline materials by default. Upgrade your project materials to HDRP-compatible materials (menu: Edit > Render Pipeline > Upgrade Project Materials to High Definition Materials).
All transparent materials, like glass, has to be set as Transparent in the Surface Options (Project window > Asset > Floors > Materials, select the material, Inspector window > Surface Options > Surface Type).
Current versions of HDRP do not support translucent shadows and handle windows, for example, as if they were opaque. Use Tridify Search Tool to select all Window objects (menu: Tools > Tridify > Search Tool: IFC Product Type, type in Window, click Search and Select) and change Cast Shadows (Inspector > Mesh Renderer) to Off. Do the same for all transparent elements in the scene.
Create interior lighting with Floor Lighting tool in the Tridify BIM Tools (menu: Tools > Tridify > Floor Lighting). In the Floor Lighting window check that object definitions are correct. If not, the definitions have to be made manually. Create Floor Lighting.
To make working easier, you can minimize the 3D icons of the Emitting Lights; on the Scene tab, press Gizmos and adjust their size with the slider.
The Floor Lighting tool creates light planes to the ceilings. The planes use emissive material to emit light. Upgrade the material to HDRP by selecting EmissiveLights material (Project window > Assets > Scenes) and in the Inspector change EmissiveLights Shader to HDRP/Unlit. Change EmissiveLights material’s Emissive Color to white (Emission Inputs > HDR Color box) and increase the Emission Intensity to 6 (HDR Color box).
If you want the light planes to be visible you can leave them as they are. If you want them to emit light but be invisible change EmissiveLights material’s Surface Type to Transparent (Inspector window > Surface Options > Surface Type). Also change material’s Color Alpha (Surface Inputs > Color box) to 0 to make them fully transparent. Emitted light will be visible after lightmaps have been generated.
The Floor Lighting tool also creates Light Probes to add indirect lighting for objects that will be moved around (furniture etc.).
Objects that will not be moved (i. e. buildings) should be included in the lightmapping process for better quality global illumination (GI). Those non-moving objects have to be marked as Static. Select your parent object in the Hierarchy window and mark as Static in the Inspector (right top corner in Inspector window). Change child objects as well.
Before baking lightmaps check that every requested configuration for HDRP is working well. To configure your Unity project is compatible with HDRP open Render Pipeline Wizard (menu: Window > Analysis > Render Pipeline Wizard). If there are any issues you can press Fix All.
Finally we generate lightmaps. In this example we use precomputed realtime GI, that allows us to have bounced light and change it in realtime. Click Generate Lighting. Baking lightmaps can take from a few minutes to several hours depending on the size of the model.
To take your project to the next level, you can add furniture, use reflection probes and/or screen space reflections, add new post-processing effects and change materials using the Material Replacer in the Tridify BIM Tools.