## Water drop 4a – Reflecting wet world

Version : 1.0 – Living blog – First version was 08 September 2013

This is the fourth post of a series about simulating rain and its effect on the world in game. But it could be read without reading the previous post. The subject is “the reflection”.  The post is split in two parts A and B:

Water drop 1 – Observe rainy world
Water drop 2a – Dynamic rain and its effects
Water drop 2b – Dynamic rain and its effects
Water drop 3a – Physically based wet surfaces
Water drop 3b – Physically based wet surfaces
Water drop 4a – Reflecting wet world
Water drop 4b – Reflecting wet world

When a world scene is totally wet, the most striking visual cue is the reflected environment. Of course all surfaces permanently reflect their surrounding but this is more visible under rainy day. The topic of this post is “reflection”. The reflections as we see it in real world includes all the surrounding lighting. When we talk about reflection in game, too often we restrict this to water or smooth surfaces reflection. But “reflection” is just a convenient word to designate the normal lighting process. In game we separate lighting as direct, indirect and emissive. If you handle direct and indirect lighting on any kind of surfaces from smooth to rough, you have your reflections. There is no need of a particular process for it.
For Remember Me we decided to go this way. To get a good rainy mood, we were looking for having reflection everywhere on every surface. For example, we use the same process to get reflection on rocks as well as in puddles.

## Reflection – Theory

The observation post already presents many pictures illustrating reflection. But I will present some others here to highlights some characteristic of reflections.

Reflection with smooth surfaces

Let’s consider à perfectly smooth surface. Most people think that the reflection of a scene in surface like calm water or mirror is the scene itself upside down.

But this is a really wrong assumption. The reflection depends on the distance from reflected objects and the viewer’s position.

The differences become smaller, the closer we bring our eyes to the reflecting surfaces and the farther away the objects are. On the pictures below, see how Mickey Mouse is hidden by the blue cow until you reach a glazing angle with the mirror.

## Relationship between Phong and Blinn lighting model

version : 1.1 – Living blog – First version was 29 March 2012

Phong and Blinn are the two most used lighting models in game development. The properties of the two have been debate a lot of time and I won’t discuss this here. See [1] to know why you should use Blinn rather  than Phong when you do physically based rendering. The point of interest I would discuss is the relationship between Phong lobe shape and Blinn lobe shape. This relationship matter when you use image based lighting (IBL). In this case you generally have only one cubemap sample and can only emulate Phong shape highlight (see AMD Cubemapgen for physically based rendering). The problem come when you want to use IBL and try to match it with analytic Blinn lighting model use for direct lighting. The highlight shape don’t match. Here is a comparison between an analytic Phong (Left) and Blinn (Right) highlight with the same specular power (Click for high rez).

This post will study what we can do to better match Blinn and Phong highligh. There is really few paper about this subject [2] [3]. About Phong and Blinn relationship, it can be show that the Phong angle is twice the Blinn angle [3]:

$cos^{-1}(R.E) = 2 cos^{-1}(N.H)$

This relation allows to write

$cos^\rho(\theta) = cos^{x \rho} (\frac{\theta}{2})$

Where $\rho$ is the specular power, $\theta$ is the Phong angle ( $cos^{-1}(R.E)$ ) and $x$ is our unknown parameter. Finding the value of $x$ which best fit this equation will provide our relationship between Phong and Blinn.

Yoshiharu Gotanda give 4.2 for the value of $x$ in [2]. Frederick Fisher and Andrew Woo give 4 in [3]. Following sections will discuss these results.