Diffusion/diffuse

There are two separate functions of diffusion that can tend to make understanding diffusion difficult. The first of which is source diffusion, which is an indirect method of representing diffused light. The second method is surface diffusion, which is a visible representation of the diffusion of light on a surface. In terms of ArghRad, we shall define diffusion and diffuse as having two different meanings. Diffusion is the process of making light diffuse, and diffuse is light that is scattered or without source.

By definition, the diffusion of a light source is the scattering of direction the light travels. Light that is cast on a cloudy day, or light that is reflected off of a matte surface is diffused. If light were to be filtered through a polarizer, then the scattered light would be eliminated, allowing only polarized light to shine through. ArghRad only handles polarized light.

Source diffusion is represented as a uniform value. Diffused light from a nonspecific source (such as the sky) will scatter any direct lighting, and uniformly cast light of a single value. This is why there are no shadows on cloudy days.

In ArghRad, Surface diffusion methods are decieving, since they do not actually diffuse the light. The surface diffusion methods used by ArghRad fade light as the angle from the source increases (this is when light would be more likely to be diffused). This fading is similar to the diffuse reflection that occurs when light strikes a surface. Since ArghRad bounces light, but does not diffuse the light, surface diffusion methods can help create a more realistic shadow.

ArghRad is capable of emulating the diffusion of light in four ways. The first method, _sun_ambient, which is a source diffusion method. The light value assigned to the _sun_ambient key is applied as a uniform minimum light value to any surface that has a line of sight to any lit sky texture but does not have a direct line of sight to a sky texture at the coordinate angle of the sun.

The second method is _sun_diffuse. This method is a hybrid between surface and source diffusion. Setting a _sun_diffuse value will tell ArghRad to fill the area between your highlight brightness and your shadow areas with an in-between shadow which fades as it moves away from its origin. The resulting ramping shadow will create a smoother appearance for your sun's shadow. You can control the rate at which _sun_diffuse fades with the _sun_difwait or _sun_diffade keys.

The _focus keyvalue pair can be added to a spotlight to control the rate at which the edges of a spotlight's illumination fades. By decreasing the brightness of the reflection as the angle that the light strikes the surface increases, _focus can emulate surface diffusion.

Finally, _angfade and _angwait provide us a means of creating the effect of diffusion with normal point lights. The _focus key and the _angfade/_angwait keys are very similar, except that _focus works in the direction of the spot. As the angle that the light strikes the surface increases, the brightness decreases.

Although setting a global minimum light level may have its similarities to diffusion, I do not consider it to be a diffusion technique, since there is no logical source. It is simply a global minimum for the brightness of textures.

See the example map for diffusion in application.