In this project report, we develop a method of shaping the highlights on a surface. This method can be applied to any illumination model in which reflectance can be represented by a BRDF. Shaping the highlights is accomplished by expanding or compressing the individual lobes of the BRDF according to some function whose parameters are determined empirically by the user. The goal of this technique is to allow a modeler to adjust the shape of highlights from a sampled BRDF (one obtained experimentally by sampling reflectance in various directions) in a manner analogous to the way one would shape the specular highlights in the Phong model by adjusting the coefficient and exponent. I created a tool in OpenGL for visualizing a BRDF and the effects of this transformation on it so that a user may empirically determine the desired parameter values. I also integrated this transformation into my ray tracer from the last programming assignment in order to display some objects shaded according to these transformed BRDFs.
The ideas in the project were developed in collaboration with a fellow graduate student, Ted Kim (who is not enrolled in this class). The concept and some of the math behind it is a result of our joint efforts, however the report, the visualization app, and the integration with my ray tracer were done by myself. Though I collaborated in the development of the theory behind this idea, I feel that my share of the effort is sizeable enough to match the amount of work expected of a course project.
Light which falls on a surface generally is reflected. The amount of light being scattered in any direction depends on the material properties of the surface. A BRDF, or bidirectional reflectance distribution function is a function R(θi, φi, θr, φr) of the amount of light scattered in direction (θr, φr) from light incident to the surface from direction (θi, φi). The function R when multiplied by the intensity of the light source yields the intensity of the light scattered in any direction. R ranges from 0 to infinity, and the incident and reflected angles are measured as azimuth and elevation relative to the surface's normal (*,π/2) and some arbitrary axis along the surface (0, 0). R could also depend on the wavelength of the incident light, so that different colored light would be scattered differently, but for purposes of this project we will make the simplifying assumption that light of all wavelengths is scattered the same way.
For a given incident direction (θi, φi), R can be shown as a two dimensional polar function that resembles a dome with various features along its surface. These features, called lobes, represent reflectance effects, such as specular reflection, that affect light scattered in a certain range of directions. For the most part, these effects are local phenomenon in that they are centered around some ideal direction and their strength falls quite rapidly when viewed farther away from this ideal direction. For example, under Phong model, shown in Figure 1, R has a hemispherical shape with a fixed radius which is the sum of the ambient and diffuse light (which is constant for a fixed incident direction). Around the angle of perfect reflectance, or the mirror angle (θi, π-φi), is a lobe which represents the specular reflection that is visible close to this mirror angle. As deviation from the mirror angle increases, the reflectance decreases.


The BRDF depends on the material properties of the surface. Models such as Phong and Cook-Torrance give a formula for the reflectance for a particular class of surfaces. Each model has a set of parameters that may be adjusted to simulate variations of the material and the effects of various lighting situations in the scene. For example, the Phong model effectively simulates the reflectance of plastic surfaces. The specular coefficient and exponent can be adjusted to produce various degrees of shininess. The diffuse and ambient coefficients can be adjusted to give the feel of various lighting conditions, such as daylight outdoors in which light is scattered everywhere in the scene and does not have as large a directional dependence. For a detailed discussion of the characteristics of various lighting situations, along with numerous illustrations, see [Hog].
Many surfaces, however, do not have any sort of analytical model describing their reflectance. There have been several attempts to determine the reflectance for materials through experimental observation ([Mar], [McA]). These techniques involve placing light sources at different orientations, and for each light position, measuring the amount of light scattered in various directions. This provides a sampled version of the BRDF that can be used to model the material. Generally, some method of interpolation is done to give reflectance values between these sample points.
Unlike an analytical model BRDF, a sampled BRDF does not have any parameters that can be adjusted to achieve lighting effects and provide variations on the material type. So, for instance, a BRDF sampled from fabric can only be used to describe that exact same type of fabric under the exact same lighting conditions. Other knits, thicknesses, and styles of the fabric under other lighting situations could not be represented without somehow being able to adjust the BRDF.
Lafortune et al ([Laf]) describe a way to fit one or more generalized cosine lobes to the BRDF in order to get an analytic representation of a sampled BRDF. This is done mainly for ease of computation since these sampled BRDFs often involve a huge amount of data. Once a function has been fit to the data slight adjustments may be made to its parameters in order to vary the reflectance of the material. However, changing the parameters too much may not yield a reflectance function that is consistent with the reflectance of any real variation of the material. For example, taking the BRDF of flat paint and varying the parameters may yield something that doesn't look like paint anymore. Another problem with using the Lafortune model in this manner is that each lobe that is fit to the BRDF depends on a large number of parameters, and it is not very intuitive how changing any one of these parameters will affect the look of the surface.
One of the things that adds realism to a scene is variation in the materials of the objects. Often a set of objects supposedly made of the same material will have slight variations from object to object. For instance not all pairs of blue jeans reflect light exactly the same way. Rather than sampling or modeling many types of denim, it would be nice to model just a single type and be able to adjust the style by tuning some parameters. Ideally a scene designer, when creating a particular surface or object, should be able to adjust the parameters of the material in order to achieve a desired look. The number of parameters should be relatively small (since a large parameter set makes the search more difficult and unintuitive) and all values of the parameters should yield reflectances that are reasonable for the material in question. This is the main motivation for this project. We develop a new technique of adjusting a BRDF while preserving its characteristic shape.
In this section we focus on transforming a single lobe of a BRDF. We develop parameters for this transformation and discuss how the adjustment of these parameters affects the shape of the BRDF. We will discuss later how to extend this method to adjust multiple lobes of a BRDF independently.
Assume for the moment that the incident light direction (θi, φi) is fixed. The reflectance function R(θi, φi, θv, φv) can be represented as a hemispherical polar plot over reflection directions (θv, φv). Let L be a lobe of R (for example, the specular lobe). L is centered about a certain direction (θL, φL) (in the case of specular reflection in Phong shading, this direction would be the mirror of the incident light direction).
For a given reflection direction (θv, φv), which we'll hereafter refer to as the viewing direction, we define v to be the view vector, a unit length vector pointing in the direction (θv, φv). We'll call the direction (θL, φL) around which the lobe L is centered the lobe direction. Let m be a unit vector pointing in this direction, which we'll call the lobe vector. We now define a new BRDF R' in terms of the old BRDF as follows:
R'(θi, φi, θv, φv) = R(θi, φi, θv', φv').Where θv' and φv' are the azimuth and elevation of a new view vector v' that is a function of the view direction v. v' is defined as
v' = m + (v-m) * F(||v-m||) / ||v-m||.Note that (v-m) is a measure of the deviation between the view vector and the lobe vector. Also note that v' is not necessarily unit length, though this does not matter since the only operation we will perform with v' is to compute its azimuth and elevation angles and plug these into R.
Essentially, we look up the reflectance at a viewing angle v by first rotating v towards or away from the lobe vector according to some function F in order to yield a new vector v', and then v' is plugged into R to produce the reflectance value. Figure 2 shows this for a case where F(x) = c*x where c is a constant > 1. Note that F(x)=x is the identity function for this transformation, which will leave view vector unchanged.

Assume that lobe L attenuates rapidly as the viewing direction deviates from the lobe direction. L is negligible outside a certain region. We will refer to the region in which lobe L is non-negligible as the region of influence of L. By taking any view vector v within this region and bending it towards or away from the lobe direction we produce a new BRDF R' that contains a compressed or expanded version of lobe L. We must be careful, however, not to do this outside L's region of influence. R may contain other important lobes and features besides L. Taking view vectors that are not in L's region and bending them relative to L's lobe direction will move and distort the other features of R. If we assume that L is symmetric about its lobe direction, we can define the region of influence to be all v such that (m-v) < k, for some value of k which we'll call the extent of L. We must require F(x) = x for all x ≥ k.
Discontinuities in F cause discontinuities in R'. Discontinuities in a BRDF cause discontinuities in the intensity across a surface, which results in mach bands. So F(x) must be continuous in the interval [0,k) and F(x) must approach k as x approaches k from below. Similarly, discontinuities in the first derivative of F can also cause discontinuities in the first derivative of intensity in the resulting images, which will also result in mach bands. So we must also require that F'(k) (the first derivative of F at k) is 1. Finally, F(0) must be 0 so that a viewing vector that points exactly in the lobe direction is unaffected.
Any function fitting these constraints may be used for F(x) in the domain [0,k). When the function is below F(x)=x the lobe will be expanded. Where the function is above F(x)=x the lobe will be expanded. It is not necessary that the function lie entirely above or entirely below F(x)=x in the interval [0,k), but we will choose a function that does so in order to keep our function simple so that it may be controlled by a single parameter.
We use a cubic polynomial to represent F(x) in the range [0,k). As described above, there are 3 constraints, leaving one degree of freedom that may be left as a parameter for the user. We will let this parameter, p, control the slope of F at 0. F(x) is now defined as
F(x) = a*x3 + b*x2 + c*x + d, when x is in [0,k).with the constraints
F(0) = 0Fitting a cubic polynomial to these constrains gives coefficients
[a,b,c,d] = [ (p-1)/k2, -2*(p-1)/k, p, 0 ].The parameter p is restricted to non-negative values in order to prevent F from dropping below 0. p essentially determines the strength of the transformation; how much the lobe is compressed (p > 1) or expanded (p < 1). When p=1, the lobe is unchanged.
As an example of this technique, we will show how a user might reshape the highlight of the specular lobe of a Phong BRDF. Of course, this technique is not necessary in the case of the Phong model since it is already possible to reshape the specular highlight by changing the specular coefficient and exponent. We use the Phong model as an example because it is simple and well-known. We fix the specular coefficient and exponent at some arbitrary values and then use only our transformation to shape the highlight. The real advantage of this model is its application to sampled BRDFs, those which were obtained experimentally, for which no analytical model is known.
I created an application for displaying a BRDF using OpenGL. The user selects an incident light direction and the application displays a spherical plot of the BRDF over all viewing directions. The user may then fly around the BRDF, zoom in, and view it from different angles. The user is also able to adjust the extent, k, of the specular lobe and the shaping parameter p. The reshaped BRDF is then superimposed on top of the original BRDF. The original is shown in gray (or the lighter shade of red when located within the new BRDF) and the reshaped BRDF is shown in red. Figure 3 shows some various deformations of the specular lobe.



It is necessary to choose the extent, k, so that it contains the entire lobe. Otherwise, this can give the lobe an unnatural shape, since parts of the lobe will lie outside of the region and will be unaffected by the transformation. The phenomenon is shown in Figure 4.

We find that picking very large values for the shaping parameter p can cause a somewhat unexpected deformation of the lobe. The effects of this are shown in Figure 5a. For moderate values of p, the resulting F is monotonic. However, when p is large enough, it is possible for F to increase, decrease, and then increase again, as shown in Figure 5b. It is questionable whether or not such a transformation produces a reflectance function that corresponds to some actual material variation or lighting situation, but the phenomenon only occurs when p is larger than a certain value, so it is easy for the user to avoid this.




The transformation, as described above, causes the same deformation in all directions about the lobe vector. It is possible, however, to generalize the transformation so that the lobe compresses/expands more in some directions than others. One way to accomplish this is to make the shaping parameter p a function of the orientation (or azimuth) θz of the view vector v with respect to the lobe vector m. To put it another way, imagine a plane orthogonal to m and project v down onto this plane. The angle that the projection of v makes with some fixed axis in the plane is θz. Figure 6 illustrates this angle. The shaping parameter p(θz) can be any smooth, continuous, non-negative polar function of θz. The coefficients a,b,c,d of the cubic polynomial in the deformation function F then become functions of θz, since they depend on p.

Another simplifying assumption made in the description of the transformation is that the region of influence for a lobe is circular, that is, it has the same extent in every direction about the lobe vector. The transformation can be generalized further by making the extent, k, a function of θz. Once again, the extent can be any smooth, continuous, non-negative polar function of θz. The coefficients a,b,c,d of the cubic polynomial in F also become functions of θz, since they depend on k.
So far the transformation has been applied only to a single lobe of the BRDF. For the Phong shading model there is only a specular lobe, but other more complicated shading models--as well as some reflectance functions obtained experimentally--involve more than one lobe. For instance, some models include a retro-reflection lobe that describes light being scattered back towards the incident direction. Other models include a ring-shaped lobe of increased reflectance near the grazing angle. This causes highlights at the edges of an object and is a common feature of metallic materials. If the BRDF contains several lobes, we need only determine for each view vector which region the vector lies in and use the deformation transformation for that particular lobe. If the view vector v lies in more than one region of influence, we can perform the transformation for each of these lobes and use the average of the resulting v' values. Such a situation occurs, for example, when specular and retro reflection are both being used and the light is incident nearly normal to the surface, or when specular and grazing reflection are being used and the light nearly grazes the surface.
This transformation technique does effectively allow the user to shape a highlight. However, it is difficult to tell whether or not the transformation really does preserve the material's characteristic reflectance. One would have to do an extensive comparison of the rendered images with real images of the same materials under the same lighting conditions in order to determine this. Though it is generally agreed that the location, magnitude, and overall thickness of the lobe(s) of a BRDF describe a material's characteristic reflectance properties, it has not been well-studied how minor changes in the shape of a lobe affects the rendered material's resemblance to the real material.
Even if the generalized cosine lobes developed by Lafortune et al have already been fit to the BRDF, it may still be easier for the user to apply this transformation to shape a highlight rather than adjusting the parameters of a Lafortune cosine lobe since our transformation involves fewer parameters and these parameters affect the shape of the highlight in a more intuitive way.
According to the Phong model, the size of the specular lobe's extent does not depend on the incident light direction. The lobe has the same extent no matter where it is centered. However it is possible that a lobe's extent might change significantly as the incident light direction changes. In this case, the user might try setting the extent to the largest value that could occur with any incident direction, but in some cases this extent might be much so large that it begins to encompass the other features of the BRDF.
In conclusion, for some BRDFs the transformation developed in this project may not necessarily be a big improvement over fitting a generalized cosine lobe to the BRDF and then adjusting its parameters, but the idea of bending the view vectors towards or away from a lobe's peak in order to create a compressed or expanded version of that lobe could be a useful idea in other contexts. For this project we chose the rather simple approach of bending the view rays in certain empirically-determined region according to cubic polynomials with an empirically-determined parameter for each individual lobe. However, other similar transformation schemes can be devised. For example, one could bend the view vectors according to the gradient of the BRDF, rather than the deviation of the view vector from the lobe vector. Bending v towards (or away from) the direction of the gradient by an amount proportional to the magnitude of the gradient could provide a more general transform whose parameters can be determined with less user interaction.