AR Lighting and Shadows with Unreal

In this tutorial, you will learn how to illuminate the real world with virtual lights and allow virtual objects to cast shadows on it.

We will use the project created in the previous tutorial Build your first MR App.

Illuminate the Real-World with a Spot Light

Let’s add a Spot Light to the scene.

  • Add a Spot Light in the scene.

  • Set its Location to (0, 0, 0) at the location of the main camera.

  • Set its Rotation to 0.

  • Enable the Lighting Channel 3. This is the lighting channel that affects the real-world image captured by the ZED. Any virtual light with the Lighting Channel 3 enabled will affect the image.

  • To allow virtual objects to cast shadows in the real scene, enable the Cast Shadows checkbox.

  • Click on the BP_ZED_Initializer and add the Spot Light to the child actors. This will automatically attach the Spot Light to the player pawn.

Adding Ambient Lighting

To improve the integration of virtual objects in the scene, you can enable Environmental Lighting. The environmental lighting module analyzes the ZED image and computes indirect lighting coefficients. This feature is still in development but provides a good approximation of the ambient lighting of your environment.

  • Click on the Directional Light in the world outliner. Under Zed, enable Environmental Lighting.

  • Go to Stereolabs Content/Environmental Lighting/Blueprint and add the BP_EnvironmentalLighting_Manager to the scene.

  • Click on the BP_EnvironmentalLighting_Manager in the world outliner and select the directional light.

Rendering Mode

Currently, only deferred rendering mode is supported. Forward rendering is not supported.

Note on Particle Lights

Due to the base engine issue UE-33329, particle system lights always affect real world as we use light channels. If this is a problem for your application, you can vote for this engine issue to have it solved by Epic team.