Second Life's light model for materials

From Second Life Wiki
Jump to navigation Jump to search

For viewers capable of viewing materials, Second Life uses a lighting model based around a Gaussian BRDF. This provides a moderately controllable BRDF that allows content creators to create a wide variety of a materials inworld.

What's all this about a BRDF?

A BRDF, or Bidirectional Reflectance Distribution Function, is something that defines how a surface reflects light. BRDFs can contain multiple parameters that allows a content creator to adjust a surface’s “look and feel”, such as specular exponent, reflection strength, diffuse color, and even transparency. In Second Life, we expose the following basic controls:

Parameter Description
Diffuse Color Tints the diffuse color of the surface
Diffuse Texture Sets the per-pixel diffuse color of the surface
Specular Color Tints the specular reflectance (or light reflectance) of the surface
Specular Texture Sets the per-pixel color of light reflected from a surface
Specular Exponent (“Glossiness”) Defines the surface-wide “Glossiness” of the surface
Environment Intensity Defines the amount of the environment reflected on the entire surface
Normal Map Defines different per-pixel details of a surface

Each texture map supports an alpha channel to store additional attributes as well, that can be combined with some of the other attributes above. For an explanation of these alpha channels, please refer to Alpha Modes Do’s and Dont's.

Second Life's BRDF

Second life uses a custom normalized Gaussian specular reflectance model combined with a Lambertian diffuse reflectance model. This allows content creators to create a broad range of material types, such as metallic materials that have high reflectance values, to more diffuse materials such as stone. Second Life’s environmental reflectance model is energy conserving, meaning the more a surface reflects the environment, the less of the diffuse color is reflected as well. This is handy for glass and metallic surfaces.

Normalized Specular Reflectance

“Normalized” specular reflectance allows the specular highlight on the surface to go higher than 1 at higher specular exponents, allowing for the surface to have bright and sharp highlights from other light sources. Second Life uses a custom Gaussian reflectance model, using a normalization factor that guarantees that light reflectance never exceeds a value of two per light source, thus providing a reasonably high value for specular reflectance on metallic and wet surfaces, while also keeping values well within controllable ranges without necessitating extra controls. Second Life’s specular highlights *are not* physically based, and are primarily designed to satisfy a wider range of use cases with as few number of parameters as possible.

Here’s an example of how specular reflectance “scales” on surfaces at varying exponents: [images showing how reflectance scales on a single object]

If you don’t like the effects of a normalized specular model, then there’s a very simple fix for that to get closer to ordinary models such as Blinn-Phong: tint the surface’s specular color!

Since higher exponents results in brighter highlights, tinting the surface’s specular color to be slightly darker would alleviate any “over brightening” for many surfaces in areas where there’s higher specular exponents.

Tips and tricks

A few tips and tricks when producing materials:

  • Metallic surfaces benefit from SL’s normalized specular reflectance and energy conserving reflectance. Don’t forget to use the specular map’s environment mask to mask off painted portions, and to emphasize oily or greasy portions of your material!
  • Plastic surfaces benefit greatly from a small touch of environment reflectivity (not too much though!), and medium to high specular exponents.
  • Skin tends to have very soft specular reflectance, and living tissue tends to have a very subtle “glow” to it (known as bioluminescence). Skin almost never reflects the environment in any meaningful way aside from the environment’s lighting.
  • Fabrics such as fleece tend to be entirely diffuse, with fabrics such as silk tending to reflect much of the environment’s lighting.