UDN
Search public documentation:

ImageBasedReflections
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > DirectX 11 in Unreal Engine 3 > Image Based Reflections
UE3 Home > Materials & Textures > Image Based Reflections

Image Based Reflections


Document Changelog: Created by Daniel Wright.

Overview


Image based reflections is a feature of the DirectX 11 rendering pipeline in Unreal Engine 3. This technique is used to render realtime whole scene HDR reflections in the GDC 2011 Samaritan demo. The technique works by reflecting an approximate version of the scene at each pixel, which makes it more efficient than previous reflection techniques, such as scene captures. The approximate version of the scene is made up of 4 main components:

  • ImageReflectionActors (Textured quads)
  • Lights with bUseImageReflectionSpecular enabled
  • Coarse static shadowing from opaque surfaces
  • Dynamic shadowing from dynamic objects, reflected about a ImageReflectionShadowPlane

A scene made up of all the components:

Reflections.jpg

Enabling Image-Based Reflections


AllowImageReflections and AllowImageReflectionShadowing must be set to True in your game's engine ini. Then enable bUseImageBasedReflections on the materials you want to reflect, and place some ImageReflectionActors's so there is something being reflected.

Quick start from empty level

  • Add some static meshes or BSP
  • Create a new material, connect a Constant node with a value of 1 to the Specular input, change bUseImageBasedReflections to enabled, assign this to your scene's meshes
  • Make sure the editor is in Lit mode, it will switch to Unlit automatically if there are no lights, and then the reflections won't show up
  • Drag and drop an ImageReflectionActor from the Actor Classes tab on top of the geometry you have placed
  • Align the camera so that you can see the reflection. By default ImageReflectionActor's are one sided so you may have to rotate the camera around to the other side to see the reflection.

Note: ImageReflectionActor's are translucent so you can only select them if you enable translucent selection, which is off by default. The button that controls translucent selection is right next to the 'distance to far clipping plane' slider on the editor toolbar.

Features


Image based reflections have the following feature set:

  • HDR reflections
  • Any surface can reflect, not limited to a plane or point.
  • Varying glossiness across a surface is supported. This is useful for things like a wet road where a puddle will have a mirror reflection, and the rest of the road will have a glossier reflection.
  • Anisotropic glossiness - reflections are streaked more in one direction
  • Dynamic components - all parts of the reflection except the static shadowing can be changed at runtime

Material Properties


The following material properties affect image reflections:

  • bUseImageBasedReflections - enables or disables image reflections on this material
  • ImageReflectionNormalDampening - dampens the normal used by image reflections. This is useful because wet surfaces tend to have a bumpier normal for bouncing diffuse lighting, and a smoother normal for specular reflections. Larger values make the normal smoother (more like the underlying vertex normal) and a value of 1 means no dampening at all, use the supplied Normal directly for reflections.
  • SpecularColor - Scales the reflection contribution
  • SpecularPower - Controls material glossiness

ImageReflectionActors


ImageReflectionActors are the most basic element of the scene that is reflected with image based reflections. These define a textured quad with a few other properties:

  • bEnabled - whether the reflection is enabled or not. This can be controlled through a Matinee toggle track.
  • bTwoSided - whether the reflection will be seen from both sides
  • ReflectionColor - RGB tints the ReflectionTexture values, A controls brightness. This can be controlled through a Matinee LinearColor track.
  • ReflectionTexture - texture that will be applied to this quad in the reflection

There can be at most 85 ImageReflectionActor's enabled in the world at one time. If there are more than this, some of them will not be rendered. The more ImageReflectionActor's that are enabled, the more the image reflections will cost to render, even when the ImageReflectionActor's are offscreen (because they can still be seen in a reflection when behind the viewer).

ReflectionTexture Restrictions

The ReflectionTexture property has some restrictions because it is used with a D3D 11 texture array. The restrictions are:

  • Size must be 1024 * 1024
  • Format must be DXT5
  • Texture group must be TEXTUREGROUP_ImageBasedReflection. This texture group has special mip generation settings that blur the mip maps so that they do not appear blocky when magnified.

The RGB of the ReflectionTexture will represent how emissive the card is, and the alpha is how opaque it is.

A single ImageReflectionActor on the left, showing how glossiness is dependent on distance from the reflection point. On the right, the reflection is anisotropic and stretches out more vertically.

6NoAniso.jpg 6Aniso.jpg

The following scene is showing that any surface can pick up image reflections, it doesn't have to be the ground plane. Glossiness is affected by material Specular Power and distance to the reflector, which is why the reflection on the ground is glossier than the wall.

AnySurface.jpg

ImageReflectionSceneCapture

ImageReflectionSceneCapture is basically just a ImageReflectionActor that captures a part of the scene into its texture instead of requiring the user to manually specify a reflection texture. These are really useful for setting up a reflection for a whole building facade or something that you don't already have an emissive texture for. The scene capture will update during a lighting build, or you can force it to update without building lighting by right clicking and choosing Update.

Properties

  • DepthRange - controls the world space depth range that will be captured into the texture. When selected, a wireframe box shows how big the current range is.
  • ColorRange - used to pack HDR source values into the LDR generated texture. The default is 4, meaning that the largest color value that can be represented in the captured texture is 4.

A single ImageReflectionSceneCapture in a level, showing that it captured the building facade behind it. The wireframe box indicates the depth range that will be captured.

SceneCapture.jpg

Environment Texture


WorldInfo has some properties that allow specifying reflections coming from an infinitely distant hemisphere over the level. This is useful for adding some ambient reflections that appear that they are coming from the distance, and to bring out the detail that the shadowing methods provide.

  • ImageReflectionEnvironmentTexture - Panoramic environment texture for image reflections. The texture should be laid out so that the horizon is along the bottom (v = 0) and straight up in world space is along the top (v = 1). The u direction of the texture then corresponds to rotation around the Z world axis.
  • ImageReflectionEnvironmentColor - Color to be multiplied against ImageReflectionEnvironmentTexture, alpha controls brightness.
  • ImageReflectionEnvironmentRotation - Angle to rotate the environment texture around the world Z axis, in degrees.

An example environment texture.

EnvironmentTexture.jpg

Light Reflections


Lights have a new property called bUseImageReflectionSpecular. When enabled, their light will be reflected in a way that provides:

  • Long, streaky highlights like you typically see on a rainy night
  • Highlights that are not clamped to the influence radius of the light
  • Energy preserving specular (glossier areas have a dimmer reflection, mirror-like areas have a brighter reflection)

There can be at most 85 lights with bUseImageReflectionSpecular enabled in the world at one time. If there are more than this, some of them will not be rendered. The light also has a property called ReflectionSpecularBrightness that provides control over the brightness of this light reflection.

A scene with bUseImageReflectionSpecular enabled on all the streetlights. Notice that the distant lights have a dimmer reflection but it is still visible. The highlights are affected by the road's specular power, and they get dimmer when the material is glossier (energy conserving).

Streaky.jpg

Static Shadowing


Shadowing of the reflections is required to prevent light leaking. The primary method for shadowing the reflections is a precomputed method from the scene's opaque, static surfaces, which is generated by Lightmass during a lighting build. To use these shadows, enable bEnableImageReflectionShadowing in WorldInfo, make sure you have a lightmass importance volume surrounding the area that you want shadowing for, and build lighting. You can exclude individual objects from shadowing the reflections by disabling bCastStaticShadow on the component.

Simple scene showing how static shadowing operates. Shadow penumbra size is dependent on distance from the reflection point and material glossiness.

StaticShadowing.jpg

Dynamic Shadowing


Movable actor types (InterpActor, SkeletalMeshActor, etc) won't be included in the static shadowing method, so they will appear to float above the ground. The only dynamic shadowing supported for reflections is through a planar reflection, which you specify by placing and aligning a ImageReflectionShadowPlane actor. The most common use case for this is to place the plane at the ground.

On the left, the scene without any dynamic object shadowing. On the right, a ImageReflectionShadowPlane has been aligned with the road and the dynamic objects are now grounded.

3Unshadowed.jpg 3Shadowed2.jpg